root/src/Makefile.in

Revision e777c361cd646308f382dc6e94c33adc3d8efda0, 12.7 kB (checked in by GitHub <noreply@github.com>, 2 days ago)

Websockets and externalization of histogram code into libcircllhist (#278)

* WIP, livestreaming over websocket

* fix livestream mtev_log_stream_t leak

* move histogram impl out of reconnoiter tree into libcircllhist repo, tests for websockets

* whitespace cleanup

* fix comment

* output any websocket errors as json

* fix integer names

  • 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
82
83 MODDIR=modules
84
85 HEADERS=noit_metric.h noit_check_log_helpers.h noit_check_tools_shared.h noit_metric_rollup.h
86
87 NOIT_HEADERS=noit_check.h noit_check_resolver.h \
88         noit_check_rest.h noit_check_tools.h \
89         noit_conf_checks.h \
90         noit_filters.h noit_jlog_listener.h noit_livestream_listener.h \
91         noit_websocket_handler.h noit_module.h noit_metric_director.h \
92         noit_metric.h noit_message_decoder.h
93
94 STRATCON_HEADERS=stratcon_datastore.h stratcon_iep.h stratcon_ingest.h \
95         stratcon_jlog_streamer.h 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 noit_metric_rollup.lo
102
103 NOIT_OBJS=noitd.o noit_mtev_bridge.o \
104         noit_check_resolver.o noit_metric_director.o noit_message_decoder.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 noit_websocket_handler.o \
109         noit_metric.o \
110         $(LIBNOIT_OBJS:%.lo=%.o)
111
112 STRATCON_OBJS=stratcond.o noit_mtev_bridge.o \
113         stratcon_realtime_http.o \
114         stratcon_jlog_streamer.o stratcon_datastore.o \
115         stratcon_iep.o \
116         $(LIBNOIT_OBJS:%.lo=%.o)
117
118 FINAL_STRATCON_OBJS=$(STRATCON_OBJS:%.o=stratcon-objs/%.o)
119 FINAL_NOIT_OBJS=$(NOIT_OBJS:%.o=noit-objs/%.o)
120 FINAL_LIBNOIT_OBJS=$(LIBNOIT_OBJS:%.lo=libnoit-objs/%.lo)
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) $(CTFNOSTRIP) -i -l @VERSION@ $@ ; \
129         fi
130
131 libnoit-objs/%.lo:      %.lo
132         @mkdir -p "`dirname $@`"
133         @echo "- making private $@"
134         @cp $(@:libnoit-objs/%.lo=%.lo) $@
135         @if test -x "$(CTFCONVERT)" ; then \
136                 echo "- making CTF ($@)" ; \
137                 $(CTFCONVERT) $(CTFNOSTRIP) -i -l @VERSION@ $@ ; \
138         fi
139
140 stratcon-objs/%.o:      %.o
141         @mkdir -p "`dirname $@`"
142         @echo "- making private $@"
143         @cp $(@:stratcon-objs/%.o=%.o) $@
144         @if test -x "$(CTFCONVERT)" ; then \
145                 echo "- making CTF ($@)" ; \
146                 $(CTFCONVERT) $(CTFNOSTRIP) -i -l @VERSION@ $@ ; \
147         fi
148
149 make-man:
150         @(cd man && $(MAKE) -s)
151
152 make-modules:
153         @for dir in $(MODDIR) ; do \
154                 (cd $$dir && $(MAKE) -s) ; \
155         done
156
157 java-bits:
158         @-test -n "@JAVAPARTS@" && (cd java && $(MAKE) -s)
159
160 .PHONY: reversion
161
162 reversion:
163         @$(top_srcdir)/buildtools/mkversion.sh noit_version.h
164
165 noit_version.h:
166         @$(top_srcdir)/buildtools/mkversion.sh noit_version.h
167
168 noit.env:       noit_version.h noit_config.h
169         awk '/^#define[         ]+NOIT_BRANCH/{print $$2"="$$3;}' < noit_version.h > $@
170         cat noit_version.h | tr '[".]' ' ' | awk '/^#define[    ]+NOIT_VERSION/{print $$2"=\""$$3"\""; print $$2"_TSTAMP=\""$$4"\"";}' >> $@
171         awk '/^#define[         ]+NOIT_UNAME_[^V]/{print "BUILD_"$$2"="$$3;}' < noit_config.h >> $@
172
173 man/noitd.usage.h:      make-man
174
175 man/stratcond.usage.h:  make-man
176
177
178 noitd.o:        man/noitd.usage.h
179 stratcond.o:    man/stratcond.usage.h
180
181 stratcon_jlog_streamer.o:       noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
182 noit_check_tools.o:     noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
183 noit_check.o:   noit_@DTRACEHDR@ stratcon_@DTRACEHDR@
184 dtrace_probes.h:        noit_@DTRACEHDR@ stratcon_@DTRACEHDR@ libnoit_@DTRACEHDR@
185
186 $(LIBNOIT):     $(LIBNOIT_V)
187         ln -sf $(LIBNOIT_V) $(LIBNOIT)
188
189 $(LIBNOIT_V):   $(FINAL_LIBNOIT_OBJS)
190         @echo "- linking $@"
191         $(SHLD) $(SHLDFLAGS) -o $@ @LD_LIBNOIT_VERSION@ $(FINAL_LIBNOIT_OBJS) $(LIBNOIT_LIBS) -L. -lmtev
192
193 stratcond_@DTRACEOBJ@:    $(FINAL_STRATCON_OBJS)
194         @echo "- assembling $@" && \
195         @DTRACE@ @DTRACEFLAGS@ -Z -G -s stratcon_dtrace_probes.d -o stratcond_@DTRACEOBJ@ $(FINAL_STRATCON_OBJS)
196
197 noitd_@DTRACEOBJ@:    $(FINAL_NOIT_OBJS)
198         @echo "- assembling $@" && \
199         @DTRACE@ @DTRACEFLAGS@ -Z -G -s noit_dtrace_probes.d -o noitd_@DTRACEOBJ@ $(FINAL_NOIT_OBJS)
200
201 noit_@DTRACEHDR@:    noit_dtrace_probes.d
202         @if test -z "@DTRACE@" ; then \
203                 echo "- faking dtrace header" ; \
204                 cp ./noit_@DTRACEHDR@.stock ./noit_@DTRACEHDR@ ; \
205         else \
206                 echo "- building dtrace header $@" ; \
207                 @DTRACE@ -h -s noit_dtrace_probes.d ; \
208         fi
209
210 stratcon_@DTRACEHDR@:    stratcon_dtrace_probes.d
211         @if test -z "@DTRACE@" ; then \
212                 echo "- faking dtrace header" ; \
213                 cp ./stratcon_@DTRACEHDR@.stock ./stratcon_@DTRACEHDR@ ; \
214         else \
215                 echo "- building dtrace header $@" ; \
216                 @DTRACE@ -h -s stratcon_dtrace_probes.d ; \
217         fi
218
219 noitd:  $(FINAL_NOIT_OBJS) man/noitd.usage.h $(NOITD_DTRACEOBJ)
220         @echo "- linking $@"
221         @$(CC) $(CLINKFLAGS) -o $@ $(FINAL_NOIT_OBJS) \
222                 $(NOITD_DTRACEOBJ) \
223                 $(LDFLAGS) \
224                 $(MAPFLAGS) \
225                 $(LIBS) -L. -lmtev $(LUALIBS) -ljlog
226         @if test -x "$(CTFMERGE)" ; then \
227                 $(CTFMERGE) $(CTFNOSTRIP) -l @VERSION@ -o $@ $(FINAL_NOIT_OBJS) $(NOITD_DTRACEOBJ) ; \
228         fi
229
230 stratcond:      $(FINAL_STRATCON_OBJS) $(STRATCOND_DTRACEOBJ)
231         @echo "- linking $@"
232         $(CC) $(CLINKFLAGS) -o $@ $(FINAL_STRATCON_OBJS) \
233                 $(STRATCOND_DTRACEOBJ) \
234                 $(LDFLAGS) \
235                 $(MAPFLAGS) \
236                 $(LIBS) -L. -lmtev
237         @if test -x "$(CTFMERGE)" ; then \
238                 $(CTFMERGE) $(CTFNOSTRIP) -l @VERSION@ -o $@ $(FINAL_STRATCON_OBJS) $(STRATCOND_DTRACEOBJ) ; \
239         fi
240
241 mdb-support/mdb_help.lo:        mdb-support/mdb_help.c
242         @echo "- compiling $@"
243         @$(CC) -Imdb-support $(CPPFLAGS) $(SHCFLAGS) $(CFLAGS) -o $@ -c $<
244
245 SHAREDMDBMODSRC=
246
247 stratcon_datastore.o:   stratcon_datastore.c
248         @echo "- compiling $<"
249         @$(CC) $(CPPFLAGS) $(PGCFLAGS) $(CFLAGS) -c $<
250
251 .c.lo:
252         $(Q)if [ "`dirname $@`" != "." ] ; then \
253                 (cd "`dirname $@`" && $(MAKE) "`basename $@`") ; \
254         else \
255                 echo "- compiling $<" ; \
256           $(CC) $(CPPFLAGS) $(SHCFLAGS) -c $< -o $@ ; \
257         fi
258
259 .c.o:
260         $(Q)if [ "`dirname $@`" != "." ] ; then \
261                 (cd "`dirname $@`" && $(MAKE) "`basename $@`") ; \
262         else \
263                 echo "- compiling $<" ; \
264                 $(CC) $(CPPFLAGS) $(CFLAGS) -c $< ; \
265         fi
266
267 noit_module.o:  module-online.h
268
269 module-online.h:        modules/module-online.xsl
270         @echo "- making module-online.h (StyleSheet include)"
271         @$(XML2H) helpStyleXML < modules/module-online.xsl > $@
272
273 test-noit.conf: noit.conf.in Makefile
274         @mkdir -p scratch/var/log scratch/var/run
275         @sed -e "s^%sysconfdir%^`pwd`^g;" \
276                 -e "s^%modulesdir%^`pwd`/modules^g;" \
277                 -e "s^%mtevmodulesdir%^$(MTEV_MODULES_DIR)^g;" \
278                 -e "s^%modulesluadir%^`pwd`/modules-lua^g;" \
279                 -e "s^%datarootdir%^`pwd`^g;" \
280                 -e "s^%PKIPREFIX%^../test/test-^g;" \
281                 -e "s^/var/^`pwd`/scratch/var/^g;" < \
282                 noit.conf.in > \
283                 test-noit.conf
284
285 noit.conf:      noit.conf.in Makefile
286         @sed -e "s^%sysconfdir%^$(sysconfdir)^g;" \
287                 -e "s^%modulesdir%^$(MODULES_DIR)^g;" \
288                 -e "s^%mtevmodulesdir%^$(MTEV_MODULES_DIR)^g;" \
289                 -e "s^%modulesluadir%^$(MODULES_DIR)^g;" \
290                 -e "s^%datarootdir%^$(datadir)^g;" \
291                 -e "s^%PKIPREFIX%^$${PKIPREFIX}^g;" \
292                 -e "s^/var/^`pwd`/scratch/var/^g;" < \
293                 noit.conf.in > \
294                 noit.conf
295
296 test-stratcon.conf:     stratcon.conf.in Makefile
297         @sed -e "s^%sysconfdir%^`pwd`^g;" \
298                 -e "s^%modulesdir%^`pwd`/modules^g;" \
299                 -e "s^%modulesluadir%^`pwd`/modules-lua^g;" \
300                 -e "s^%iepbindir%^`pwd`/java^g;" \
301                 -e "s^%iepdbdir%^`pwd`/java^g;" \
302                 -e "s^%PKIPREFIX%^../test/test-^g;" < \
303                 stratcon.conf.in > \
304                 test-stratcon.conf
305
306 stratcon.conf:  stratcon.conf.in Makefile
307         @sed -e "s^%sysconfdir%^$(sysconfdir)^g;" \
308                 -e "s^%modulesdir%^$(MODULES_DIR)^g;" \
309                 -e "s^%modulesluadir%^$(MODULES_DIR)^g;" \
310                 -e "s^%iepbindir%^$(bindir)^g;" \
311                 -e "s^%iepdbdir%^$(localstatedir)/db/noit-iep^g;" \
312                 -e "s^%PKIPREFIX%^$${PKIPREFIX}^g;" < \
313                 stratcon.conf.in > \
314                 stratcon.conf
315
316 install-dirs:
317         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(bindir)
318         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(sbindir)
319         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(sysconfdir)
320
321 install-noitd-headers:  $(NOIT_HEADERS) install-headers
322         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
323         for file in $(NOIT_HEADERS) ; do \
324                 $(INSTALL) -m 0644 $$file $(DESTDIR)$(includedir)/$$file ; \
325         done
326
327 install-stratcond-headers:      $(STRATCON_HEADERS) install-headers
328         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
329         for file in $(STRATCON_HEADERS) ; do \
330                 $(INSTALL) -m 0644 $$file $(DESTDIR)$(includedir)/$$file ; \
331         done
332
333 install-headers:        $(HEADERS)
334         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(bindir)
335         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(includedir)
336         $(INSTALL) -m 0755 ../buildtools/xml2h $(DESTDIR)$(bindir)/noit-xml2h
337         $(INSTALL) -m 0755 scripts/noit-config $(DESTDIR)$(bindir)/noit-config
338         for file in $(HEADERS) ; do \
339                 $(INSTALL) -m 0644 $$file $(DESTDIR)$(includedir)/$$file ; \
340         done
341
342 noitlibs:       $(LIBNOIT_V) @MDB_MODS@
343
344 install-libs:    noitlibs
345         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(libdir)
346         $(INSTALL) -m 0755 $(LIBNOIT_V) $(DESTDIR)$(libdir)/$(LIBNOIT_V)
347         ln -sf $(LIBNOIT_V) $(DESTDIR)$(libdir)/$(LIBNOIT)
348
349 install-noitd:  install-libs install-noitd-nolibs
350
351 install-noitd-nolibs:   install-dirs reversion noitd noit.conf java-bits noit.env
352         $(top_srcdir)/buildtools/mkinstalldirs $(DESTDIR)$(datadir)/noit-web
353         $(INSTALL) -m 0755 scripts/noittrap $(DESTDIR)$(bindir)/noittrap
354         $(INSTALL) -m 0755 noitd $(DESTDIR)$(sbindir)/noitd
355         $(INSTALL) -m 0644 noit.conf $(DESTDIR)$(sysconfdir)/noit.conf.sample
356         $(INSTALL) -m 0644 noit.env $(DESTDIR)$(sysconfdir)/noit.env
357         $(INSTALL) -m 0644 config_templates.conf $(DESTDIR)$(sysconfdir)/config_templates.conf
358         $(INSTALL) -m 0644 default-ca-chain.crt $(DESTDIR)$(sysconfdir)/default-ca-chain.crt
359         (cd modules && $(MAKE) install-modules DESTDIR=$(DESTDIR))
360         (cd modules-lua && $(MAKE) install DESTDIR=$(DESTDIR))
361         (cd noit-web && tar cf - .) | (cd $(DESTDIR)$(datadir)/noit-web && tar xf -)
362         -test -n "@JAVAPARTS@" && (cd @JAVAPARTS@ && $(MAKE) install-jezebel DESTDIR=$(DESTDIR))
363
364 install-stratcond:      install-libs install-stratcond-nolibs
365
366 install-stratcond-nolibs:       install-dirs reversion stratcond stratcon.conf java-bits noit.env
367         $(INSTALL) -m 0755 stratcond $(DESTDIR)$(sbindir)/stratcond
368         $(INSTALL) -m 0644 stratcon.conf $(DESTDIR)$(sysconfdir)/stratcon.conf.sample
369         $(INSTALL) -m 0644 noit.env $(DESTDIR)$(sysconfdir)/stratcon.env
370         (cd modules && $(MAKE) install-smodules DESTDIR=$(DESTDIR))
371         -test -n "@JAVAPARTS@" && (cd @JAVAPARTS@ && $(MAKE) install-iep DESTDIR=$(DESTDIR))
372
373 install-docs:
374         (cd man && $(MAKE) install DESTDIR=$(DESTDIR))
375
376 install:        install-dirs install-docs install-headers install-noitd install-stratcond install-noitd-headers install-stratcond-headers
377
378 clean:
379         rm -f *.lo *.o $(TARGETS)
380         rm -f $(LIBNOIT)
381         rm -f module-online.h noit.env
382         rm -rf noit-objs stratcon-objs libnoit-objs
383         rm -rf mdb-support/*.lo mdb-support/*.so
384         (cd man && $(MAKE) clean)
385         (cd modules && $(MAKE) clean)
386         (cd java && $(MAKE) clean)
387
388 Makefile.noit.dep:
389         find noit-objs -name \*.o | sort | awk '{gsub("^.+-objs/", ""); print "noit-objs/"$$1": "$$1;}' > $@
390
391 Makefile.stratcon.dep:
392         find stratcon-objs -name \*.o | sort | awk '{gsub("^.+-objs/", ""); print "stratcon-objs/"$$1": "$$1;}' > $@
393
394 Makefile.dep:
395         $(CC) -I. $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) *.c > Makefile.dep
396         $(top_srcdir)/buildtools/culldeps.sh Makefile.dep
397
398 include Makefile.dep
399 include Makefile.noit.dep
400 include Makefile.stratcon.dep
401
402 distclean-subdirs:
403         for dir in man modules modules-lua java ; do \
404                 (cd $$dir && $(MAKE) distclean) ; \
405         done
406
407 distclean:      clean distclean-subdirs
408         rm -f Makefile noit_config.h scripts/noit-config
409
410 js/bundle.desc: bundle.proto
411         protoc -ojs/bundle.desc bundle.proto
412
413 bundle:
414         protoc bundle.proto --java_out=java
415         protoc-c bundle.proto --c_out=.
Note: See TracBrowser for help on using the browser.