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