root/src/Makefile.in

Revision b6cd323c7cceec5f6058622b15dedf94a5c7eb14, 12.9 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 3 weeks ago)

fix parallel builds

  • Property mode set to 100644
Line 
1 .SUFFIXES: .re .c
2
3 CC=@CC@
4 CPPFLAGS=@CPPFLAGS@
5 CFLAGS=@CFLAGS@
6 CLINKFLAGS=@CLINKFLAGS@
7 LUACFLAGS=@LUACFLAGS@
8 PGCFLAGS=@PGCFLAGS@
9 LDFLAGS=@LDFLAGS@
10 DEPFLAGS=@DEPFLAGS@
11 AR=@AR@
12 RANLIB=@RANLIB@
13 LIBS=@LIBS@
14 INSTALL=@INSTALL@
15 XML2H=@top_srcdir@/buildtools/xml2h
16 MAPFLAGS=@MAPFLAGS@
17 CTFCONVERT=@CTFCONVERT@
18 CTFMERGE=@CTFMERGE@
19
20 prefix=@prefix@
21 exec_prefix=@exec_prefix@
22 bindir=@bindir@
23 sbindir=@sbindir@
24 libdir=@libdir@
25 includedir=${prefix}/include
26 libexecdir=@libexecdir@
27 localstatedir=@localstatedir@
28 datarootdir=@datarootdir@
29 datadir=@datadir@
30 mandir=@mandir@
31 mansubdir=@mansubdir@
32 docdir=${prefix}/@docdir@
33 sysconfdir=@sysconfdir@
34 srcdir=@srcdir@
35 top_srcdir=@top_srcdir@
36 MODULES_DIR=@MODULES_DIR@
37
38 WHOLE_ARCHIVE=@WHOLE_ARCHIVE@
39 NOWHOLE_ARCHIVE=@NOWHOLE_ARCHIVE@
40
41 DTRACEOBJ=@DTRACEOBJ@
42 NOITD_DTRACEOBJ=$(DTRACEOBJ:%dtrace_stub.o=noitd_%dtrace_stub.o)
43 STRATCOND_DTRACEOBJ=$(DTRACEOBJ:%dtrace_stub.o=stratcond_%dtrace_stub.o)
44
45 TARGETS=noitd stratcond noit.conf test-noit.conf stratcon.conf test-stratcon.conf \
46         jlog/jlogctl
47
48 all:    reversion $(TARGETS) java-bits make-modules make-man
49
50 MODDIR=modules
51
52 HEADERS=noit_capabilities_listener.h noit_check.h noit_check_resolver.h \
53         noit_check_rest.h \
54         noit_check_tools_shared.h \
55         noit_check_tools.h noit_conf.h noit_conf_checks.h noit_conf_private.h \
56         noit_version.h \
57         noit_config.h noit_console.h noit_console_telnet.h noit_defines.h \
58         noit_filters.h noit_http.h noit_jlog_listener.h noit_listener.h \
59         noit_livestream_listener.h noit_main.h noit_module.h noit_rest.h \
60         noit_tokenizer.h noit_xml.h \
61         stratcon_datastore.h stratcon_iep.h stratcon_jlog_streamer.h \
62         stratcon_realtime_http.h \
63         eventer/OETS_asn1_helper.h eventer/eventer.h \
64         eventer/eventer_POSIX_fd_opset.h eventer/eventer_SSL_fd_opset.h \
65         eventer/eventer_jobq.h \
66         utils/noit_atomic.h utils/noit_b64.h utils/noit_hash.h \
67         utils/noit_log.h utils/noit_mkdir.h utils/noit_security.h \
68         utils/noit_sem.h utils/noit_skiplist.h utils/noit_str.h \
69         utils/noit_watchdog.h utils/noit_lockfile.h \
70         utils/noit_hooks.h \
71         noitedit/chared.h noitedit/common.h noitedit/compat.h noitedit/el.h \
72         noitedit/el_term.h noitedit/emacs.h noitedit/fcns.h noitedit/fgetln.h \
73         noitedit/help.h noitedit/hist.h noitedit/histedit.h noitedit/key.h \
74         noitedit/map.h noitedit/parse.h noitedit/prompt.h noitedit/refresh.h \
75         noitedit/search.h noitedit/sig.h noitedit/strlcpy.h noitedit/sys.h \
76         noitedit/tokenizer.h noitedit/tty.h noitedit/vi.h \
77         jlog/jlog.h jlog/jlog_config.h jlog/jlog_hash.h jlog/jlog_io.h
78
79 include Makefile.objs
80
81 NOIT_OBJS=noitd.o noit_main.o noit_listener.o \
82         noit_console.o noit_console_state.o noit_console_telnet.o \
83         noit_console_complete.o noit_check_resolver.o \
84         noit_check_tools_shared.o noit_check_log_helpers.o \
85         noit_check.o noit_check_log.o noit_check_tools.o \
86         noit_module.o noit_conf.o noit_conf_checks.o noit_tokenizer.o \
87         noit_capabilities_listener.o noit_xml.o \
88         noit_jlog_listener.o noit_livestream_listener.o noit_filters.o \
89         noit_http.o noit_rest.o noit_check_rest.o noit_filters_rest.o \
90         noit_events_rest.o bundle.pb-c.o \
91         $(UDNS_LIB_OBJS) $(NOITEDIT_LIB_OBJS) $(EVENTER_LIB_OBJS) \
92         $(JLOG_LIB_OBJS) $(NOIT_UTILS_OBJS) $(JSON_LIB_OBJS) $(YAJL_LIB_OBJS) \
93         $(LUA_OBJS)
94
95 NOIT_LIBS=libudns libnoitedit libeventer libjlog libnoit_utils libnoitjson libnoityajl
96 NOIT_LIB_FILES=udns/libudns.o noitedit/libnoitedit.a eventer/libeventer.a \
97         jlog/libjlog.a utils/libnoit_utils.a json-lib/libnoitjson.a yajl-lib/libnoityajl.a
98
99 STRATCON_OBJS=stratcond.o noit_main.o noit_listener.o \
100         noit_console.o noit_console_state.o noit_console_telnet.o \
101         noit_console_complete.o noit_xml.o \
102         noit_conf.o noit_http.o noit_rest.o noit_tokenizer.o \
103         noit_capabilities_listener.o noit_module.o \
104         noit_events_rest.o noit_check_tools_shared.o noit_check_log_helpers.o \
105         stratcon_realtime_http.o \
106         stratcon_jlog_streamer.o stratcon_datastore.o \
107         stratcon_iep.o \
108         bundle.pb-c.o \
109         $(UDNS_LIB_OBJS) $(NOITEDIT_LIB_OBJS) $(EVENTER_LIB_OBJS) \
110         $(JLOG_LIB_OBJS) $(NOIT_UTILS_OBJS) $(JSON_LIB_OBJS) $(YAJL_LIB_OBJS)
111
112 FINAL_STRATCON_OBJS=$(STRATCON_OBJS:%.o=stratcon-objs/%.o)
113 FINAL_NOIT_OBJS=$(NOIT_OBJS:%.o=noit-objs/%.o)
114
115 lua/src/lua:
116         (cd lua/src && $(MAKE) lua)
117
118 noit-objs/%.o:  %.o
119         @mkdir -p "`dirname $@`"
120         @echo "- making private $@"
121         @cp $(@:noit-objs/%.o=%.o) $@
122         @if test -x "$(CTFCONVERT)" ; then \
123                 echo "- making CTF ($@)" ; \
124                 $(CTFCONVERT) -g -i -l @VERSION@ $@ ; \
125         fi
126
127 stratcon-objs/%.o:      %.o
128         @mkdir -p "`dirname $@`"
129         @echo "- making private $@"
130         @cp $(@:stratcon-objs/%.o=%.o) $@
131         @if test -x "$(CTFCONVERT)" ; then \
132                 echo "- making CTF ($@)" ; \
133                 $(CTFCONVERT) -g -i -l @VERSION@ $@ ; \
134         fi
135
136 make-man:
137         @(cd man && $(MAKE) -s)
138
139 make-modules:
140         @for dir in $(MODDIR) ; do \
141                 (cd $$dir && $(MAKE) -s) ; \
142         done
143
144 java-bits:
145         @-test -n "@JAVAPARTS@" && (cd java && $(MAKE) -s)
146
147 jlog/jlogctl:
148         @echo "- building jlogctl"
149         @(cd jlog && $(MAKE) -s jlogctl)
150
151 .PHONY: reversion
152
153 reversion:
154         @$(top_srcdir)/buildtools/mkversion.sh noit_version.h
155
156 noit_version.h:
157         @$(top_srcdir)/buildtools/mkversion.sh noit_version.h
158
159 man/noitd.usage.h:      make-man
160
161 man/stratcond.usage.h:  make-man
162
163
164 noitd.o:        man/noitd.usage.h
165 stratcond.o:    man/stratcond.usage.h
166
167 stratcon_jlog_streamer.o:       noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
168 noit_check_tools.o:     noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
169 noit_check.o:   noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
170 dtrace_probes.h:        noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
171
172 stratcond_@DTRACEOBJ@:    $(FINAL_STRATCON_OBJS)
173         @echo "- assembling $@" && \
174         @DTRACE@ @DTRACEFLAGS@ -Z -G -s stratcon_dtrace_probes.d -o stratcond_@DTRACEOBJ@ $(FINAL_STRATCON_OBJS)
175
176 noitd_@DTRACEOBJ@:    $(FINAL_NOIT_OBJS)
177         @echo "- assembling $@" && \
178         @DTRACE@ @DTRACEFLAGS@ -Z -G -s noit_dtrace_probes.d -o noitd_@DTRACEOBJ@ $(FINAL_NOIT_OBJS)
179
180 noit_@DTRACEHDR@:    noit_dtrace_probes.d
181         @if test -z "@DTRACE@" ; then \
182                 echo "- faking dtrace header" ; \
183                 cp ./noit_@DTRACEHDR@.stock ./noit_@DTRACEHDR@ ; \
184         else \
185                 echo "- building dtrace header $@" ; \
186                 @DTRACE@ -h -s noit_dtrace_probes.d ; \
187         fi
188
189 stratcon_@DTRACEHDR@:    stratcon_dtrace_probes.d
190         @if test -z "@DTRACE@" ; then \
191                 echo "- faking dtrace header" ; \
192                 cp ./stratcon_@DTRACEHDR@.stock ./stratcon_@DTRACEHDR@ ; \
193         else \
194                 echo "- building dtrace header $@" ; \
195                 @DTRACE@ -h -s stratcon_dtrace_probes.d ; \
196         fi
197
198 noitd:  $(FINAL_NOIT_OBJS) man/noitd.usage.h $(NOITD_DTRACEOBJ)
199         @echo "- linking $@"
200         @$(CC) $(CLINKFLAGS) -o $@ $(FINAL_NOIT_OBJS) \
201                 $(NOITD_DTRACEOBJ) \
202                 $(LDFLAGS) \
203                 $(MAPFLAGS) \
204                 $(LIBS)
205         @if test -x "$(CTFMERGE)" ; then \
206                 $(CTFMERGE) -l @VERSION@ -o $@ $(FINAL_NOIT_OBJS) $(NOITD_DTRACEOBJ) ; \
207         fi
208
209 stratcond:      $(FINAL_STRATCON_OBJS) $(STRATCOND_DTRACEOBJ)
210         @echo "- linking $@"
211         @$(CC) $(CLINKFLAGS) -o $@ $(FINAL_STRATCON_OBJS) \
212                 $(STRATCOND_DTRACEOBJ) \
213                 $(LDFLAGS) \
214                 $(MAPFLAGS) \
215                 $(LIBS)
216         @if test -x "$(CTFMERGE)" ; then \
217                 $(CTFMERGE) -l @VERSION@ -o $@ $(FINAL_STRATCON_OBJS) $(STRATCOND_DTRACEOBJ) ; \
218         fi
219
220 stratcon_datastore.o:   stratcon_datastore.c
221         @echo "- compiling $<"
222         @$(CC) $(CPPFLAGS) $(PGCFLAGS) $(CFLAGS) -c $<
223
224 .c.o:
225         @if [ "`dirname $@`" != "." ] ; then \
226                 (cd "`dirname $@`" && $(MAKE) "`basename $@`") ; \
227         else \
228                 echo "- compiling $<" ; \
229                 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< ; \
230         fi
231
232 udns/udns_codes.c:
233         @(cd udns && $(MAKE) udns_codes.c)
234
235 utils/noit_atomic_sol_sparcv8plus.o:    utils/noit_atomic_sol.s
236         @(cd utils && $(MAKE) noit_atomic_sol_sparcv8plus.o)
237
238 utils/noit_atomic_sol_sparcv9.o:        utils/noit_atomic_sol.s
239         @(cd utils && $(MAKE) noit_atomic_sol_sparcv9.o)
240
241 utils/noit_atomic_sol_x86_32.o: utils/noit_atomic_sol.s
242         @(cd utils && $(MAKE) noit_atomic_sol_x86_32.o)
243
244 utils/noit_atomic_sol_x86_64.o: utils/noit_atomic_sol.s
245         @(cd utils && $(MAKE) noit_atomic_sol_x86_64.o)
246
247 noit_module.o:  module-online.h
248
249 module-online.h:        modules/module-online.xsl
250         @echo "- making module-online.h (StyleSheet include)"
251         @$(XML2H) helpStyleXML < modules/module-online.xsl > $@
252
253 noit_tokenizer.c:
254         @echo "- re2c noit_tokenizer.re"
255         @re2c -o $@ noit_tokenizer.re
256
257 test-noit.conf: noit.conf.in Makefile
258         @sed -e "s^%sysconfdir%^`pwd`^g;" \
259                 -e "s^%modulesdir%^`pwd`/modules^g;" \
260                 -e "s^%modulesluadir%^`pwd`/modules-lua^g;" \
261                 -e "s^%datarootdir%^`pwd`^g;" \
262                 -e "s^%PKIPREFIX%^../test/test-^g;" < \
263                 noit.conf.in > \
264                 test-noit.conf
265
266 noit.conf:      noit.conf.in Makefile
267         @sed -e "s^%sysconfdir%^$(sysconfdir)^g;" \
268                 -e "s^%modulesdir%^$(MODULES_DIR)^g;" \
269                 -e "s^%modulesluadir%^$(MODULES_DIR)^g;" \
270                 -e "s^%datarootdir%^$(datadir)^g;" \
271                 -e "s^%PKIPREFIX%^$${PKIPREFIX}^g;" < \
272                 noit.conf.in > \
273                 noit.conf
274
275 test-stratcon.conf:     stratcon.conf.in Makefile
276         @sed -e "s^%sysconfdir%^`pwd`^g;" \
277                 -e "s^%modulesdir%^`pwd`/modules^g;" \
278                 -e "s^%modulesluadir%^`pwd`/modules-lua^g;" \
279                 -e "s^%iepbindir%^`pwd`/java^g;" \
280                 -e "s^%iepdbdir%^`pwd`/java^g;" \
281                 -e "s^%PKIPREFIX%^../test/test-^g;" < \
282                 stratcon.conf.in > \
283                 test-stratcon.conf
284
285 stratcon.conf:  stratcon.conf.in Makefile
286         @sed -e "s^%sysconfdir%^$(sysconfdir)^g;" \
287                 -e "s^%modulesdir%^$(MODULES_DIR)^g;" \
288                 -e "s^%modulesluadir%^$(MODULES_DIR)^g;" \
289                 -e "s^%iepbindir%^$(bindir)^g;" \
290                 -e "s^%iepdbdir%^$(localstatedir)/db/noit-iep^g;" \
291                 -e "s^%PKIPREFIX%^$${PKIPREFIX}^g;" < \
292                 stratcon.conf.in > \
293                 stratcon.conf
294
295 install-dirs:
296         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(bindir)
297         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(sbindir)
298         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(sysconfdir)
299         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(datadir)/noit-web
300
301 install-headers:        $(HEADERS)
302         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(bindir)
303         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
304         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)/eventer
305         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)/utils
306         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)/noitedit
307         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)/jlog
308         $(INSTALL) -m 0755 scripts/noit-config $(DESTDIR)$(bindir)/noit-config
309         for file in $(HEADERS) ; do \
310                 $(INSTALL) -m 0644 $$file $(DESTDIR)$(includedir)/$$file ; \
311         done
312
313 install-noitd:  install-dirs reversion noitd noit.conf java-bits jlog/jlogctl
314         $(INSTALL) -m 0755 scripts/noittrap $(DESTDIR)$(bindir)/noittrap
315         $(INSTALL) -m 0755 jlog/jlogctl $(DESTDIR)$(bindir)/noit_jlogctl
316         $(INSTALL) -m 0755 noitd $(DESTDIR)$(sbindir)/noitd
317         $(INSTALL) -m 0644 noit.conf $(DESTDIR)$(sysconfdir)/noit.conf.sample
318         $(INSTALL) -m 0644 config_templates.conf $(DESTDIR)$(sysconfdir)/config_templates.conf
319         $(INSTALL) -m 0644 default-ca-chain.crt $(DESTDIR)$(sysconfdir)/default-ca-chain.crt
320         (cd modules && $(MAKE) install-modules DESTDIR=$(DESTDIR))
321         (cd modules-lua && $(MAKE) install DESTDIR=$(DESTDIR))
322         (cd noit-web && tar cf - .) | (cd $(DESTDIR)$(datadir)/noit-web && tar xf -)
323         -test -n "@JAVAPARTS@" && (cd @JAVAPARTS@ && $(MAKE) install-jezebel DESTDIR=$(DESTDIR))
324
325 install-stratcond:      install-dirs reversion stratcond stratcon.conf java-bits
326         $(INSTALL) -m 0755 stratcond $(DESTDIR)$(sbindir)/stratcond
327         $(INSTALL) -m 0644 stratcon.conf $(DESTDIR)$(sysconfdir)/stratcon.conf.sample
328         (cd modules && $(MAKE) install-smodules DESTDIR=$(DESTDIR))
329         -test -n "@JAVAPARTS@" && (cd @JAVAPARTS@ && $(MAKE) install-iep DESTDIR=$(DESTDIR))
330
331 install-docs:
332         (cd man && $(MAKE) install DESTDIR=$(DESTDIR))
333
334 install:        install-dirs install-docs install-headers install-noitd install-stratcond
335
336 clean:
337         rm -f *.o $(TARGETS) $(LUA_OBJS)
338         rm -f module-online.h
339         rm -rf noit-objs stratcon-objs
340         (cd jlog && $(MAKE) clean)
341         (cd eventer && $(MAKE) clean)
342         (cd udns && $(MAKE) clean)
343         (cd man && $(MAKE) clean)
344         (cd modules && $(MAKE) clean)
345         (cd noitedit && $(MAKE) clean)
346         (cd utils && $(MAKE) clean)
347         (cd json-lib && $(MAKE) clean)
348         (cd yajl-lib && $(MAKE) clean)
349         (cd java && $(MAKE) clean)
350         (cd LuaJIT && $(MAKE) clean)
351         (cd lua/src && $(MAKE) clean)
352
353 Makefile.noit.dep:
354         find noit-objs -name \*.o | grep -v 'eventer_.*_impl.o' | sort | awk '{gsub("^.+-objs/", ""); print "noit-objs/"$$1": "$$1;}' > $@
355         for impl in kqueue ports epoll; do \
356                 echo "noit-objs/eventer/eventer_$${impl}_impl.o: eventer/eventer_$${impl}_impl.o" >> $@ ; \
357         done
358
359 Makefile.stratcon.dep:
360         find stratcon-objs -name \*.o | grep -v 'eventer_.*_impl.o' | sort | awk '{gsub("^.+-objs/", ""); print "stratcon-objs/"$$1": "$$1;}' > $@
361         for impl in kqueue ports epoll; do \
362                 echo "stratcon-objs/eventer/eventer_$${impl}_impl.o: eventer/eventer_$${impl}_impl.o" >> $@ ; \
363         done
364
365 Makefile.dep:
366         $(CC) -I. $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) *.c > Makefile.dep
367         for d in utils jlog udns eventer noitedit json-lib yajl-lib; do \
368                 $(CC) -I. $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) $$d/*.c | \
369                 perl -pe 's#(\s)([^\s\\])#$$1$$2#g; s#^(\S)#'$$d'/$$1#;' >> \
370                 Makefile.dep ; \
371         done
372         $(top_srcdir)/buildtools/culldeps.sh Makefile.dep
373
374 include Makefile.dep
375 include Makefile.noit.dep
376 include Makefile.stratcon.dep
377
378 distclean-subdirs:
379         for dir in jlog eventer udns man modules modules-lua noitedit utils json-lib yajl-lib LuaJIT lua/src java ; do \
380                 (cd $$dir && $(MAKE) distclean) ; \
381         done
382
383 distclean:      clean distclean-subdirs
384         rm -f Makefile noit_config.h scripts/noit-config
385
386 bundle:
387         protoc bundle.proto --java_out=java
388         protoc-c bundle.proto --c_out=.
Note: See TracBrowser for help on using the browser.