Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / Makefile
blob2236f62115c40e215f3707243083fc2bc084c334
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 CLANG_TIDY := clang-tidy-$(CLANG_VERSION)
42 export RUN_CLANG_TIDY := run-clang-tidy-$(CLANG_VERSION).py
43 SCAN_BUILD := scan-build-$(CLANG_VERSION)
44 export CPPCHECK := cppcheck
45 export DOXYGEN := doxygen
46 export IWYU_TOOL := iwyu_tool
47 PIPENV := PIPENV_NO_INHERIT=true PIPENV_VENV_IN_PROJECT=true pipenv
49 # The Bear versions have a slightly tragic history: Due to the clang bug
50 # https://llvm.org/bugs/show_bug.cgi?id=24710 we need absolute paths in our
51 # compilation database. Furthermore, gcc and clang have slightly different
52 # behavior regarding include paths when the -I flag contains a relative path and
53 # symlinks are involved, so this is yet another reason to use absolute paths.
55 # Consequently, we upstreamed a fix for this to the Bear project, see
56 # https://github.com/rizsotto/Bear/commit/fb1645de9. This fix lived happily in
57 # the Bear releases 2.1.4, 2.1.5, and 2.2.0, but after that, some "improvements"
58 # broke the fix again. :-/ Until a new fix has been upstreamed, make sure that
59 # that you use the right Bear.
61 # To install a working version locally, just do:
62 # 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
63 # and put $HOME/local/Bear-2.2.0/bin into your PATH or set the make variable
64 # below accordingly.
65 export BEAR := bear
67 M4_DEPS := $(wildcard m4/*) configure.ac
68 CONFIGURE_DEPS := $(M4_DEPS) aclocal.m4
69 DIST_DEPS := ar-lib compile config.guess config.sub install-sh missing depcomp configure omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe omd/packages/openhardwaremonitor/OpenHardwareMonitorLib.dll
72 LIVESTATUS_SOURCES := Makefile.am api/c++/{Makefile,*.{h,cc}} api/perl/* \
73 api/python/{README,*.py} {nagios,nagios4}/{README,*.h} \
74 src/{Makefile.am,*.{cc,h}} standalone/config_files.m4
76 FILES_TO_FORMAT := $(wildcard $(addprefix agents/,*.cc *.c *.h)) \
77 $(wildcard $(addprefix agents/windows/,*.cc *.h)) \
78 $(wildcard $(addprefix agents/windows/sections/,*.cc *.h)) \
79 $(wildcard $(addprefix agents/windows/test/,*.cc *.h)) \
80 $(wildcard $(addprefix agents/windows/test/sections,*.cc *.h)) \
81 $(wildcard $(addprefix livestatus/api/c++/,*.cc *.h)) \
82 $(wildcard $(addprefix livestatus/src/,*.cc *.h)) \
83 $(wildcard $(addprefix bin/,*.cc *.c *.h)) \
84 $(wildcard $(addprefix enterprise/core/src/,*.cc *.h)) \
85 $(wildcard $(addprefix enterprise/core/src/checkhelper/,*.cc *.h)) \
86 $(wildcard $(addprefix enterprise/core/src/test/,*.cc *.h))
88 WERKS := $(wildcard .werks/[0-9]*)
90 JAVASCRIPT_SOURCES := $(filter-out %_min.js,$(wildcard $(addsuffix /web/htdocs/js/*.js,. enterprise managed))) $(wildcard web/htdocs/js/modules/*.js)
92 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))
95 .PHONY: all analyze build check check-binaries check-permissions \
96 check-version clean compile-neb-cmc cppcheck dist documentation format format-c format-python \
97 GTAGS headers help install iwyu mrproper \
98 optimize-images packages setup setversion tidy version \
99 am--refresh skel
101 help:
102 @echo "setup --> Prepare system for development and building"
103 @echo "make dist --> Create source tgz for later building of rpm/deb and livestatus tgz"
104 @echo "make rpm --> Create rpm package"
105 @echo "make deb --> Create deb package"
106 @echo "make cma --> Create cma package"
107 @echo "make version --> Switch to new version"
109 rpm:
110 $(MAKE) -C omd rpm
112 deb:
113 $(MAKE) -C omd deb
115 cma:
116 $(MAKE) -C omd cma
118 check: check-permissions check-binaries check-version
120 check-permissions:
121 @echo -n "Checking permissions... with find -not -perm -444..." && [ -z "$$(find -not -perm -444)" ] && echo OK
123 check-binaries:
124 @if [ -z "$(SKIP_SANITY_CHECKS)" ]; then \
125 echo -n "Checking precompiled binaries..." && file agents/waitmax | grep 32-bit >/dev/null && echo OK ; \
128 check-version:
129 @sed -n 1p ChangeLog | fgrep -qx '$(VERSION):' || { \
130 echo "Version $(VERSION) not listed at top of ChangeLog!" ; \
131 false ; }
133 # Is executed by our build environment from a "git archive" snapshot and during
134 # RPM building to create the source tar.gz for the RPM build process.
135 # Would use --exclude-vcs-ignores but that's available from tar 1.29 which
136 # is currently not used by most distros
137 # Would also use --exclude-vcs, but this is also not available
138 # And --transform is also missing ...
139 dist: $(DISTNAME).tar.gz config.h.in $(DIST_DEPS)
140 ifeq ($(ENTERPRISE),yes)
141 $(MAKE) -C enterprise agents/plugins/cmk-update-agent
142 $(MAKE) -C enterprise agents/plugins/cmk-update-agent-32
143 $(MAKE) -C enterprise agents/windows/plugins/cmk-update-agent.exe
144 endif
145 set -e -o pipefail ; EXCLUDES= ; \
146 if [ -d .git ]; then \
147 git rev-parse --short HEAD > COMMIT ; \
148 for X in $$(git ls-files --directory --others -i --exclude-standard) ; do \
149 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 \
150 EXCLUDES+=" --exclude $${X%*/}" ; \
151 fi ; \
152 done ; \
153 else \
154 for F in $(DIST_ARCHIVE) enterprise/agents/plugins/{build,build-32,src} agents/windows/{build64,build} enterprise/agents/winbuild; do \
155 EXCLUDES+=" --exclude $$F" ; \
156 done ; \
157 fi ; \
158 if [ -d check-mk-$(EDITION)-$(OMD_VERSION) ]; then \
159 rm -rf check-mk-$(EDITION)-$(OMD_VERSION) ; \
160 fi ; \
161 mkdir check-mk-$(EDITION)-$(OMD_VERSION) ; \
162 tar -c --wildcards \
163 $(TAROPTS) \
164 --exclude check-mk-$(EDITION)-$(OMD_VERSION) \
165 --exclude .git \
166 --exclude .gitignore \
167 --exclude .gitmodules \
168 --exclude .gitattributes \
169 $$EXCLUDES \
170 * .werks .clang* | tar x -C check-mk-$(EDITION)-$(OMD_VERSION)
171 if [ -f COMMIT ]; then \
172 rm COMMIT ; \
174 tar -cz --wildcards -f $(DIST_ARCHIVE) \
175 $(TAROPTS) \
176 check-mk-$(EDITION)-$(OMD_VERSION)
177 rm -rf check-mk-$(EDITION)-$(OMD_VERSION)
179 # This tar file is only used by "omd/packages/check_mk/Makefile"
180 $(DISTNAME).tar.gz: 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 ChangeLog
181 @echo "Making $(DISTNAME)"
182 rm -rf $(DISTNAME)
183 mkdir -p $(DISTNAME)
184 $(MAKE) -C agents build
185 tar cf $(DISTNAME)/bin.tar $(TAROPTS) -C bin $$(cd bin ; ls)
186 tar rf $(DISTNAME)/bin.tar $(TAROPTS) -C agents/windows/msibuild msi-update
187 gzip $(DISTNAME)/bin.tar
188 python -m compileall cmk ; \
189 tar czf $(DISTNAME)/lib.tar.gz $(TAROPTS) \
190 --exclude "cee" \
191 --exclude "cee.py*" \
192 --exclude "cme" \
193 --exclude "cme.py*" \
194 cmk/* ; \
195 rm cmk/*.pyc
196 python -m compileall cmk_base ; \
197 tar czf $(DISTNAME)/base.tar.gz \
198 $(TAROPTS) \
199 --exclude "cee" \
200 --exclude "cee.py*" \
201 --exclude "cme" \
202 --exclude "cme.py*" \
203 cmk_base/* ; \
204 rm cmk_base/*.pyc
205 tar czf $(DISTNAME)/werks.tar.gz $(TAROPTS) -C .werks werks
206 tar czf $(DISTNAME)/checks.tar.gz $(TAROPTS) -C checks $$(cd checks ; ls)
207 tar czf $(DISTNAME)/active_checks.tar.gz $(TAROPTS) -C active_checks $$(cd active_checks ; ls)
208 tar czf $(DISTNAME)/notifications.tar.gz $(TAROPTS) -C notifications $$(cd notifications ; ls)
209 tar czf $(DISTNAME)/inventory.tar.gz $(TAROPTS) -C inventory $$(cd inventory ; ls)
210 tar czf $(DISTNAME)/checkman.tar.gz $(TAROPTS) -C checkman $$(cd checkman ; ls)
211 tar czf $(DISTNAME)/web.tar.gz $(TAROPTS) -C web htdocs app
213 tar xzf omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz
214 tar czf $(DISTNAME)/livestatus.tar.gz $(TAROPTS) -C mk-livestatus-$(VERSION) $$(cd mk-livestatus-$(VERSION) ; ls -A )
215 rm -rf mk-livestatus-$(VERSION)
217 tar czf $(DISTNAME)/pnp-templates.tar.gz $(TAROPTS) -C pnp-templates $$(cd pnp-templates ; ls *.php)
218 tar cf $(DISTNAME)/doc.tar $(TAROPTS) -C doc $$(cd doc ; ls)
219 tar rf $(DISTNAME)/doc.tar $(TAROPTS) COPYING AUTHORS ChangeLog
220 tar rf $(DISTNAME)/doc.tar $(TAROPTS) livestatus/api --exclude "*~" --exclude "*.pyc" --exclude ".gitignore" --exclude .f12
221 gzip $(DISTNAME)/doc.tar
223 cd agents ; tar czf ../$(DISTNAME)/agents.tar.gz $(TAROPTS) \
224 --exclude check_mk_agent.spec \
225 --exclude special/lib \
226 cfg_examples \
227 plugins \
228 sap \
229 special \
230 z_os \
231 check-mk-agent_*.deb \
232 check-mk-agent-*.rpm \
233 check_mk_agent.* \
234 check_mk_caching_agent.linux \
235 CONTENTS \
236 mk-job* \
237 waitmax \
238 windows/cfg_examples \
239 windows/check_mk_agent*.{exe,msi} \
240 windows/check_mk.example.ini \
241 windows/CONTENTS \
242 windows/mrpe \
243 windows/plugins
244 cd $(DISTNAME) ; ../scripts/make_package_info $(VERSION) > package_info
245 install -m 755 scripts/*.{sh,py} $(DISTNAME)
246 install -m 644 COPYING AUTHORS ChangeLog standalone.make $(DISTNAME)
247 echo "$(VERSION)" > $(DISTNAME)/VERSION
248 tar czf $(DISTNAME).tar.gz $(TAROPTS) $(DISTNAME)
249 rm -rf $(DISTNAME)
251 @echo "=============================================================================="
252 @echo " FINISHED. "
253 @echo "=============================================================================="
255 omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe:
256 $(MAKE) -C omd openhardwaremonitor-dist
258 omd/packages/openhardwaremonitor/OpenHardwareMonitorLib.dll: omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe
260 .werks/werks: $(WERKS)
261 PYTHONPATH=. python scripts/precompile-werks.py .werks .werks/werks cre
263 ChangeLog: .werks/werks
264 PYTHONPATH=. python scripts/create-changelog.py ChangeLog .werks/werks
266 packages:
267 $(MAKE) -C agents packages
269 # NOTE: Old tar versions (e.g. on CentOS 5) don't have the --transform option,
270 # so we do things in a slightly complicated way.
271 omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz:
272 rm -rf mk-livestatus-$(VERSION)
273 mkdir -p mk-livestatus-$(VERSION)
274 tar cf - $(TAROPTS) -C livestatus $$(cd livestatus ; echo $(LIVESTATUS_SOURCES) ) | tar xf - -C mk-livestatus-$(VERSION)
275 cp -a configure.ac m4 mk-livestatus-$(VERSION)
276 cd mk-livestatus-$(VERSION) && autoreconf --install --include=m4 && rm -rf autom4te.cache
277 tar czf omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz $(TAROPTS) mk-livestatus-$(VERSION)
278 rm -rf mk-livestatus-$(VERSION)
280 version:
281 [ "$$(head -c 6 /etc/issue)" = "Ubuntu" \
282 -o "$$(head -c 16 /etc/issue)" = "Debian GNU/Linux" ] \
283 || { echo 'You are not on the reference system!' ; exit 1; }
284 @newversion=$$(dialog --stdout --inputbox "New Version:" 0 0 "$(VERSION)") ; \
285 if [ -n "$$newversion" ] ; then $(MAKE) NEW_VERSION=$$newversion setversion ; fi
287 setversion:
288 $(MAKE) -C omd NEW_VERSION=$(NEW_VERSION) setversion
289 sed -ri 's/^(VERSION[[:space:]]*:?= *).*/\1'"$(NEW_VERSION)/" defines.make ; \
290 sed -i 's/^AC_INIT.*/AC_INIT([MK Livestatus], ['"$(NEW_VERSION)"'], [mk@mathias-kettner.de])/' configure.ac ; \
291 sed -i 's/^VERSION=".*/VERSION="$(NEW_VERSION)"/' bin/mkbackup ; \
292 sed -i 's/^__version__ = ".*"$$/__version__ = "$(NEW_VERSION)"/' cmk/__init__.py bin/mkbench bin/livedump; \
293 sed -i 's/^VERSION=.*/VERSION='"$(NEW_VERSION)"'/' scripts/setup.sh ; \
294 $(MAKE) -C agents NEW_VERSION=$(NEW_VERSION) setversion
295 $(MAKE) -C docker NEW_VERSION=$(NEW_VERSION) setversion
296 ifeq ($(ENTERPRISE),yes)
297 $(MAKE) -C enterprise NEW_VERSION=$(NEW_VERSION) setversion
298 endif
300 headers:
301 doc/helpers/headrify
303 optimize-images:
304 @if type pngcrush >/dev/null 2>&1; then \
305 for F in $(PNG_FILES); do \
306 echo "Optimizing $$F..." ; \
307 pngcrush -q -rem alla -brute $$F $$F.opt ; \
308 mv $$F.opt $$F; \
309 done ; \
310 else \
311 echo "Missing pngcrush, not optimizing images! (run \"make setup\" to fix this)" ; \
314 node_modules: package.json
315 npm install
317 web/htdocs/js/%_min.js: node_modules webpack.config.js $(JAVASCRIPT_SOURCES)
318 node_modules/.bin/webpack --mode=development
320 # TODO(sp) The target below is not correct, we should not e.g. remove any stuff
321 # which is needed to run configure, this should live in a separate target. In
322 # fact, we should really clean up all this cleaning-chaos and finally follow the
323 # GNU standards here (see "Standard Targets for Users",
324 # https://www.gnu.org/prep/standards/html_node/Standard-Targets.html).
325 clean:
326 make -C omd clean
327 rm -rf clang-analyzer dist.tmp rpm.topdir *.rpm *.deb *.exe \
328 omd/packages/mk-livestatus/mk-livestatus-*.tar.gz \
329 $(NAME)-*.tar.gz *~ counters autochecks \
330 precompiled cache web/htdocs/js/*_min.js \
331 .werks/werks \
332 ChangeLog
334 mrproper:
335 git clean -d --force -x --exclude='\.werks/.last' --exclude='\.werks/.my_ids'
337 setup:
338 sudo apt-get install \
339 aptitude \
340 autoconf \
341 bear \
342 build-essential \
343 clang-7 \
344 clang-format-7 \
345 clang-tidy-7 \
346 doxygen \
347 figlet \
348 g++ \
349 libboost-dev \
350 libboost-system-dev \
351 libclang-7-dev \
352 libpcap-dev \
353 librrd-dev \
354 llvm-7-dev \
355 libsasl2-dev \
356 pngcrush \
357 valgrind \
358 direnv \
359 python-pip \
360 chrpath \
361 enchant \
362 ksh \
363 p7zip-full
364 sudo -H pip install -U pipenv
365 $(MAKE) -C web setup
366 $(MAKE) -C omd setup
367 $(MAKE) -C omd openhardwaremonitor-setup
368 $(MAKE) -C docker setup
369 ifeq ($(ENTERPRISE),yes)
370 $(MAKE) -C enterprise/locale setup
371 endif
373 linesofcode:
374 @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
376 ar-lib compile config.guess config.sub install-sh missing depcomp: configure.ac
377 autoreconf --install --include=m4
378 touch ar-lib compile config.guess config.sub install-sh missing depcomp
380 # TODO(sp): We should really detect and use our own packages in a less hacky way...
381 config.status: $(DIST_DEPS)
382 @echo "Build $@ (newer targets: $?)"
383 @if test -f config.status; then \
384 echo "update config.status by reconfiguring in the same conditions" ; \
385 ./config.status --recheck; \
386 else \
387 if test -d ../boost/destdir ; then \
388 BOOST_OPT="--with-boost=$(abspath ../boost/destdir)" ; \
389 elif test -d omd/packages/boost/destdir ; then \
390 BOOST_OPT="--with-boost=$(abspath omd/packages/boost/destdir)" ; \
391 else \
392 BOOST_OPT="DUMMY1=" ; \
393 fi ; \
394 if test -d "omd/rrdtool-1.7.0/src/.libs"; then \
395 RRD_OPT="LDFLAGS=-L$(realpath omd/rrdtool-1.7.0/src/.libs)" ; \
396 else \
397 RRD_OPT="DUMMY2=" ; \
398 fi ; \
399 if test -d ../re2/destdir ; then \
400 RE2_OPT="--with-re2=$(abspath ../re2/destdir)" ; \
401 elif test -d omd/packages/re2/destdir ; then \
402 RE2_OPT="--with-re2=$(abspath omd/packages/re2/destdir)" ; \
403 else \
404 RE2_OPT="DUMMY3=" ; \
405 fi ; \
406 echo "configure CXXFLAGS=\"$(CXX_FLAGS)\" \"$$BOOST_OPT\" \"$$RRD_OPT\" \"$$RE2_OPT\"" ; \
407 ./configure CXXFLAGS="$(CXX_FLAGS)" "$$BOOST_OPT" "$$RRD_OPT" "$$RE2_OPT" ; \
410 configure: $(CONFIGURE_DEPS)
411 autoconf
413 aclocal.m4: $(M4_DEPS)
414 aclocal
416 config.h.in: $(CONFIGURE_DEPS)
417 autoheader
418 rm -f stamp-h1
419 touch $@
421 config.h: stamp-h1
422 @test -f $@ || rm -f stamp-h1
423 @test -f $@ || $(MAKE) stamp-h1
425 stamp-h1: config.h.in config.status
426 @rm -f stamp-h1
427 ./config.status config.h
429 GTAGS: config.h
430 # automake generates "gtags -i ...", but incremental updates seem to be a bit
431 # fragile, so let's start from scratch, gtags is quite fast.
432 $(RM) GTAGS GRTAGS GSYMS GPATH
433 # Note: Even if we descend into livestatus, gtags is run on the top level (next
434 # to configure.ac).
435 $(MAKE) -C livestatus GTAGS
437 compile-neb-cmc: config.status
438 $(MAKE) -C livestatus -j4
439 ifeq ($(ENTERPRISE),yes)
440 $(MAKE) -C enterprise/core -j4
441 endif
443 tidy: config.h
444 $(MAKE) -C livestatus/src tidy
445 ifeq ($(ENTERPRISE),yes)
446 $(MAKE) -C enterprise/core/src tidy
447 endif
449 iwyu: config.h
450 $(MAKE) -C livestatus/src iwyu
451 ifeq ($(ENTERPRISE),yes)
452 $(MAKE) -C enterprise/core/src iwyu
453 endif
455 # Not really perfect rules, but better than nothing
456 analyze: config.h
457 $(MAKE) -C livestatus clean
458 cd livestatus && $(SCAN_BUILD) -o ../clang-analyzer $(MAKE) CXXFLAGS="-std=c++17"
460 # GCC-like output on stderr intended for human consumption.
461 cppcheck: config.h
462 $(MAKE) -C livestatus/src cppcheck
463 ifeq ($(ENTERPRISE),yes)
464 $(MAKE) -C enterprise/core/src cppcheck
465 endif
467 # XML output into file intended for machine processing.
468 cppcheck-xml: config.h
469 $(MAKE) -C livestatus/src cppcheck-xml
470 ifeq ($(ENTERPRISE),yes)
471 $(MAKE) -C enterprise/core/src cppcheck-xml
472 endif
474 format: format-python format-c
476 # TODO: We should probably handle this rule via AM_EXTRA_RECURSIVE_TARGETS in
477 # src/configure.ac, but this needs at least automake-1.13, which in turn is only
478 # available from e.g. Ubuntu Saucy (13) onwards, so some magic is needed.
479 format-c:
480 $(CLANG_FORMAT) -style=file -i $(FILES_TO_FORMAT)
482 format-python: .venv
483 # Explicitly specify --style [FILE] to prevent costly searching in parent directories
484 # for each file specified via command line
486 # Saw some mixed up lines on stdout after adding the --parallel option. Leaving it on
487 # for the moment to get the performance boost this option brings.
488 PYTHON_FILES=$${PYTHON_FILES-$$(tests/find-python-files)} ; \
489 $(PIPENV) run yapf --parallel --style .style.yapf --verbose -i $$PYTHON_FILES
491 # Note: You need the doxygen and graphviz packages.
492 documentation: config.h
493 $(MAKE) -C livestatus/src documentation
494 ifeq ($(ENTERPRISE),yes)
495 $(MAKE) -C enterprise/core/src documentation
496 endif
498 Pipfile.lock: Pipfile
499 $(PIPENV) lock
500 # TODO: Can be removed if pipenv fixes this issue.
501 # See: https://github.com/pypa/pipenv/issues/3140
502 # https://github.com/pypa/pipenv/issues/3026
503 # The recent pipenv version 2018.10.13 has a bug that places wrong markers in the
504 # Pipfile.lock. This leads to an error when installing packages with this
505 # markers and prints an error message. Example:
506 # Ignoring pyopenssl: markers 'extra == "security"' don't match your environment
507 sed -i "/\"markers\": \"extra == /d" Pipfile.lock
508 # TODO: pipenv and make don't really cooperate nicely: Locking alone already
509 # creates a virtual environment with setuptools/pip/wheel. This could lead to a
510 # wrong up-to-date status of it later, so let's remove it here. What we really
511 # want is a check if the contents of .venv match the contents of Pipfile.lock.
512 # We should do this via some move-if-change Kung Fu, but for now rm suffices.
513 rm -rf .venv
515 .venv: Pipfile.lock
516 # Remake .venv everytime Pipfile or Pipfile.lock are updated. Using the 'sync'
517 # mode installs the dependencies exactly as speciefied in the Pipfile.lock.
518 # This is extremely fast since the dependencies do not have to be resolved.
519 $(RM) -r .venv
520 $(PIPENV) sync --dev
521 touch .venv
523 # This dummy rule is called from subdirectories whenever one of the
524 # top-level Makefile's dependencies must be updated. It does not
525 # need to depend on %MAKEFILE% because GNU make will always make sure
526 # %MAKEFILE% is updated before considering the am--refresh target.
527 am--refresh: