Fixed site ids in new integration tests
[check_mk.git] / Makefile
blob5f62bb9eda7bd365906b0fe264102f2bcfe6e3be
1 # +------------------------------------------------------------------+
2 # | ____ _ _ __ __ _ __ |
3 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
4 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
5 # | | |___| | | | __/ (__| < | | | | . \ |
6 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
7 # | |
8 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
9 # +------------------------------------------------------------------+
11 # This file is part of Check_MK.
12 # The official homepage is at http://mathias-kettner.de/check_mk.
14 # check_mk is free software; you can redistribute it and/or modify it
15 # under the terms of the GNU General Public License as published by
16 # the Free Software Foundation in version 2. check_mk is distributed
17 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
18 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
20 # tails. You should have received a copy of the GNU General Public
21 # License along with GNU Make; see the file COPYING. If not, write
22 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 # Boston, MA 02110-1301 USA.
26 include defines.make
28 NAME := check_mk
29 PREFIX := /usr
30 BINDIR := $(PREFIX)/bin
31 CONFDIR := /etc/$(NAME)
32 LIBDIR := $(PREFIX)/lib/$(NAME)
33 DISTNAME := $(NAME)-$(VERSION)
34 DIST_ARCHIVE := check-mk-$(EDITION)-$(OMD_VERSION).tar.gz
35 TAROPTS := --owner=root --group=root --exclude=.svn --exclude=*~ \
36 --exclude=.gitignore --exclude=*.swp --exclude=.f12
37 # We could add clang's -Wshorten-64-to-32 and g++'c/clang's -Wsign-conversion here.
38 CXX_FLAGS := -g -O3 -Wall -Wextra
39 CLANG_VERSION := 7
40 CLANG_FORMAT := clang-format-$(CLANG_VERSION)
41 SCAN_BUILD := scan-build-$(CLANG_VERSION)
42 export CPPCHECK := cppcheck
43 export DOXYGEN := doxygen
44 export IWYU_TOOL := iwyu_tool
45 PIPENV := PIPENV_NO_INHERIT=true PIPENV_VENV_IN_PROJECT=true pipenv
47 # The Bear versions have a slightly tragic history: Due to the clang bug
48 # https://llvm.org/bugs/show_bug.cgi?id=24710 we need absolute paths in our
49 # compilation database. Furthermore, gcc and clang have slightly different
50 # behavior regarding include paths when the -I flag contains a relative path and
51 # symlinks are involved, so this is yet another reason to use absolute paths.
53 # Consequently, we upstreamed a fix for this to the Bear project, see
54 # https://github.com/rizsotto/Bear/commit/fb1645de9. This fix lived happily in
55 # the Bear releases 2.1.4, 2.1.5, and 2.2.0, but after that, some "improvements"
56 # broke the fix again. :-/ Until a new fix has been upstreamed, make sure that
57 # that you use the right Bear.
59 # To install a working version locally, just do:
60 # git clone https://github.com/rizsotto/Bear.git && cd Bear && git checkout 2.2.0 && cmake -DCMAKE_INSTALL_PREFIX=$HOME/local/Bear-2.2.0 && make install
61 # and put $HOME/local/Bear-2.2.0/bin into your PATH or set the make variable
62 # below accordingly.
63 export BEAR := bear
65 M4_DEPS := $(wildcard m4/*) configure.ac
66 CONFIGURE_DEPS := $(M4_DEPS) aclocal.m4
67 CONFIG_DEPS := ar-lib compile config.guess config.sub install-sh missing depcomp configure
68 DIST_DEPS := $(CONFIG_DEPS) \
69 omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe \
70 omd/packages/openhardwaremonitor/OpenHardwareMonitorLib.dll
73 LIVESTATUS_SOURCES := Makefile.am api/c++/{Makefile,*.{h,cc}} api/perl/* \
74 api/python/{README,*.py} {nagios,nagios4}/{README,*.h} \
75 src/{Makefile.am,*.{cc,h}} standalone/config_files.m4
77 FILES_TO_FORMAT_WINDOWS := \
78 $(wildcard $(addprefix agents/,*.cc *.c *.h)) \
79 $(wildcard $(addprefix agents/windows/,*.cc *.h)) \
80 $(wildcard $(addprefix agents/windows/sections/,*.cc *.h)) \
81 $(wildcard $(addprefix agents/windows/test/,*.cc *.h)) \
82 $(wildcard $(addprefix agents/windows/test/sections,*.cc *.h)) \
84 FILES_TO_FORMAT_LINUX := \
85 $(wildcard $(addprefix livestatus/api/c++/,*.cc *.h)) \
86 $(wildcard $(addprefix livestatus/src/,*.cc *.h)) \
87 $(wildcard $(addprefix livestatus/src/test/,*.cc *.h)) \
88 $(wildcard $(addprefix bin/,*.cc *.c *.h)) \
89 $(wildcard $(addprefix enterprise/core/src/,*.cc *.h)) \
90 $(wildcard $(addprefix enterprise/core/src/checkhelper/,*.cc *.h)) \
91 $(wildcard $(addprefix enterprise/core/src/test/,*.cc *.h))
93 WERKS := $(wildcard .werks/[0-9]*)
95 JAVASCRIPT_SOURCES := $(filter-out %_min.js,$(wildcard $(addsuffix /web/htdocs/js/*.js,. enterprise managed))) $(wildcard web/htdocs/js/modules/*.js)
97 PNG_FILES := $(wildcard $(addsuffix /*.png,web/htdocs/images web/htdocs/images/icons enterprise/web/htdocs/images enterprise/web/htdocs/images/icons managed/web/htdocs/images managed/web/htdocs/images/icons))
99 RRDTOOL_VERS := $(shell egrep -h "RRDTOOL_VERS\s:=\s" omd/packages/rrdtool/rrdtool.make | sed 's/RRDTOOL_VERS\s:=\s//')
101 .PHONY: all analyze build check check-binaries check-permissions check-version \
102 clean compile-neb-cmc cppcheck dist documentation format format-c \
103 format-windows format-linux format-python GTAGS headers help install \
104 iwyu mrproper optimize-images packages setup setversion tidy version \
105 am--refresh skel
107 help:
108 @echo "setup --> Prepare system for development and building"
109 @echo "make dist --> Create source tgz for later building of rpm/deb and livestatus tgz"
110 @echo "make rpm --> Create rpm package"
111 @echo "make deb --> Create deb package"
112 @echo "make cma --> Create cma package"
113 @echo "make version --> Switch to new version"
115 rpm:
116 $(MAKE) -C omd rpm
118 deb:
119 $(MAKE) -C omd deb
121 cma:
122 $(MAKE) -C omd cma
124 check: check-permissions check-binaries check-version
126 check-permissions:
127 @echo -n "Checking permissions... with find -not -perm -444..." && [ -z "$$(find -not -perm -444)" ] && echo OK
129 check-binaries:
130 @if [ -z "$(SKIP_SANITY_CHECKS)" ]; then \
131 echo -n "Checking precompiled binaries..." && file agents/waitmax | grep 32-bit >/dev/null && echo OK ; \
134 check-version:
135 @sed -n 1p ChangeLog | fgrep -qx '$(VERSION):' || { \
136 echo "Version $(VERSION) not listed at top of ChangeLog!" ; \
137 false ; }
139 # Is executed by our build environment from a "git archive" snapshot and during
140 # RPM building to create the source tar.gz for the RPM build process.
141 # Would use --exclude-vcs-ignores but that's available from tar 1.29 which
142 # is currently not used by most distros
143 # Would also use --exclude-vcs, but this is also not available
144 # And --transform is also missing ...
145 dist: $(DISTNAME).tar.gz config.h.in $(DIST_DEPS)
146 ifeq ($(ENTERPRISE),yes)
147 $(MAKE) -C enterprise agents/plugins/cmk-update-agent
148 $(MAKE) -C enterprise agents/plugins/cmk-update-agent-32
149 $(MAKE) -C enterprise agents/windows/plugins/cmk-update-agent.exe
150 endif
151 set -e -o pipefail ; EXCLUDES= ; \
152 if [ -d .git ]; then \
153 git rev-parse --short HEAD > COMMIT ; \
154 for X in $$(git ls-files --directory --others -i --exclude-standard) ; do \
155 if [[ $$X != aclocal.m4 && $$X != config.h.in && ! "$(DIST_DEPS)" =~ (^|[[:space:]])$$X($$|[[:space:]]) && $$X != $(DISTNAME).tar.gz && $$X != omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz && $$X != livestatus/* && $$X != enterprise/* ]]; then \
156 EXCLUDES+=" --exclude $${X%*/}" ; \
157 fi ; \
158 done ; \
159 else \
160 for F in $(DIST_ARCHIVE) enterprise/agents/plugins/{build,build-32,src} agents/windows/{build64,build} enterprise/agents/winbuild; do \
161 EXCLUDES+=" --exclude $$F" ; \
162 done ; \
163 fi ; \
164 if [ -d check-mk-$(EDITION)-$(OMD_VERSION) ]; then \
165 rm -rf check-mk-$(EDITION)-$(OMD_VERSION) ; \
166 fi ; \
167 mkdir check-mk-$(EDITION)-$(OMD_VERSION) ; \
168 tar -c --wildcards \
169 $(TAROPTS) \
170 --exclude check-mk-$(EDITION)-$(OMD_VERSION) \
171 --exclude .git \
172 --exclude .gitignore \
173 --exclude .gitmodules \
174 --exclude .gitattributes \
175 $$EXCLUDES \
176 * .werks .clang* | tar x -C check-mk-$(EDITION)-$(OMD_VERSION)
177 if [ -f COMMIT ]; then \
178 rm COMMIT ; \
180 tar -cz --wildcards -f $(DIST_ARCHIVE) \
181 $(TAROPTS) \
182 check-mk-$(EDITION)-$(OMD_VERSION)
183 rm -rf check-mk-$(EDITION)-$(OMD_VERSION)
185 # This tar file is only used by "omd/packages/check_mk/Makefile"
186 $(DISTNAME).tar.gz: .venv omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz .werks/werks web/htdocs/js/main_min.js web/htdocs/js/mobile_min.js web/htdocs/js/side_min.js web/htdocs/themes/facelift/theme.css ChangeLog web/htdocs/themes/classic/theme.css
187 @echo "Making $(DISTNAME)"
188 rm -rf $(DISTNAME)
189 mkdir -p $(DISTNAME)
190 $(MAKE) -C agents build
191 tar cf $(DISTNAME)/bin.tar $(TAROPTS) -C bin $$(cd bin ; ls)
192 tar rf $(DISTNAME)/bin.tar $(TAROPTS) -C agents/windows/msibuild msi-update
193 tar rf $(DISTNAME)/bin.tar $(TAROPTS) -C agents/windows/msibuild msi-update-legacy
194 gzip $(DISTNAME)/bin.tar
195 $(PIPENV) run python -m compileall cmk ; \
196 tar czf $(DISTNAME)/lib.tar.gz $(TAROPTS) \
197 --exclude "cee" \
198 --exclude "cee.py*" \
199 --exclude "cme" \
200 --exclude "cme.py*" \
201 cmk/* ; \
202 rm cmk/*.pyc
203 $(PIPENV) run python -m compileall cmk_base ; \
204 tar czf $(DISTNAME)/base.tar.gz \
205 $(TAROPTS) \
206 --exclude "cee" \
207 --exclude "cee.py*" \
208 --exclude "cme" \
209 --exclude "cme.py*" \
210 cmk_base/* ; \
211 rm cmk_base/*.pyc
212 tar czf $(DISTNAME)/werks.tar.gz $(TAROPTS) -C .werks werks
213 tar czf $(DISTNAME)/checks.tar.gz $(TAROPTS) -C checks $$(cd checks ; ls)
214 tar czf $(DISTNAME)/active_checks.tar.gz $(TAROPTS) -C active_checks $$(cd active_checks ; ls)
215 tar czf $(DISTNAME)/notifications.tar.gz $(TAROPTS) -C notifications $$(cd notifications ; ls)
216 tar czf $(DISTNAME)/inventory.tar.gz $(TAROPTS) -C inventory $$(cd inventory ; ls)
217 tar czf $(DISTNAME)/checkman.tar.gz $(TAROPTS) -C checkman $$(cd checkman ; ls)
218 tar czf $(DISTNAME)/web.tar.gz $(TAROPTS) -C web htdocs app
220 tar xzf omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz
221 tar czf $(DISTNAME)/livestatus.tar.gz $(TAROPTS) -C mk-livestatus-$(VERSION) $$(cd mk-livestatus-$(VERSION) ; ls -A )
222 rm -rf mk-livestatus-$(VERSION)
224 tar czf $(DISTNAME)/pnp-templates.tar.gz $(TAROPTS) -C pnp-templates $$(cd pnp-templates ; ls *.php)
225 tar cf $(DISTNAME)/doc.tar $(TAROPTS) -C doc $$(cd doc ; ls)
226 tar rf $(DISTNAME)/doc.tar $(TAROPTS) COPYING AUTHORS ChangeLog
227 tar rf $(DISTNAME)/doc.tar $(TAROPTS) livestatus/api --exclude "*~" --exclude "*.pyc" --exclude ".gitignore" --exclude .f12
228 gzip $(DISTNAME)/doc.tar
230 cd agents ; tar czf ../$(DISTNAME)/agents.tar.gz $(TAROPTS) \
231 --exclude check_mk_agent.spec \
232 --exclude special/lib \
233 cfg_examples \
234 plugins \
235 sap \
236 special \
237 z_os \
238 check-mk-agent_*.deb \
239 check-mk-agent-*.rpm \
240 check_mk_agent.* \
241 check_mk_caching_agent.linux \
242 CONTENTS \
243 mk-job* \
244 waitmax \
245 windows/cfg_examples \
246 windows/check_mk_agent*.{exe,msi} \
247 windows/check_mk.example.ini \
248 windows/CONTENTS \
249 windows/mrpe \
250 windows/plugins
251 cd $(DISTNAME) ; ../scripts/make_package_info $(VERSION) > package_info
252 install -m 755 scripts/*.{sh,py} $(DISTNAME)
253 install -m 644 COPYING AUTHORS ChangeLog standalone.make $(DISTNAME)
254 echo "$(VERSION)" > $(DISTNAME)/VERSION
255 tar czf $(DISTNAME).tar.gz $(TAROPTS) $(DISTNAME)
256 rm -rf $(DISTNAME)
258 @echo "=============================================================================="
259 @echo " FINISHED. "
260 @echo "=============================================================================="
262 omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe:
263 $(MAKE) -C omd openhardwaremonitor-dist
265 omd/packages/openhardwaremonitor/OpenHardwareMonitorLib.dll: omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe
267 .werks/werks: .venv $(WERKS)
268 PYTHONPATH=${PYTHONPATH}:$(REPO_PATH) $(PIPENV) run scripts/precompile-werks.py .werks .werks/werks cre
270 ChangeLog: .venv .werks/werks
271 PYTHONPATH=${PYTHONPATH}:$(REPO_PATH) $(PIPENV) run scripts/create-changelog.py ChangeLog .werks/werks
273 packages:
274 $(MAKE) -C agents packages
276 # NOTE: Old tar versions (e.g. on CentOS 5) don't have the --transform option,
277 # so we do things in a slightly complicated way.
278 omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz:
279 rm -rf mk-livestatus-$(VERSION)
280 mkdir -p mk-livestatus-$(VERSION)
281 tar cf - $(TAROPTS) -C livestatus $$(cd livestatus ; echo $(LIVESTATUS_SOURCES) ) | tar xf - -C mk-livestatus-$(VERSION)
282 cp -a configure.ac m4 mk-livestatus-$(VERSION)
283 cd mk-livestatus-$(VERSION) && autoreconf --install --include=m4 && rm -rf autom4te.cache
284 tar czf omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz $(TAROPTS) mk-livestatus-$(VERSION)
285 rm -rf mk-livestatus-$(VERSION)
287 version:
288 [ "$$(head -c 6 /etc/issue)" = "Ubuntu" \
289 -o "$$(head -c 16 /etc/issue)" = "Debian GNU/Linux" ] \
290 || { echo 'You are not on the reference system!' ; exit 1; }
291 @newversion=$$(dialog --stdout --inputbox "New Version:" 0 0 "$(VERSION)") ; \
292 if [ -n "$$newversion" ] ; then $(MAKE) NEW_VERSION=$$newversion setversion ; fi
294 setversion:
295 $(MAKE) -C omd NEW_VERSION=$(NEW_VERSION) setversion
296 sed -ri 's/^(VERSION[[:space:]]*:?= *).*/\1'"$(NEW_VERSION)/" defines.make ; \
297 sed -i 's/^AC_INIT.*/AC_INIT([MK Livestatus], ['"$(NEW_VERSION)"'], [mk@mathias-kettner.de])/' configure.ac ; \
298 sed -i 's/^VERSION=".*/VERSION="$(NEW_VERSION)"/' bin/mkbackup ; \
299 sed -i 's/^__version__ = ".*"$$/__version__ = "$(NEW_VERSION)"/' cmk/__init__.py bin/mkbench bin/livedump; \
300 sed -i 's/^VERSION=.*/VERSION='"$(NEW_VERSION)"'/' scripts/setup.sh ; \
301 $(MAKE) -C agents NEW_VERSION=$(NEW_VERSION) setversion
302 $(MAKE) -C docker NEW_VERSION=$(NEW_VERSION) setversion
303 ifeq ($(ENTERPRISE),yes)
304 $(MAKE) -C enterprise NEW_VERSION=$(NEW_VERSION) setversion
305 endif
307 headers:
308 doc/helpers/headrify
310 optimize-images:
311 @if type pngcrush >/dev/null 2>&1; then \
312 for F in $(PNG_FILES); do \
313 echo "Optimizing $$F..." ; \
314 pngcrush -q -rem alla -brute $$F $$F.opt ; \
315 mv $$F.opt $$F; \
316 done ; \
317 else \
318 echo "Missing pngcrush, not optimizing images! (run \"make setup\" to fix this)" ; \
321 # TODO: The --unsafe-perm was added because the CI executes this as root during
322 # tests and building versions. Once we have the then build system this should not
323 # be necessary anymore.
324 node_modules: package.json
325 npm install --unsafe-perm
327 web/htdocs/js/%_min.js: node_modules webpack.config.js $(JAVASCRIPT_SOURCES)
328 ENTERPRISE=$(ENTERPRISE) MANAGED=$(MANAGED) node_modules/.bin/webpack --mode=development
330 web/htdocs/themes/%/theme.css: node_modules webpack.config.js postcss.config.js web/htdocs/themes/%/theme.scss web/htdocs/themes/%/scss/*.scss
331 ENTERPRISE=$(ENTERPRISE) MANAGED=$(MANAGED) node_modules/.bin/webpack --mode=development
333 # TODO(sp) The target below is not correct, we should not e.g. remove any stuff
334 # which is needed to run configure, this should live in a separate target. In
335 # fact, we should really clean up all this cleaning-chaos and finally follow the
336 # GNU standards here (see "Standard Targets for Users",
337 # https://www.gnu.org/prep/standards/html_node/Standard-Targets.html).
338 clean:
339 make -C omd clean
340 rm -rf clang-analyzer dist.tmp rpm.topdir *.rpm *.deb *.exe \
341 omd/packages/mk-livestatus/mk-livestatus-*.tar.gz \
342 $(NAME)-*.tar.gz *~ counters autochecks \
343 precompiled cache web/htdocs/js/*_min.js \
344 web/htdocs/themes/*/theme.css \
345 .werks/werks \
346 ChangeLog
348 mrproper:
349 git clean -d --force -x --exclude='\.werks/.last' --exclude='\.werks/.my_ids'
351 setup:
352 sudo apt-get install \
353 aptitude \
354 autoconf \
355 bear \
356 build-essential \
357 clang-7 \
358 clang-format-7 \
359 clang-tidy-7 \
360 doxygen \
361 figlet \
362 g++ \
363 libboost-dev \
364 libboost-system-dev \
365 libclang-7-dev \
366 libpcap-dev \
367 librrd-dev \
368 llvm-7-dev \
369 libsasl2-dev \
370 pngcrush \
371 valgrind \
372 direnv \
373 python-pip \
374 chrpath \
375 enchant \
376 ksh \
377 p7zip-full
378 sudo -H pip install -U pipenv
379 $(MAKE) -C web setup
380 $(MAKE) -C omd setup
381 $(MAKE) -C omd openhardwaremonitor-setup
382 $(MAKE) -C docker setup
383 $(MAKE) -C locale setup
385 linesofcode:
386 @wc -l $$(find -type f -name "*.py" -o -name "*.js" -o -name "*.cc" -o -name "*.h" -o -name "*.css" | grep -v openhardwaremonitor | grep -v jquery | grep -v livestatus/src ) | sort -n
388 ar-lib compile config.guess config.sub install-sh missing depcomp: configure.ac
389 autoreconf --install --include=m4
390 touch ar-lib compile config.guess config.sub install-sh missing depcomp
392 # TODO(sp): We should really detect and use our own packages in a less hacky way...
393 config.status: $(CONFIG_DEPS)
394 @echo "Build $@ (newer targets: $?)"
395 @if test -f config.status; then \
396 echo "update config.status by reconfiguring in the same conditions" ; \
397 ./config.status --recheck; \
398 else \
399 if test -d ../boost/destdir ; then \
400 BOOST_OPT="--with-boost=$(abspath ../boost/destdir)" ; \
401 elif test -d omd/packages/boost/destdir ; then \
402 BOOST_OPT="--with-boost=$(abspath omd/packages/boost/destdir)" ; \
403 else \
404 BOOST_OPT="DUMMY1=" ; \
405 fi ; \
406 if test -d "omd/rrdtool-$(RRDTOOL_VERS)/src/.libs"; then \
407 RRD_OPT="LDFLAGS=-L$(realpath omd/rrdtool-$(RRDTOOL_VERS)/src/.libs)" ; \
408 else \
409 RRD_OPT="DUMMY2=" ; \
410 fi ; \
411 if test -d ../re2/destdir ; then \
412 RE2_OPT="--with-re2=$(abspath ../re2/destdir)" ; \
413 elif test -d omd/packages/re2/destdir ; then \
414 RE2_OPT="--with-re2=$(abspath omd/packages/re2/destdir)" ; \
415 else \
416 RE2_OPT="DUMMY3=" ; \
417 fi ; \
418 echo "configure CXXFLAGS=\"$(CXX_FLAGS)\" \"$$BOOST_OPT\" \"$$RRD_OPT\" \"$$RE2_OPT\"" ; \
419 ./configure CXXFLAGS="$(CXX_FLAGS)" "$$BOOST_OPT" "$$RRD_OPT" "$$RE2_OPT" ; \
422 configure: $(CONFIGURE_DEPS)
423 autoconf
425 aclocal.m4: $(M4_DEPS)
426 aclocal
428 config.h.in: $(CONFIGURE_DEPS)
429 autoheader
430 rm -f stamp-h1
431 touch $@
433 config.h: stamp-h1
434 @test -f $@ || rm -f stamp-h1
435 @test -f $@ || $(MAKE) stamp-h1
437 stamp-h1: config.h.in config.status
438 @rm -f stamp-h1
439 ./config.status config.h
441 GTAGS: config.h
442 # automake generates "gtags -i ...", but incremental updates seem to be a bit
443 # fragile, so let's start from scratch, gtags is quite fast.
444 $(RM) GTAGS GRTAGS GSYMS GPATH
445 # Note: Even if we descend into livestatus, gtags is run on the top level (next
446 # to configure.ac).
447 $(MAKE) -C livestatus GTAGS
449 compile-neb-cmc: config.status
450 $(MAKE) -C livestatus -j4
451 ifeq ($(ENTERPRISE),yes)
452 $(MAKE) -C enterprise/core -j4
453 endif
455 tidy: config.h
456 $(MAKE) -C livestatus/src tidy
457 ifeq ($(ENTERPRISE),yes)
458 $(MAKE) -C enterprise/core/src tidy
459 endif
461 iwyu: config.h
462 $(MAKE) -C livestatus/src iwyu
463 ifeq ($(ENTERPRISE),yes)
464 $(MAKE) -C enterprise/core/src iwyu
465 endif
467 # Not really perfect rules, but better than nothing
468 analyze: config.h
469 $(MAKE) -C livestatus clean
470 cd livestatus && $(SCAN_BUILD) -o ../clang-analyzer $(MAKE) CXXFLAGS="-std=c++17"
472 # GCC-like output on stderr intended for human consumption.
473 cppcheck: config.h
474 $(MAKE) -C livestatus/src cppcheck
475 ifeq ($(ENTERPRISE),yes)
476 $(MAKE) -C enterprise/core/src cppcheck
477 endif
479 # XML output into file intended for machine processing.
480 cppcheck-xml: config.h
481 $(MAKE) -C livestatus/src cppcheck-xml
482 ifeq ($(ENTERPRISE),yes)
483 $(MAKE) -C enterprise/core/src cppcheck-xml
484 endif
486 format: format-python format-c
488 # TODO: We should probably handle this rule via AM_EXTRA_RECURSIVE_TARGETS in
489 # src/configure.ac, but this needs at least automake-1.13, which in turn is only
490 # available from e.g. Ubuntu Saucy (13) onwards, so some magic is needed.
491 format-c: format-windows format-linux
493 format-windows:
494 $(CLANG_FORMAT) -style=file -i $(FILES_TO_FORMAT_WINDOWS)
496 format-linux:
497 $(CLANG_FORMAT) -style=file -i $(FILES_TO_FORMAT_LINUX)
499 format-python: .venv
500 # Explicitly specify --style [FILE] to prevent costly searching in parent directories
501 # for each file specified via command line
503 # Saw some mixed up lines on stdout after adding the --parallel option. Leaving it on
504 # for the moment to get the performance boost this option brings.
505 PYTHON_FILES=$${PYTHON_FILES-$$(tests/find-python-files)} ; \
506 $(PIPENV) run yapf --parallel --style .style.yapf --verbose -i $$PYTHON_FILES
508 # Note: You need the doxygen and graphviz packages.
509 documentation: config.h
510 $(MAKE) -C livestatus/src documentation
511 ifeq ($(ENTERPRISE),yes)
512 $(MAKE) -C enterprise/core/src documentation
513 endif
515 Pipfile.lock: Pipfile
516 $(PIPENV) lock
517 # TODO: Can be removed if pipenv fixes this issue.
518 # See: https://github.com/pypa/pipenv/issues/3140
519 # https://github.com/pypa/pipenv/issues/3026
520 # The recent pipenv version 2018.10.13 has a bug that places wrong markers in the
521 # Pipfile.lock. This leads to an error when installing packages with this
522 # markers and prints an error message. Example:
523 # Ignoring pyopenssl: markers 'extra == "security"' don't match your environment
524 sed -i "/\"markers\": \"extra == /d" Pipfile.lock
525 # TODO: pipenv and make don't really cooperate nicely: Locking alone already
526 # creates a virtual environment with setuptools/pip/wheel. This could lead to a
527 # wrong up-to-date status of it later, so let's remove it here. What we really
528 # want is a check if the contents of .venv match the contents of Pipfile.lock.
529 # We should do this via some move-if-change Kung Fu, but for now rm suffices.
530 rm -rf .venv
532 .venv: Pipfile.lock
533 # Remake .venv everytime Pipfile or Pipfile.lock are updated. Using the 'sync'
534 # mode installs the dependencies exactly as speciefied in the Pipfile.lock.
535 # This is extremely fast since the dependencies do not have to be resolved.
536 $(RM) -r .venv
537 $(PIPENV) sync --dev
538 touch .venv
540 # This dummy rule is called from subdirectories whenever one of the
541 # top-level Makefile's dependencies must be updated. It does not
542 # need to depend on %MAKEFILE% because GNU make will always make sure
543 # %MAKEFILE% is updated before considering the am--refresh target.
544 am--refresh: