root/src/Makefile.in

Revision e89b15c7be666c88fd7ba7d7080a32437f406006, 14.4 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 1 day ago)

initial pass at MDB helpers

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