forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
562 lines (488 loc) · 22.1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 [email protected] |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#
include defines.make
NAME := check_mk
PREFIX := /usr
BINDIR := $(PREFIX)/bin
CONFDIR := /etc/$(NAME)
LIBDIR := $(PREFIX)/lib/$(NAME)
DISTNAME := $(NAME)-$(VERSION)
DIST_ARCHIVE := check-mk-$(EDITION)-$(OMD_VERSION).tar.gz
TAROPTS := --owner=root --group=root --exclude=.svn --exclude=*~ \
--exclude=.gitignore --exclude=*.swp --exclude=.f12
# We could add clang's -Wshorten-64-to-32 and g++'c/clang's -Wsign-conversion here.
CXX_FLAGS := -g -O3 -Wall -Wextra
CLANG_VERSION := 8
CLANG_FORMAT := clang-format-$(CLANG_VERSION)
SCAN_BUILD := scan-build-$(CLANG_VERSION)
export CPPCHECK := cppcheck
export DOXYGEN := doxygen
export IWYU_TOOL := iwyu_tool
ARTIFACT_STORAGE := http://nexus:8081
PIPENV2 := scripts/run-pipenv 2
PIPENV3 := scripts/run-pipenv 3
M4_DEPS := $(wildcard m4/*) configure.ac
CONFIGURE_DEPS := $(M4_DEPS) aclocal.m4
CONFIG_DEPS := ar-lib compile config.guess config.sub install-sh missing depcomp configure
DIST_DEPS := $(CONFIG_DEPS) \
omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe \
omd/packages/openhardwaremonitor/OpenHardwareMonitorLib.dll
LIVESTATUS_SOURCES := Makefile.am api/c++/{Makefile,*.{h,cc}} api/perl/* \
api/python/{README,*.py} {nagios,nagios4}/{README,*.h} \
src/{Makefile.am,{,test/}*.{cc,h}} standalone/config_files.m4
FILES_TO_FORMAT_WINDOWS := \
$(wildcard $(addprefix agents/,*.cc *.c *.h)) \
$(wildcard $(addprefix agents/windows/,*.cc *.h)) \
$(wildcard $(addprefix agents/windows/sections/,*.cc *.h)) \
$(wildcard $(addprefix agents/windows/test/,*.cc *.h)) \
$(wildcard $(addprefix agents/windows/test/sections,*.cc *.h)) \
FILES_TO_FORMAT_LINUX := \
$(wildcard $(addprefix livestatus/api/c++/,*.cc *.h)) \
$(wildcard $(addprefix livestatus/src/,*.cc *.h)) \
$(wildcard $(addprefix livestatus/src/test/,*.cc *.h)) \
$(wildcard $(addprefix bin/,*.cc *.c *.h)) \
$(wildcard $(addprefix enterprise/core/src/,*.cc *.h)) \
$(wildcard $(addprefix enterprise/core/src/test/,*.cc *.h))
WERKS := $(wildcard .werks/[0-9]*)
JAVASCRIPT_SOURCES := $(filter-out %_min.js, \
$(wildcard \
$(foreach edir,. enterprise managed, \
$(foreach subdir,* */* */*/*,$(edir)/web/htdocs/js/$(subdir).js))))
JAVASCRIPT_MINI := $(foreach jmini,main mobile side,web/htdocs/js/$(jmini)_min.js)
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))
RRDTOOL_VERS := $(shell egrep -h "RRDTOOL_VERS\s:=\s" omd/packages/rrdtool/rrdtool.make | sed 's/RRDTOOL_VERS\s:=\s//')
WEBPACK_MODE ?= production
THEMES := classic facelift modern-dark
THEME_CSS_FILES := $(addprefix web/htdocs/themes/,$(addsuffix /theme.css,$(THEMES)))
THEME_JSON_FILES := $(addprefix web/htdocs/themes/,$(addsuffix /theme.json,$(THEMES)))
THEME_IMAGE_DIRS := $(addprefix web/htdocs/themes/,$(addsuffix /images,$(THEMES)))
THEME_RESOURCES := $(THEME_CSS_FILES) $(THEME_JSON_FILES) $(THEME_IMAGE_DIRS)
.PHONY: all analyze build check check-binaries check-permissions check-version \
clean compile-neb-cmc cppcheck dist documentation format format-c \
format-windows format-linux format-python format-shell \
GTAGS headers help install \
iwyu mrproper mrclean optimize-images packages setup setversion tidy version \
am--refresh skel .venv .venv-2.7 .venv-3.7
help:
@echo "setup --> Prepare system for development and building"
@echo "make dist --> Create source tgz for later building of rpm/deb and livestatus tgz"
@echo "make rpm --> Create rpm package"
@echo "make deb --> Create deb package"
@echo "make cma --> Create cma package"
@echo "make version --> Switch to new version"
rpm:
$(MAKE) -C omd rpm
deb:
$(MAKE) -C omd deb
cma:
$(MAKE) -C omd cma
check: check-permissions check-binaries check-version
check-permissions:
@echo -n "Checking permissions... with find -not -perm -444..." && [ -z "$$(find -not -perm -444)" ] && echo OK
check-binaries:
@if [ -z "$(SKIP_SANITY_CHECKS)" ]; then \
echo -n "Checking precompiled binaries..." && file agents/waitmax | grep 32-bit >/dev/null && echo OK ; \
fi
check-version:
@sed -n 1p ChangeLog | fgrep -qx '$(VERSION):' || { \
echo "Version $(VERSION) not listed at top of ChangeLog!" ; \
false ; }
# Is executed by our build environment from a "git archive" snapshot and during
# RPM building to create the source tar.gz for the RPM build process.
# Would use --exclude-vcs-ignores but that's available from tar 1.29 which
# is currently not used by most distros
# Would also use --exclude-vcs, but this is also not available
# And --transform is also missing ...
dist: $(DISTNAME).tar.gz config.h.in $(DIST_DEPS)
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise agents/plugins/cmk-update-agent
$(MAKE) -C enterprise agents/plugins/cmk-update-agent-32
$(MAKE) -C enterprise agents/windows/plugins/cmk-update-agent.exe
endif
set -e -o pipefail ; EXCLUDES= ; \
if [ -d .git ]; then \
git rev-parse --short HEAD > COMMIT ; \
for X in $$(git ls-files --directory --others -i --exclude-standard) ; do \
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 \
EXCLUDES+=" --exclude $${X%*/}" ; \
fi ; \
done ; \
else \
for F in $(DIST_ARCHIVE) enterprise/agents/plugins/{build,build-32,src} agents/windows/{build64,build} enterprise/agents/winbuild; do \
EXCLUDES+=" --exclude $$F" ; \
done ; \
fi ; \
if [ -d check-mk-$(EDITION)-$(OMD_VERSION) ]; then \
rm -rf check-mk-$(EDITION)-$(OMD_VERSION) ; \
fi ; \
mkdir check-mk-$(EDITION)-$(OMD_VERSION) ; \
tar -c --wildcards \
$(TAROPTS) \
--exclude check-mk-$(EDITION)-$(OMD_VERSION) \
--exclude .git \
--exclude .gitignore \
--exclude .gitmodules \
--exclude .gitattributes \
$$EXCLUDES \
* .werks .clang* | tar x -C check-mk-$(EDITION)-$(OMD_VERSION)
if [ -f COMMIT ]; then \
rm COMMIT ; \
fi
tar -cz --wildcards -f $(DIST_ARCHIVE) \
$(TAROPTS) \
check-mk-$(EDITION)-$(OMD_VERSION)
rm -rf check-mk-$(EDITION)-$(OMD_VERSION)
# This tar file is only used by "omd/packages/check_mk/Makefile"
$(DISTNAME).tar.gz: omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz .werks/werks $(JAVASCRIPT_MINI) $(THEME_RESOURCES) ChangeLog
@echo "Making $(DISTNAME)"
rm -rf $(DISTNAME)
mkdir -p $(DISTNAME)
$(MAKE) -C agents build
tar cf $(DISTNAME)/bin.tar $(TAROPTS) -C bin $$(cd bin ; ls)
tar rf $(DISTNAME)/bin.tar $(TAROPTS) -C agents/windows/msibuild msi-update
tar rf $(DISTNAME)/bin.tar $(TAROPTS) -C agents/windows/msibuild msi-update-legacy
gzip $(DISTNAME)/bin.tar
$(PIPENV2) run python -m compileall cmk ; \
tar czf $(DISTNAME)/lib.tar.gz $(TAROPTS) \
--exclude "cee" \
--exclude "cee.py*" \
--exclude "cme" \
--exclude "cme.py*" \
cmk/* ; \
rm cmk/*.pyc
$(PIPENV2) run python -m compileall cmk_base ; \
tar czf $(DISTNAME)/base.tar.gz \
$(TAROPTS) \
--exclude "cee" \
--exclude "cee.py*" \
--exclude "cme" \
--exclude "cme.py*" \
cmk_base/* ; \
rm cmk_base/*.pyc
tar czf $(DISTNAME)/werks.tar.gz $(TAROPTS) -C .werks werks
tar czf $(DISTNAME)/checks.tar.gz $(TAROPTS) -C checks $$(cd checks ; ls)
tar czf $(DISTNAME)/active_checks.tar.gz $(TAROPTS) -C active_checks $$(cd active_checks ; ls)
tar czf $(DISTNAME)/notifications.tar.gz $(TAROPTS) -C notifications $$(cd notifications ; ls)
tar czf $(DISTNAME)/inventory.tar.gz $(TAROPTS) -C inventory $$(cd inventory ; ls)
tar czf $(DISTNAME)/checkman.tar.gz $(TAROPTS) -C checkman $$(cd checkman ; ls)
tar czf $(DISTNAME)/web.tar.gz $(TAROPTS) -C web \
app \
htdocs/css \
htdocs/images \
htdocs/jquery \
$(patsubst web/%,%,$(JAVASCRIPT_MINI)) \
$(patsubst web/%,%.map,$(JAVASCRIPT_MINI)) \
htdocs/sounds \
$(patsubst web/%,%,$(THEME_RESOURCES))
tar xzf omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz
tar czf $(DISTNAME)/livestatus.tar.gz $(TAROPTS) -C mk-livestatus-$(VERSION) $$(cd mk-livestatus-$(VERSION) ; ls -A )
rm -rf mk-livestatus-$(VERSION)
tar czf $(DISTNAME)/pnp-templates.tar.gz $(TAROPTS) -C pnp-templates $$(cd pnp-templates ; ls *.php)
tar cf $(DISTNAME)/doc.tar $(TAROPTS) -C doc $$(cd doc ; ls)
tar rf $(DISTNAME)/doc.tar $(TAROPTS) COPYING AUTHORS ChangeLog
tar rf $(DISTNAME)/doc.tar $(TAROPTS) livestatus/api --exclude "*~" --exclude "*.pyc" --exclude ".gitignore" --exclude .f12
gzip $(DISTNAME)/doc.tar
cd agents ; tar czf ../$(DISTNAME)/agents.tar.gz $(TAROPTS) \
--exclude check_mk_agent.spec \
--exclude special/lib \
cfg_examples \
plugins \
sap \
special \
z_os \
check-mk-agent_*.deb \
check-mk-agent-*.rpm \
check_mk_agent.* \
check_mk_caching_agent.linux \
CONTENTS \
mk-job* \
waitmax \
windows/cfg_examples \
windows/check_mk_agent*.{exe,msi} \
windows/check_mk.example.ini \
windows/check_mk.user.yml \
windows/CONTENTS \
windows/mrpe \
windows/plugins
cd $(DISTNAME) ; ../scripts/make_package_info $(VERSION) > package_info
install -m 755 scripts/*.{sh,py} $(DISTNAME)
install -m 644 COPYING AUTHORS ChangeLog standalone.make $(DISTNAME)
echo "$(VERSION)" > $(DISTNAME)/VERSION
tar czf $(DISTNAME).tar.gz $(TAROPTS) $(DISTNAME)
rm -rf $(DISTNAME)
@echo "=============================================================================="
@echo " FINISHED. "
@echo "=============================================================================="
omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe:
$(MAKE) -C omd openhardwaremonitor-dist
omd/packages/openhardwaremonitor/OpenHardwareMonitorLib.dll: omd/packages/openhardwaremonitor/OpenHardwareMonitorCLI.exe
.werks/werks: $(WERKS)
PYTHONPATH=${PYTHONPATH}:$(REPO_PATH) $(PIPENV2) run scripts/precompile-werks.py .werks .werks/werks cre
ChangeLog: .werks/werks
PYTHONPATH=${PYTHONPATH}:$(REPO_PATH) $(PIPENV2) run scripts/create-changelog.py ChangeLog .werks/werks
packages:
$(MAKE) -C agents packages
# NOTE: Old tar versions (e.g. on CentOS 5) don't have the --transform option,
# so we do things in a slightly complicated way.
omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz:
rm -rf mk-livestatus-$(VERSION)
mkdir -p mk-livestatus-$(VERSION)
tar cf - $(TAROPTS) -C livestatus $$(cd livestatus ; echo $(LIVESTATUS_SOURCES) ) | tar xf - -C mk-livestatus-$(VERSION)
cp -a configure.ac m4 mk-livestatus-$(VERSION)
cd mk-livestatus-$(VERSION) && autoreconf --install --include=m4 && rm -rf autom4te.cache
tar czf omd/packages/mk-livestatus/mk-livestatus-$(VERSION).tar.gz $(TAROPTS) mk-livestatus-$(VERSION)
rm -rf mk-livestatus-$(VERSION)
version:
[ "$$(head -c 6 /etc/issue)" = "Ubuntu" \
-o "$$(head -c 16 /etc/issue)" = "Debian GNU/Linux" ] \
|| { echo 'You are not on the reference system!' ; exit 1; }
@newversion=$$(dialog --stdout --inputbox "New Version:" 0 0 "$(VERSION)") ; \
if [ -n "$$newversion" ] ; then $(MAKE) NEW_VERSION=$$newversion setversion ; fi
setversion:
$(MAKE) -C omd NEW_VERSION=$(NEW_VERSION) setversion
sed -ri 's/^(VERSION[[:space:]]*:?= *).*/\1'"$(NEW_VERSION)/" defines.make ; \
sed -i 's/^AC_INIT.*/AC_INIT([MK Livestatus], ['"$(NEW_VERSION)"'], [[email protected]])/' configure.ac ; \
sed -i 's/^VERSION=".*/VERSION="$(NEW_VERSION)"/' bin/mkbackup ; \
sed -i 's/^__version__ = ".*"$$/__version__ = "$(NEW_VERSION)"/' cmk/__init__.py bin/mkbench bin/livedump; \
sed -i 's/^VERSION=.*/VERSION='"$(NEW_VERSION)"'/' scripts/setup.sh ; \
$(MAKE) -C agents NEW_VERSION=$(NEW_VERSION) setversion
$(MAKE) -C docker NEW_VERSION=$(NEW_VERSION) setversion
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise NEW_VERSION=$(NEW_VERSION) setversion
endif
headers:
doc/helpers/headrify
optimize-images:
@if type pngcrush >/dev/null 2>&1; then \
for F in $(PNG_FILES); do \
echo "Optimizing $$F..." ; \
pngcrush -q -rem alla -brute $$F $$F.opt ; \
mv $$F.opt $$F; \
done ; \
else \
echo "Missing pngcrush, not optimizing images! (run \"make setup\" to fix this)" ; \
fi
# TODO: The --unsafe-perm was added because the CI executes this as root during
# tests and building versions. Once we have the then build system this should not
# be necessary anymore.
node_modules: package.json package-lock.json
@if curl --silent --output /dev/null --head '${ARTIFACT_STORAGE}/#browse/browse:npm-proxy'; then \
REGISTRY=--registry=${ARTIFACT_STORAGE}/repository/npm-proxy/ ; \
export SASS_BINARY_SITE='${ARTIFACT_STORAGE}/repository/archives/'; \
echo "Installing from local registry ${ARTIFACT_STORAGE}" ; \
else \
REGISTRY= ; \
echo "Installing from public registry" ; \
fi ; \
npm install --audit=false --unsafe-perm $$REGISTRY
web/htdocs/js/%_min.js: node_modules webpack.config.js $(JAVASCRIPT_SOURCES)
WEBPACK_MODE=$(WEBPACK_MODE) ENTERPRISE=$(ENTERPRISE) MANAGED=$(MANAGED) node_modules/.bin/webpack --mode=$(WEBPACK_MODE:quick=development)
web/htdocs/themes/%/theme.css: node_modules webpack.config.js postcss.config.js web/htdocs/themes/%/theme.scss web/htdocs/themes/%/scss/*.scss
WEBPACK_MODE=$(WEBPACK_MODE) ENTERPRISE=$(ENTERPRISE) MANAGED=$(MANAGED) node_modules/.bin/webpack --mode=$(WEBPACK_MODE:quick=development)
# This target is used to generate a css file for the virtual appliance. It is
# called from the cma git's Makefile and the respective scss and css files are
# kept under ~/git/cma/skel/usr/share/cma/webconf/htdocs/
web/htdocs/themes/facelift/cma_facelift.css: node_modules webpack.config.js postcss.config.js web/htdocs/themes/facelift/cma_facelift.scss web/htdocs/themes/facelift/scss/*.scss
WEBPACK_MODE=$(WEBPACK_MODE) ENTERPRISE=$(ENTERPRISE) MANAGED=$(MANAGED) node_modules/.bin/webpack --mode=$(WEBPACK_MODE:quick=development)
# TODO(sp) The target below is not correct, we should not e.g. remove any stuff
# which is needed to run configure, this should live in a separate target. In
# fact, we should really clean up all this cleaning-chaos and finally follow the
# GNU standards here (see "Standard Targets for Users",
# https://www.gnu.org/prep/standards/html_node/Standard-Targets.html).
clean:
make -C omd clean
rm -rf clang-analyzer dist.tmp rpm.topdir *.rpm *.deb *.exe \
omd/packages/mk-livestatus/mk-livestatus-*.tar.gz \
$(NAME)-*.tar.gz *~ counters autochecks \
precompiled cache web/htdocs/js/*_min.js \
web/htdocs/themes/*/theme.css \
.werks/werks \
ChangeLog
mrproper:
git clean -d --force -x \
--exclude='\.werks/.last'\
--exclude='\.werks/.my_ids'
mrclean:
git clean -d --force -x \
--exclude='\.werks/.last' \
--exclude='\.werks/.my_ids' \
--exclude=".venv*" \
--exclude="virtual-envs/*/.venv/"
setup:
sudo apt-get install \
aptitude \
autoconf \
bear \
build-essential \
clang-7 \
clang-format-7 \
clang-tidy-7 \
doxygen \
figlet \
g++ \
libclang-7-dev \
libpcap-dev \
llvm-7-dev \
libsasl2-dev \
libldap2-dev \
libkrb5-dev \
libmysqlclient-dev \
pngcrush \
valgrind \
direnv \
python-pip \
python3.7-dev \
chrpath \
enchant \
ksh \
p7zip-full
sudo -H pip install -U pipenv
$(MAKE) -C web setup
$(MAKE) -C omd setup
$(MAKE) -C omd openhardwaremonitor-setup
$(MAKE) -C docker setup
$(MAKE) -C locale setup
linesofcode:
@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
ar-lib compile config.guess config.sub install-sh missing depcomp: configure.ac
autoreconf --install --include=m4
touch ar-lib compile config.guess config.sub install-sh missing depcomp
# TODO(sp): We should really detect and use our own packages in a less hacky way...
config.status: $(CONFIG_DEPS)
@echo "Build $@ (newer targets: $?)"
@if test -f config.status; then \
echo "update config.status by reconfiguring in the same conditions" ; \
./config.status --recheck; \
else \
if test -d "omd/rrdtool-$(RRDTOOL_VERS)/src/.libs"; then \
RRD_OPT="LDFLAGS=-L$(realpath omd/rrdtool-$(RRDTOOL_VERS)/src/.libs)" ; \
else \
RRD_OPT="DUMMY2=" ; \
fi ; \
if test -d ../re2/destdir ; then \
RE2_OPT="--with-re2=$(abspath ../re2/destdir)" ; \
elif test -d omd/packages/re2/destdir ; then \
RE2_OPT="--with-re2=$(abspath omd/packages/re2/destdir)" ; \
else \
RE2_OPT="DUMMY3=" ; \
fi ; \
echo "configure CXXFLAGS=\"$(CXX_FLAGS)\" \"$$RRD_OPT\" \"$$RE2_OPT\"" ; \
./configure CXXFLAGS="$(CXX_FLAGS)" "$$RRD_OPT" "$$RE2_OPT" ; \
fi
configure: $(CONFIGURE_DEPS)
autoconf
aclocal.m4: $(M4_DEPS)
aclocal
config.h.in: $(CONFIGURE_DEPS)
autoheader
rm -f stamp-h1
touch $@
config.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) stamp-h1
stamp-h1: config.h.in config.status
@rm -f stamp-h1
./config.status config.h
GTAGS: config.h
# automake generates "gtags -i ...", but incremental updates seem to be a bit
# fragile, so let's start from scratch, gtags is quite fast.
$(RM) GTAGS GRTAGS GSYMS GPATH
# Note: Even if we descend into livestatus, gtags is run on the top level (next
# to configure.ac).
$(MAKE) -C livestatus GTAGS
compile-neb-cmc: config.status
$(MAKE) -C livestatus -j4
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise/core -j4
endif
tidy: config.h
$(MAKE) -C livestatus/src tidy
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise/core/src tidy
endif
iwyu: config.h
$(MAKE) -C livestatus/src iwyu
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise/core/src iwyu
endif
# Not really perfect rules, but better than nothing
analyze: config.h
$(MAKE) -C livestatus clean
cd livestatus && $(SCAN_BUILD) -o ../clang-analyzer $(MAKE) CXXFLAGS="-std=c++17"
# GCC-like output on stderr intended for human consumption.
cppcheck: config.h
$(MAKE) -C livestatus/src cppcheck
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise/core/src cppcheck
endif
# XML output into file intended for machine processing.
cppcheck-xml: config.h
$(MAKE) -C livestatus/src cppcheck-xml
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise/core/src cppcheck-xml
endif
format: format-python format-c format-shell
# TODO: We should probably handle this rule via AM_EXTRA_RECURSIVE_TARGETS in
# src/configure.ac, but this needs at least automake-1.13, which in turn is only
# available from e.g. Ubuntu Saucy (13) onwards, so some magic is needed.
format-c: format-windows format-linux
format-windows:
$(CLANG_FORMAT) -style=file -i $(FILES_TO_FORMAT_WINDOWS)
format-linux:
$(CLANG_FORMAT) -style=file -i $(FILES_TO_FORMAT_LINUX)
format-python:
# Explicitly specify --style [FILE] to prevent costly searching in parent directories
# for each file specified via command line
#
# Saw some mixed up lines on stdout after adding the --parallel option. Leaving it on
# for the moment to get the performance boost this option brings.
PYTHON_FILES=$${PYTHON_FILES-$$(tests/find-python-files)} ; \
$(PIPENV2) run yapf --parallel --style .style.yapf --verbose -i $$PYTHON_FILES
format-shell:
sudo docker run --rm -v "$(realpath .):/sh" -w /sh peterdavehello/shfmt shfmt -w -i 4 -ci $(SHELL_FILES)
# Note: You need the doxygen and graphviz packages.
documentation: config.h
$(MAKE) -C livestatus/src documentation
ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise/core/src documentation
endif
.venv-2.7:
make -C virtual-envs/2.7 .venv
make -C virtual-envs/3.7 .venv
rm -rf {Pipfile,Pipfile.lock,.venv*}
ln -s virtual-envs/2.7/{Pipfile,Pipfile.lock,.venv} .
.venv-3.7:
make -C virtual-envs/2.7 .venv
make -C virtual-envs/3.7 .venv
rm -rf {Pipfile,Pipfile.lock,.venv*}
ln -s virtual-envs/3.7/{Pipfile,Pipfile.lock,.venv} .
# This alias is for compatibility: The target .venv should refer to 2.7 for the moment
.venv: .venv-2.7
# This dummy rule is called from subdirectories whenever one of the
# top-level Makefile's dependencies must be updated. It does not
# need to depend on %MAKEFILE% because GNU make will always make sure
# %MAKEFILE% is updated before considering the am--refresh target.
am--refresh:
@: