-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
130 lines (101 loc) · 3.84 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
#
# Main makefile for cmonitor project
# https://github.com/f18m/cmonitor
# Francesco Montorsi (c) 2019-2024
#
# constants
THIS_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
ROOT_DIR:=$(THIS_DIR)
include $(ROOT_DIR)/Constants.mk
CONAN_AUTOGENERATED_FILES:=\
conanbuild.sh \
conanbuildenv-release-x86_64.sh \
conandeps.mk \
conanrun.sh \
conanrunenv-release-x86_64.sh \
deactivate_conanbuild.sh \
deactivate_conanrun.sh
#
# BUILD TARGETS
#
all:
@# reason why we have so many "if directory exists" is that during COPR builds,
@# the source RPM tarball will contain only a subset of the folders
if [ -d "collector" ]; then $(MAKE) -C collector CMONITOR_VERSION=$(CMONITOR_VERSION) CMONITOR_RELEASE=$(CMONITOR_RELEASE) CMONITOR_LAST_COMMIT_HASH=$(CMONITOR_LAST_COMMIT_HASH) DOCKER_TAG=$(DOCKER_TAG) PROMETHEUS_SUPPORT=$(PROMETHEUS_SUPPORT) ; fi
if [ -d "tools" ]; then $(MAKE) -C tools CMONITOR_VERSION=$(CMONITOR_VERSION) CMONITOR_RELEASE=$(CMONITOR_RELEASE) CMONITOR_LAST_COMMIT_HASH=$(CMONITOR_LAST_COMMIT_HASH) ; fi
conan_install:
conan install . --build=missing
centos_install_prereq:
# this is just the list present in "BuildRequires" field of the RPM spec file:
yum install gcc-c++ make gtest-devel fmt-devel git
test:
$(MAKE) -C collector test
$(MAKE) -C examples all
if [ -d "tools" ]; then $(MAKE) -C tools test ; fi
format_check:
black --check .
clean:
$(MAKE) -C collector clean
$(MAKE) -C tools clean
$(MAKE) -C examples clean
rm -f $(CONAN_AUTOGENERATED_FILES)
install:
ifndef DESTDIR
@echo "*** ERROR: please call this makefile supplying explicitly the DESTDIR variable. E.g. DESTDIR=/tmp/myinstall"
@exit 1
endif
ifndef BINDIR
@echo "*** ERROR: please call this makefile supplying explicitly the BINDIR variable. E.g. BINDIR=usr/bin"
@exit 1
endif
$(MAKE) -C collector install DESTDIR=$(DESTDIR) BINDIR=$(BINDIR)
$(MAKE) -C tools install DESTDIR=$(DESTDIR) BINDIR=$(BINDIR)
valgrind:
$(MAKE) -C collector valgrind
#
# DOCKER IMAGE
#
docker_image:
$(MAKE) -C collector docker_image
docker_run:
$(MAKE) -C collector docker_run
docker_push:
$(MAKE) -C collector docker_push
examples:
$(MAKE) -C examples all
# DEBIAN PACKAGE
#
# Reference guide:
# https://www.debian.org/doc/manuals/maint-guide/dreq.en.html
#
# Quick summary:
# - update debian/changelog using interactive utility "dch -i"
# (you must have formatted the debian/changelog file according to Debian/Ubuntu strict rules!!)
# - make deb
# - run dput to upload to your PPA
#
# Note: debian control files must live in the root folder of the project, not inside "collector" or "tools"
deb_help:
@echo " make deb_new_changelog"
@echo " make deb_local_test"
@echo " make deb_source_pkg_for_upload"
deb_new_changelog:
dch -i --distribution bionic --controlmaint
deb_source_pkg_for_upload:
ifeq ($(shell whoami),root)
@echo "*** ERROR: generating the Debian/Ubuntu package requires using a normal user, having a valid GPG secret key registered;"
@echo " both 'gpg -k' and 'gpg -K' must show the same key."
@exit 1
endif
dpkg-buildpackage --post-clean --build=source --force-sign # build source only otherwise Ubuntu PPA rejects with "Source/binary (i.e. mixed) uploads are not allowed"
debsign -S # you must have the GPG key setup properly for this to work (see e.g. https://help.github.com/en/articles/generating-a-new-gpg-key)
@echo "When ready to upload to your PPA run dput as e.g.:"
@echo " cd .. && dput ppa:francesco-montorsi/cmonitor cmonitor_$(CMONITOR_VERSION)*_source.changes"
deb_local_test:
ifeq ($(shell whoami),root)
@echo "*** ERROR: generating the Debian/Ubuntu package requires using a normal user, having a valid GPG secret key registered;"
@echo " both 'gpg -k' and 'gpg -K' must show the same key."
@exit 1
endif
dpkg-buildpackage
.PHONY: all clean install examples