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