Debian Codegraph @

Makefile

raw symbols SCIP
1 #if 0 /// The original Makefile follows, which isn't enough for elogind.
2 # # SPDX-License-Identifier: LGPL-2.1-or-later
3 #
4 # all:
5 # ninja -C build
6 #
7 # install:
8 # DESTDIR=$(DESTDIR) ninja -C build install
9 #else // 0
10 .PHONY: all build clean full install justprint loginctl test test-login
11 export
12
13 # Set this to YES on the command line for a debug build
14 DEBUG ?= NO
15
16 # Set this to yes to not build, but to show all build commands ninja would issue
17 JUST_PRINT ?= NO
18
19 HERE := ${CURDIR}
20
21 BASIC_OPT := --buildtype release
22 BUILDDIR ?= $(HERE)/build
23 BUILDMODE ?= auto
24 CGCONTROL ?= $(shell $(HERE)/tools/meson-get-cg-controller.sh)
25 CGDEFAULT ?= $(shell grep "^rc_cgroup_mode" /etc/rc.conf | cut -d '"' -f 2)
26 DESTDIR ?=
27 MESON_LST := $(shell find $(HERE)/ -type f -name 'meson.build') $(HERE)/meson_options.txt
28 ROOTPREFIX ?= /tmp/elogind_test
29 PREFIX ?= $(ROOTPREFIX)/usr
30 SYSCONFDIR ?= $(ROOTPREFIX)/etc
31 VERSION ?= 9999
32
33 # Detailed config with sane defaults
34 USE_ACL ?= enabled
35 USE_AUDIT ?= enabled
36 USE_EFI ?= false
37 USE_HTML ?= auto
38 USE_MAN ?= auto
39 USE_SELINUX ?= disabled
40 USE_SMACK ?= true
41 USE_UTMP ?= true
42 USE_XENCTRL ?= auto
43
44 # Tools needed by the wrapper
45 CC ?= $(shell which cc)
46 LD ?= $(shell which ld)
47 LN := $(shell which ln) -s
48 MAKE := $(shell which make)
49 MESON ?= $(shell which meson)
50 MKDIR := $(shell which mkdir) -p
51 NINJA ?= $(shell which ninja)
52 RM := $(shell which rm) -f
53
54 # Save users/systems choice
55 envCFLAGS := ${CFLAGS}
56 envLDFLAGS := ${LDFLAGS}
57
58 BASIC_OPT := --buildtype release
59 NINJA_OPT := --verbose
60
61 # Make sure "--just-print" gets translated over to ninja
62 ifneq (,$(findstring n,$(MAKEFLAGS)))
63 FILTER_ME = n
64 override MAKEFLAGS := $(filter-out $(FILTER_ME),$(MAKEFLAGS))
65 override MAKEOVERRIDE := $(MAKEFLAGS)
66 # Explicitly set JUST_PRINT to "YES"
67 JUST_PRINT := YES
68 endif
69
70 # Simulate --just-print?
71 ifeq (YES,$(JUST_PRINT))
72 NINJA_OPT := ${NINJA_OPT} -t commands
73 endif
74
75 # Combine with "sane defaults"
76 ifeq (YES,$(DEBUG))
77 BASIC_OPT := --werror -Dlog-trace=true -Dslow-tests=true -Ddebug-extra=elogind --buildtype debug
78 BUILDDIR := ${BUILDDIR}_debug
79 CFLAGS := -O0 -g3 -ggdb -ftrapv ${envCFLAGS} -fPIE
80 LDFLAGS := -fPIE
81 ifeq (NO,$(JUST_PRINT))
82 NINJA_OPT := ${NINJA_OPT} -j 1 -k 1
83 endif
84 ifneq (release,$(BUILDMODE))
85 BUILDMODE := developer
86 endif
87 else
88 BUILDDIR := ${BUILDDIR}_release
89 CFLAGS := -fwrapv ${envCFLAGS}
90 LDFLAGS :=
91 ifeq (YES,$(JUST_PRINT))
92 NINJA_OPT := ${NINJA_OPT} -s
93 endif
94 ifneq (developer,$(BUILDMODE))
95 BUILDMODE := release
96 endif
97 endif
98
99 # Set search paths including the actual build directory
100 VPATH := $(BUILDDIR):$(HERE):$(HERE)/src
101
102 # Set the build configuration we use to check whether a reconfiguration is needed
103 CONFIG := $(BUILDDIR)/compile_commands.json
104
105 # Finalize CFLAGS
106 CFLAGS := -march=native -pipe ${CFLAGS} -Wunused -ftree-vectorize
107
108 # Finalize LDFLAGS
109 LDFLAGS := ${envLDFLAGS} ${LDFLAGS} -lpthread
110
111 # Ensure a sane default cgroup controller mode is set.
112 # if /etc/rc.conf has not set one, "unified" is probably the default.
113 ifeq (,$(CGDEFAULT))
114 CGDEFAULT := unified
115 endif
116
117 # -----------------------------------------------------------------------------
118 all: build
119
120 build: $(CONFIG)
121 +@(echo "make[2]: Entering directory '$(BUILDDIR)'")
122 +(cd $(BUILDDIR) && $(NINJA) $(NINJA_OPT))
123 +@(echo "make[2]: Leaving directory '$(BUILDDIR)'")
124
125 clean: $(CONFIG)
126 +@(echo "make[2]: Entering directory '$(BUILDDIR)'")
127 (cd $(BUILDDIR) && $(NINJA) $(NINJA_OPT) -t cleandead)
128 (cd $(BUILDDIR) && $(NINJA) $(NINJA_OPT) -t clean)
129 +@(echo "make[2]: Leaving directory '$(BUILDDIR)'")
130
131 cleanall:
132 +(BUILDDIR=$(HERE)/build $(MAKE) clean DEBUG=YES)
133 +(BUILDDIR=$(HERE)/build $(MAKE) clean DEBUG=NO )
134
135 full: build
136
137 install: build
138 +@(echo "make[2]: Entering directory '$(BUILDDIR)'")
139 (cd $(BUILDDIR) && DESTDIR=$(DESTDIR) $(NINJA) $(NINJA_OPT) install)
140 +@(echo "make[2]: Leaving directory '$(BUILDDIR)'")
141
142 justprint: $(CONFIG)
143 +(BUILDDIR=$(HERE)/build $(MAKE) all JUST_PRINT=YES)
144
145 loginctl: $(CONFIG)
146 +@(echo "make[2]: Entering directory '$(BUILDDIR)'")
147 (cd $(BUILDDIR) && $(NINJA) $(NINJA_OPT) $@)
148 +@(echo "make[2]: Leaving directory '$(BUILDDIR)'")
149
150 test: $(CONFIG)
151 +@(echo "make[2]: Entering directory '$(BUILDDIR)'")
152 (cd $(BUILDDIR) && $(NINJA) $(NINJA_OPT) $@)
153 +@(echo "make[2]: Leaving directory '$(BUILDDIR)'")
154
155 test-login: $(CONFIG)
156 +@(echo "make[2]: Entering directory '$(BUILDDIR)'")
157 (cd $(BUILDDIR) && $(NINJA) $(NINJA_OPT) $@)
158 +@(echo "make[2]: Leaving directory '$(BUILDDIR)'")
159
160 $(BUILDDIR):
161 +$(MKDIR) $@
162
163 $(CONFIG): $(BUILDDIR) $(MESON_LST)
164 @echo " Generating $@"
165 +test -f $@ && ( \
166 $(MESON) configure $(BUILDDIR) $(BASIC_OPT) \
167 ) || ( \
168 $(MESON) setup $(BUILDDIR) $(BASIC_OPT) \
169 --prefix="$(PREFIX)" \
170 --libdir="$(PREFIX)"/lib64 \
171 --libexecdir="$(ROOTPREFIX)"/lib64/elogind \
172 --localstatedir="$(ROOTPREFIX)"/var \
173 --sysconfdir="$(SYSCONFDIR)" \
174 --wrap-mode nodownload \
175 -Ddbuspolicydir="$(PREFIX)"/share/dbus-1/system-services \
176 -Ddbussystemservicedir="$(PREFIX)"/share/dbus-1/system-services \
177 -Dbashcompletiondir="$(PREFIX)"/share/bash-completion/completions \
178 -Dzshcompletiondir="$(PREFIX)"/share/zsh/site-functions \
179 -Dacl=$(USE_ACL) \
180 -Daudit=$(USE_AUDIT) \
181 -Dcgroup-controller=$(CGCONTROL) \
182 -Ddbus=enabled \
183 -Ddefault-hierarchy=$(CGDEFAULT) \
184 -Defi=$(USE_EFI) \
185 -Dhtml=$(USE_HTML) \
186 -Dman=$(USE_MAN) \
187 -Dpam=enabled \
188 -Dselinux=$(USE_SELINUX) \
189 -Dsmack=$(USE_SMACK) \
190 -Dutmp=$(USE_UTMP) \
191 -Dxenctrl=$(USE_XENCTRL) \
192 -Dmode=$(BUILDMODE) \
193 )
194
195 .DEFAULT: all
196 #endif // 0