root/src/Makefile.in

Revision 19c04c791d05d8ac6f7d1cf42c3db5582f69707b, 12.5 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 5 months ago)

fix make typo and make exit status clearer

  • Property mode set to 100644
Line 
1 .SUFFIXES: .lo .re .c
2
3 Q=
4 ifeq ($(V),)
5         Q=@
6 endif
7
8 LIBNOIT_VERSION=0.0.1
9
10 prefix=@prefix@
11 exec_prefix=@exec_prefix@
12 bindir=@bindir@
13 sbindir=@sbindir@
14 libdir=@libdir@
15 includedir=@includedir@
16 libexecdir=@libexecdir@
17 localstatedir=@localstatedir@
18 datarootdir=@datarootdir@
19 datadir=@datadir@
20 mandir=@mandir@
21 mansubdir=@mansubdir@
22 docdir=${prefix}/@docdir@
23 sysconfdir=@sysconfdir@
24 srcdir=@srcdir@
25 top_srcdir=@top_srcdir@
26 MODULES_DIR=@MODULES_DIR@
27 MTEV_MODULES_DIR=@MTEV_MODULES_DIR@
28
29 CC=@CC@
30 SHLD=@SHLD@
31 CPPFLAGS=@CPPFLAGS@
32 CFLAGS=@CFLAGS@
33 SHCFLAGS=@SHCFLAGS@
34 CLINKFLAGS=@CLINKFLAGS@
35 LUACFLAGS=@LUACFLAGS@
36 PGCFLAGS=@PGCFLAGS@
37 LDFLAGS=@LDFLAGS@ -L$(libdir)
38 RLDFLAG=@RLDFLAG@
39 ifneq ($(strip $(RLDFLAG)),)
40   LDFLAGS += @RLDFLAG@$(libdir)
41 endif
42 SHLDFLAGS=@SHLDFLAGS@
43 LIBNOIT_LIBS=@LIBNOIT_LIBS@
44 DEPFLAGS=@DEPFLAGS@
45 MODULELD=@MODULELD@
46 AR=@AR@
47 RANLIB=@RANLIB@
48 LIBS=@LIBS@
49 INSTALL=@INSTALL@
50 XML2H=@top_srcdir@/buildtools/xml2h
51 MAPFLAGS=@MAPFLAGS@
52 CTFCONVERT=@CTFCONVERT@
53 CTFMERGE=@CTFMERGE@
54
55 # Later versions of ctf* tools no longer have -g and by default do not strip,
56 # so we get the same behavior as with -g on older versions.
57 ifneq ($(wildcard $(CTFCONVERT)),)
58   HAS_G=$(shell $(CTFCONVERT) 2>&1 | grep -- -gis)
59   ifneq ($(HAS_G),)
60     CTFNOSTRIP=-g
61   else
62     CTFNOSTRIP=
63   endif
64 endif
65
66 WHOLE_ARCHIVE=@WHOLE_ARCHIVE@
67 NOWHOLE_ARCHIVE=@NOWHOLE_ARCHIVE@
68
69 DTRACEOBJ=@DTRACEOBJ@
70 NOITD_DTRACEOBJ=$(DTRACEOBJ:%dtrace_stub.o=noitd_%dtrace_stub.o)
71 STRATCOND_DTRACEOBJ=$(DTRACEOBJ:%dtrace_stub.o=stratcond_%dtrace_stub.o)
72 LIBNOIT_V=libnoit@DOTSO@.$(LIBNOIT_VERSION)@DOTDYLIB@
73 LIBNOIT=libnoit@DOTSO@@DOTDYLIB@
74
75 TARGETS=noitd stratcond noit.conf test-noit.conf stratcon.conf test-stratcon.conf \
76         $(LIBNOIT) @MDB_MODS@
77
78 all:    reversion $(TARGETS) java-bits make-modules make-man tests
79
80 tests:
81         $(MAKE) -C modules tests
82
83 MODDIR=modules
84
85 HEADERS=noit_metric.h noit_check_log_helpers.h noit_check_tools_shared.h \
86         stratcon_ingest.h
87
88 NOIT_HEADERS=noit_check.h noit_check_resolver.h \
89         noit_check_rest.h noit_check_tools.h \
90         noit_conf_checks.h \
91         noit_filters.h noit_jlog_listener.h noit_livestream_listener.h \
92         noit_module.h
93
94 STRATCON_HEADERS=stratcon_datastore.h stratcon_iep.h stratcon_jlog_streamer.h \
95         stratcon_realtime_http.h
96
97 ENABLE_LUA=@ENABLE_LUA@
98 LUALIBS=@LUALIBS@
99
100 LIBNOIT_OBJS=noit_check_log_helpers.lo bundle.pb-c.lo \
101         noit_check_tools_shared.lo stratcon_ingest.lo
102
103 NOIT_OBJS=noitd.o noit_mtev_bridge.o \
104         noit_check_resolver.o \
105         noit_check.o noit_check_log.o noit_check_tools.o \
106         noit_module.o noit_conf_checks.o \
107         noit_jlog_listener.o noit_livestream_listener.o noit_filters.o \
108         noit_check_rest.o noit_filters_rest.o \
109         $(LIBNOIT_OBJS:%.lo=%.o)
110
111 STRATCON_OBJS=stratcond.o noit_mtev_bridge.o \
112         stratcon_realtime_http.o \
113         stratcon_jlog_streamer.o stratcon_datastore.o \
114         stratcon_iep.o \
115         $(LIBNOIT_OBJS:%.lo=%.o)
116
117 FINAL_STRATCON_OBJS=$(STRATCON_OBJS:%.o=stratcon-objs/%.o)
118 FINAL_NOIT_OBJS=$(NOIT_OBJS:%.o=noit-objs/%.o)
119 FINAL_LIBNOIT_OBJS=$(LIBNOIT_OBJS:%.lo=libnoit-objs/%.lo)
120
121 noit-objs/%.o:  %.o
122         @mkdir -p "`dirname $@`"
123         @echo "- making private $@"
124         @cp $(@:noit-objs/%.o=%.o) $@
125         @if test -x "$(CTFCONVERT)" ; then \
126                 echo "- making CTF ($@)" ; \
127                 $(CTFCONVERT) $(CTFNOSTRIP) -i -l @VERSION@ $@ ; \
128         fi
129
130 libnoit-objs/%.lo:      %.lo
131         @mkdir -p "`dirname $@`"
132         @echo "- making private $@"
133         @cp $(@:libnoit-objs/%.lo=%.lo) $@
134         @if test -x "$(CTFCONVERT)" ; then \
135                 echo "- making CTF ($@)" ; \
136                 $(CTFCONVERT) $(CTFNOSTRIP) -i -l @VERSION@ $@ ; \
137         fi
138
139 stratcon-objs/%.o:      %.o
140         @mkdir -p "`dirname $@`"
141         @echo "- making private $@"
142         @cp $(@:stratcon-objs/%.o=%.o) $@
143         @if test -x "$(CTFCONVERT)" ; then \
144                 echo "- making CTF ($@)" ; \
145                 $(CTFCONVERT) $(CTFNOSTRIP) -i -l @VERSION@ $@ ; \
146         fi
147
148 make-man:
149         @(cd man && $(MAKE) -s)
150
151 make-modules:
152         @for dir in $(MODDIR) ; do \
153                 (cd $$dir && $(MAKE) -s) ; \
154         done
155
156 java-bits:
157         @-test -n "@JAVAPARTS@" && (cd java && $(MAKE) -s)
158
159 .PHONY: reversion
160
161 reversion:
162         @$(top_srcdir)/buildtools/mkversion.sh noit_version.h
163
164 noit_version.h:
165         @$(top_srcdir)/buildtools/mkversion.sh noit_version.h
166
167 noit.env:       noit_version.h noit_config.h
168         awk '/^#define[         ]+NOIT_BRANCH/{print $$2"="$$3;}' < noit_version.h > $@
169         cat noit_version.h | tr '[".]' ' ' | awk '/^#define[    ]+NOIT_VERSION/{print $$2"=\""$$3"\""; print $$2"_TSTAMP=\""$$4"\"";}' >> $@
170         awk '/^#define[         ]+NOIT_UNAME_[^V]/{print "BUILD_"$$2"="$$3;}' < noit_config.h >> $@
171
172 man/noitd.usage.h:      make-man
173
174 man/stratcond.usage.h:  make-man
175
176
177 noitd.o:        man/noitd.usage.h
178 stratcond.o:    man/stratcond.usage.h
179
180 stratcon_jlog_streamer.o:       noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
181 noit_check_tools.o:     noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
182 noit_check.o:   noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
183 dtrace_probes.h:        noit_@DTRACEHDR@ stratcon_@DTRACEHDR@ libnoit_@DTRACEHDR@
184
185 $(LIBNOIT):     $(LIBNOIT_V)
186         ln -sf $(LIBNOIT_V) $(LIBNOIT)
187
188 $(LIBNOIT_V):   $(FINAL_LIBNOIT_OBJS)
189         @echo "- linking $@"
190         $(SHLD) $(SHLDFLAGS) -o $@ @LD_LIBNOIT_VERSION@ $(FINAL_LIBNOIT_OBJS) $(LIBNOIT_LIBS) -L. -lmtev
191
192 stratcond_@DTRACEOBJ@:    $(FINAL_STRATCON_OBJS)
193         @echo "- assembling $@" && \
194         @DTRACE@ @DTRACEFLAGS@ -Z -G -s stratcon_dtrace_probes.d -o stratcond_@DTRACEOBJ@ $(FINAL_STRATCON_OBJS)
195
196 noitd_@DTRACEOBJ@:    $(FINAL_NOIT_OBJS)
197         @echo "- assembling $@" && \
198         @DTRACE@ @DTRACEFLAGS@ -Z -G -s noit_dtrace_probes.d -o noitd_@DTRACEOBJ@ $(FINAL_NOIT_OBJS)
199
200 noit_@DTRACEHDR@:    noit_dtrace_probes.d
201         @if test -z "@DTRACE@" ; then \
202                 echo "- faking dtrace header" ; \
203                 cp ./noit_@DTRACEHDR@.stock ./noit_@DTRACEHDR@ ; \
204         else \
205                 echo "- building dtrace header $@" ; \
206                 @DTRACE@ -h -s noit_dtrace_probes.d ; \
207         fi
208
209 stratcon_@DTRACEHDR@:    stratcon_dtrace_probes.d
210         @if test -z "@DTRACE@" ; then \
211                 echo "- faking dtrace header" ; \
212                 cp ./stratcon_@DTRACEHDR@.stock ./stratcon_@DTRACEHDR@ ; \
213         else \
214                 echo "- building dtrace header $@" ; \
215                 @DTRACE@ -h -s stratcon_dtrace_probes.d ; \
216         fi
217
218 noitd:  $(FINAL_NOIT_OBJS) man/noitd.usage.h $(NOITD_DTRACEOBJ)
219         @echo "- linking $@"
220         @$(CC) $(CLINKFLAGS) -o $@ $(FINAL_NOIT_OBJS) \
221                 $(NOITD_DTRACEOBJ) \
222                 $(LDFLAGS) \
223                 $(MAPFLAGS) \
224                 $(LIBS) -L. -lmtev $(LUALIBS) -ljlog
225         @if test -x "$(CTFMERGE)" ; then \
226                 $(CTFMERGE) $(CTFNOSTRIP) -l @VERSION@ -o $@ $(FINAL_NOIT_OBJS) $(NOITD_DTRACEOBJ) ; \
227         fi
228
229 stratcond:      $(FINAL_STRATCON_OBJS) $(STRATCOND_DTRACEOBJ)
230         @echo "- linking $@"
231         $(CC) $(CLINKFLAGS) -o $@ $(FINAL_STRATCON_OBJS) \
232                 $(STRATCOND_DTRACEOBJ) \
233                 $(LDFLAGS) \
234                 $(MAPFLAGS) \
235                 $(LIBS) -L. -lmtev
236         @if test -x "$(CTFMERGE)" ; then \
237                 $(CTFMERGE) $(CTFNOSTRIP) -l @VERSION@ -o $@ $(FINAL_STRATCON_OBJS) $(STRATCOND_DTRACEOBJ) ; \
238         fi
239
240 mdb-support/mdb_help.lo:        mdb-support/mdb_help.c
241         @echo "- compiling $@"
242         @$(CC) -Imdb-support $(CPPFLAGS) $(SHCFLAGS) $(CFLAGS) -o $@ -c $<
243
244 SHAREDMDBMODSRC=
245
246 stratcon_datastore.o:   stratcon_datastore.c
247         @echo "- compiling $<"
248         @$(CC) $(CPPFLAGS) $(PGCFLAGS) $(CFLAGS) -c $<
249
250 .c.lo:
251         $(Q)if [ "`dirname $@`" != "." ] ; then \
252                 (cd "`dirname $@`" && $(MAKE) "`basename $@`") ; \
253         else \
254                 echo "- compiling $<" ; \
255           $(CC) $(CPPFLAGS) $(SHCFLAGS) -c $< -o $@ ; \
256         fi
257
258 .c.o:
259         $(Q)if [ "`dirname $@`" != "." ] ; then \
260                 (cd "`dirname $@`" && $(MAKE) "`basename $@`") ; \
261         else \
262                 echo "- compiling $<" ; \
263                 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< ; \
264         fi
265
266 noit_module.o:  module-online.h
267
268 module-online.h:        modules/module-online.xsl
269         @echo "- making module-online.h (StyleSheet include)"
270         @$(XML2H) helpStyleXML < modules/module-online.xsl > $@
271
272 test-noit.conf: noit.conf.in Makefile
273         @mkdir -p scratch/var/log scratch/var/run
274         @sed -e "s^%sysconfdir%^`pwd`^g;" \
275                 -e "s^%modulesdir%^`pwd`/modules^g;" \
276                 -e "s^%mtevmodulesdir%^$(MTEV_MODULES_DIR)^g;" \
277                 -e "s^%modulesluadir%^`pwd`/modules-lua^g;" \
278                 -e "s^%datarootdir%^`pwd`^g;" \
279                 -e "s^%PKIPREFIX%^../test/test-^g;" \
280                 -e "s^/var/^`pwd`/scratch/var/^g;" < \
281                 noit.conf.in > \
282                 test-noit.conf
283
284 noit.conf:      noit.conf.in Makefile
285         @sed -e "s^%sysconfdir%^$(sysconfdir)^g;" \
286                 -e "s^%modulesdir%^$(MODULES_DIR)^g;" \
287                 -e "s^%mtevmodulesdir%^$(MTEV_MODULES_DIR)^g;" \
288                 -e "s^%modulesluadir%^$(MODULES_DIR)^g;" \
289                 -e "s^%datarootdir%^$(datadir)^g;" \
290                 -e "s^%PKIPREFIX%^$${PKIPREFIX}^g;" \
291                 -e "s^/var/^`pwd`/scratch/var/^g;" < \
292                 noit.conf.in > \
293                 noit.conf
294
295 test-stratcon.conf:     stratcon.conf.in Makefile
296         @sed -e "s^%sysconfdir%^`pwd`^g;" \
297                 -e "s^%modulesdir%^`pwd`/modules^g;" \
298                 -e "s^%modulesluadir%^`pwd`/modules-lua^g;" \
299                 -e "s^%iepbindir%^`pwd`/java^g;" \
300                 -e "s^%iepdbdir%^`pwd`/java^g;" \
301                 -e "s^%PKIPREFIX%^../test/test-^g;" < \
302                 stratcon.conf.in > \
303                 test-stratcon.conf
304
305 stratcon.conf:  stratcon.conf.in Makefile
306         @sed -e "s^%sysconfdir%^$(sysconfdir)^g;" \
307                 -e "s^%modulesdir%^$(MODULES_DIR)^g;" \
308                 -e "s^%modulesluadir%^$(MODULES_DIR)^g;" \
309                 -e "s^%iepbindir%^$(bindir)^g;" \
310                 -e "s^%iepdbdir%^$(localstatedir)/db/noit-iep^g;" \
311                 -e "s^%PKIPREFIX%^$${PKIPREFIX}^g;" < \
312                 stratcon.conf.in > \
313                 stratcon.conf
314
315 install-dirs:
316         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(bindir)
317         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(sbindir)
318         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(sysconfdir)
319
320 install-noitd-headers:  $(NOIT_HEADERS) install-headers
321         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
322         for file in $(NOIT_HEADERS) ; do \
323                 $(INSTALL) -m 0644 $$file $(DESTDIR)$(includedir)/$$file ; \
324         done
325
326 install-stratcond-headers:      $(STRATCON_HEADERS) install-headers
327         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
328         for file in $(STRATCON_HEADERS) ; do \
329                 $(INSTALL) -m 0644 $$file $(DESTDIR)$(includedir)/$$file ; \
330         done
331
332 install-headers:        $(HEADERS)
333         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(bindir)
334         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
335         $(INSTALL) -m 0755 ../buildtools/xml2h $(DESTDIR)$(bindir)/noit-xml2h
336         $(INSTALL) -m 0755 scripts/noit-config $(DESTDIR)$(bindir)/noit-config
337         for file in $(HEADERS) ; do \
338                 $(INSTALL) -m 0644 $$file $(DESTDIR)$(includedir)/$$file ; \
339         done
340
341 noitlibs:       $(LIBNOIT_V) @MDB_MODS@
342
343 install-libs:    noitlibs
344         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(libdir)
345         $(INSTALL) -m 0755 $(LIBNOIT_V) $(DESTDIR)$(libdir)/$(LIBNOIT_V)
346         ln -sf $(LIBNOIT_V) $(DESTDIR)$(libdir)/$(LIBNOIT)
347
348 install-noitd:  install-libs install-noitd-nolibs
349
350 install-noitd-nolibs:   install-dirs reversion noitd noit.conf java-bits noit.env
351         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(datadir)/noit-web
352         $(INSTALL) -m 0755 scripts/noittrap $(DESTDIR)$(bindir)/noittrap
353         $(INSTALL) -m 0755 noitd $(DESTDIR)$(sbindir)/noitd
354         $(INSTALL) -m 0644 noit.conf $(DESTDIR)$(sysconfdir)/noit.conf.sample
355         $(INSTALL) -m 0644 noit.env $(DESTDIR)$(sysconfdir)/noit.env
356         $(INSTALL) -m 0644 config_templates.conf $(DESTDIR)$(sysconfdir)/config_templates.conf
357         $(INSTALL) -m 0644 default-ca-chain.crt $(DESTDIR)$(sysconfdir)/default-ca-chain.crt
358         (cd modules && $(MAKE) install-modules DESTDIR=$(DESTDIR))
359         (cd modules-lua && $(MAKE) install DESTDIR=$(DESTDIR))
360         (cd noit-web && tar cf - .) | (cd $(DESTDIR)$(datadir)/noit-web && tar xf -)
361         -test -n "@JAVAPARTS@" && (cd @JAVAPARTS@ && $(MAKE) install-jezebel DESTDIR=$(DESTDIR))
362
363 install-stratcond:      install-libs install-stratcond-nolibs
364
365 install-stratcond-nolibs:       install-dirs reversion stratcond stratcon.conf java-bits noit.env
366         $(INSTALL) -m 0755 stratcond $(DESTDIR)$(sbindir)/stratcond
367         $(INSTALL) -m 0644 stratcon.conf $(DESTDIR)$(sysconfdir)/stratcon.conf.sample
368         $(INSTALL) -m 0644 noit.env $(DESTDIR)$(sysconfdir)/stratcon.env
369         (cd modules && $(MAKE) install-smodules DESTDIR=$(DESTDIR))
370         -test -n "@JAVAPARTS@" && (cd @JAVAPARTS@ && $(MAKE) install-iep DESTDIR=$(DESTDIR))
371
372 install-docs:
373         (cd man && $(MAKE) install DESTDIR=$(DESTDIR))
374
375 install:        install-dirs install-docs install-headers install-noitd install-stratcond install-noitd-headers install-stratcond-headers
376
377 clean:
378         rm -f *.lo *.o $(TARGETS)
379         rm -f $(LIBNOIT)
380         rm -f module-online.h noit.env
381         rm -rf noit-objs stratcon-objs libnoit-objs
382         rm -rf mdb-support/*.lo mdb-support/*.so
383         (cd man && $(MAKE) clean)
384         (cd modules && $(MAKE) clean)
385         (cd java && $(MAKE) clean)
386
387 Makefile.noit.dep:
388         find noit-objs -name \*.o | sort | awk '{gsub("^.+-objs/", ""); print "noit-objs/"$$1": "$$1;}' > $@
389
390 Makefile.stratcon.dep:
391         find stratcon-objs -name \*.o | sort | awk '{gsub("^.+-objs/", ""); print "stratcon-objs/"$$1": "$$1;}' > $@
392
393 Makefile.dep:
394         $(CC) -I. $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) *.c > Makefile.dep
395         $(top_srcdir)/buildtools/culldeps.sh Makefile.dep
396
397 include Makefile.dep
398 include Makefile.noit.dep
399 include Makefile.stratcon.dep
400
401 distclean-subdirs:
402         for dir in man modules modules-lua java ; do \
403                 (cd $$dir && $(MAKE) distclean) ; \
404         done
405
406 distclean:      clean distclean-subdirs
407         rm -f Makefile noit_config.h scripts/noit-config
408
409 js/bundle.desc: bundle.proto
410         protoc -ojs/bundle.desc bundle.proto
411
412 bundle:
413         protoc bundle.proto --java_out=java
414         protoc-c bundle.proto --c_out=.
Note: See TracBrowser for help on using the browser.