]> git.proxmox.com Git - mirror_frr.git/blob - Makefile.am
build: properly split CFLAGS from AC_CFLAGS
[mirror_frr.git] / Makefile.am
1 ## Process this file with automake to produce Makefile.in.
2
3 AUTOMAKE_OPTIONS = subdir-objects 1.12
4 ACLOCAL_AMFLAGS = -I m4
5
6 AM_CFLAGS = \
7 $(AC_CFLAGS) \
8 $(LIBYANG_CFLAGS) \
9 $(SQLITE3_CFLAGS) \
10 $(UNWIND_CFLAGS) \
11 $(SAN_FLAGS) \
12 $(WERROR) \
13 # end
14 AM_CPPFLAGS = \
15 -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/lib \
16 -I$(top_builddir) \
17 $(LUA_INCLUDE) \
18 # end
19 AM_LDFLAGS = \
20 -export-dynamic \
21 $(AC_LDFLAGS) \
22 $(SAN_FLAGS) \
23 # end
24 DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE)
25
26 AR_FLAGS = @AR_FLAGS@
27 ARFLAGS = @ARFLAGS@
28 RANLIB = @RANLIB@
29
30 # these two targets are provided to easily grab autoconf/Makefile variables
31 # you can use either:
32 # eval `make VARFD=3 shvar-CFLAGS 3>&1 1>&2`
33 # CFLAGS="`make VARFD=3 var-CFLAGS 3>&1 1>&2`"
34 # where the former can be used to set several variables at once. Note the
35 # fd redirections -- this is to prevent garbage from make rebuilding other
36 # targets from causing issues.
37 .PHONY: shvar-% var-%
38 VARFD ?= 1
39 shvar-%:
40 @echo "$*=\"$($*)\"" >&$(VARFD)
41 var-%:
42 @echo "$($*)" >&$(VARFD)
43
44 if ONLY_CLIPPY
45 .DEFAULT_GOAL := clippy-only
46 endif
47 clippy-only: Makefile lib/clippy config.h
48 .PHONY: clippy-only
49
50 # overwriting these vars breaks cross-compilation. let's be helpful and warn.
51 #
52 # note: "#AUTODERP# " will be removed from Makefile by configure. These are
53 # GNU make directives & automake will f*ck them up by trying to process them
54 # as automake directives.
55 #
56 #AUTODERP# null=
57 #AUTODERP# SPACE=$(null) $(null)
58 #AUTODERP# mkcheck_CC = $(findstring $(SPACE)CC=, $(SPACE)$(MAKEOVERRIDES))
59 #AUTODERP# mkcheck_CFLAGS = $(findstring $(SPACE)CFLAGS=, $(SPACE)$(MAKEOVERRIDES))
60 #AUTODERP# mkcheck_CPPFLAGS = $(findstring $(SPACE)CPPFLAGS=,$(SPACE)$(MAKEOVERRIDES))
61 #AUTODERP# mkcheck_CCLD = $(findstring $(SPACE)CCLD=, $(SPACE)$(MAKEOVERRIDES))
62 #AUTODERP# mkcheck_LD = $(findstring $(SPACE)LD=, $(SPACE)$(MAKEOVERRIDES))
63 #AUTODERP# mkcheck_LDFLAGS = $(findstring $(SPACE)LDFLAGS=, $(SPACE)$(MAKEOVERRIDES))
64 #AUTODERP# #
65 #AUTODERP# ifneq ($(mkcheck_CC),)
66 #AUTODERP# $(warning WARNING: you have overwritten the "CC" variable on the make command line.)
67 #AUTODERP# endif
68 #AUTODERP# ifneq ($(mkcheck_CFLAGS),)
69 #AUTODERP# $(warning WARNING: you have overwritten the "CFLAGS" variable on the make command line.)
70 #AUTODERP# endif
71 #AUTODERP# ifneq ($(mkcheck_CPPFLAGS),)
72 #AUTODERP# $(warning WARNING: you have overwritten the "CPPFLAGS" variable on the make command line.)
73 #AUTODERP# endif
74 #AUTODERP# ifneq ($(mkcheck_CCLD),)
75 #AUTODERP# $(warning WARNING: you have overwritten the "CCLD" variable on the make command line.)
76 #AUTODERP# endif
77 #AUTODERP# ifneq ($(mkcheck_LD),)
78 #AUTODERP# $(warning WARNING: you have overwritten the "LD" variable on the make command line.)
79 #AUTODERP# endif
80 #AUTODERP# ifneq ($(mkcheck_LDFLAGS),)
81 #AUTODERP# $(warning WARNING: you have overwritten the "LDFLAGS" variable on the make command line.)
82 #AUTODERP# endif
83 #AUTODERP# #
84 #AUTODERP# ifneq ($(mkcheck_CC)$(mkcheck_CFLAGS)$(mkcheck_CPPFLAGS)$(mkcheck_CCLD)$(mkcheck_LD)$(mkcheck_LDFLAGS),)
85 #AUTODERP# $(warning ------)
86 #AUTODERP# $(warning While overwriting these variables works most of the time, it is not recommended and can cause confusing build errors.)
87 #AUTODERP# $(warning This is especially problematic when cross-compiling, since tools that run on the build system during the build process will not be compiled correctly.)
88 #AUTODERP# $(warning All of these variables should be supplied to 'configure', and they will be remembered and correctly applied during 'make'.)
89 #AUTODERP# $(warning ------)
90 #AUTODERP# endif
91
92 EXTRA_DIST =
93 EXTRA_PROGRAMS =
94 BUILT_SOURCES =
95 CLEANFILES =
96 DISTCLEANFILES =
97 SUFFIXES =
98
99 examplesdir = $(exampledir)
100
101 bin_PROGRAMS =
102 sbin_PROGRAMS =
103 sbin_SCRIPTS =
104 noinst_PROGRAMS =
105 noinst_HEADERS =
106 noinst_LIBRARIES =
107 nodist_noinst_DATA =
108 lib_LTLIBRARIES =
109 module_LTLIBRARIES =
110 pkginclude_HEADERS =
111 nodist_pkginclude_HEADERS =
112 dist_examples_DATA =
113 dist_yangmodels_DATA =
114 man_MANS =
115 vtysh_scan =
116 vtysh_daemons =
117 clippy_scan =
118
119 ## libtool, the self-made GNU scourge
120 ## ... this should fix relinking
121 ## ... and AUTOMAKE_DUMMY is needed to prevent automake from treating this
122 ## as overriding the normal targets...
123 $(AUTOMAKE_DUMMY)install-moduleLTLIBRARIES: install-libLTLIBRARIES
124 $(AUTOMAKE_DUMMY)install-binPROGRAMS: install-libLTLIBRARIES
125 $(AUTOMAKE_DUMMY)install-sbinPROGRAMS: install-libLTLIBRARIES
126
127 include doc/subdir.am
128 include doc/user/subdir.am
129 include doc/manpages/subdir.am
130 include doc/developer/subdir.am
131 include include/subdir.am
132 include lib/subdir.am
133 include mlag/subdir.am
134 include zebra/subdir.am
135 include watchfrr/subdir.am
136 include qpb/subdir.am
137 include fpm/subdir.am
138 include grpc/subdir.am
139 include tools/subdir.am
140
141 include bgpd/subdir.am
142 include bgpd/rfp-example/librfp/subdir.am
143 include bgpd/rfp-example/rfptest/subdir.am
144 include ripd/subdir.am
145 include ripngd/subdir.am
146 include ospfd/subdir.am
147 include ospf6d/subdir.am
148 include ospfclient/subdir.am
149 include isisd/subdir.am
150 include nhrpd/subdir.am
151 include ldpd/subdir.am
152 include babeld/subdir.am
153 include eigrpd/subdir.am
154 include sharpd/subdir.am
155 include pimd/subdir.am
156 include pbrd/subdir.am
157 include staticd/subdir.am
158 include bfdd/subdir.am
159 include yang/subdir.am
160 include yang/libyang_plugins/subdir.am
161 include vrrpd/subdir.am
162 include pceplib/subdir.am
163 include pceplib/test/subdir.am
164 include pathd/subdir.am
165
166 include vtysh/subdir.am
167 include tests/subdir.am
168 include tests/topotests/subdir.am
169
170 if PKGSRC
171 rcdir=@pkgsrcrcdir@
172 rc_SCRIPTS = \
173 pkgsrc/bgpd.sh \
174 pkgsrc/ospf6d.sh \
175 pkgsrc/ospfd.sh \
176 pkgsrc/ripd.sh \
177 pkgsrc/ripngd.sh \
178 pkgsrc/zebra.sh \
179 # end
180 endif
181
182 EXTRA_DIST += \
183 aclocal.m4 \
184 README.md \
185 m4/README.txt \
186 m4/libtool-whole-archive.patch \
187 config.version \
188 changelog-auto \
189 changelog-auto.in \
190 \
191 python/clidef.py \
192 python/clippy/__init__.py \
193 python/clippy/elf.py \
194 python/clippy/uidhash.py \
195 python/makevars.py \
196 python/makefile.py \
197 python/tiabwarfo.py \
198 python/xrelfo.py \
199 python/test_xrelfo.py \
200 python/runtests.py \
201 \
202 python/xrefstructs.json \
203 \
204 redhat/frr.logrotate \
205 redhat/frr.pam \
206 redhat/frr.spec \
207 \
208 snapcraft/snapcraft.yaml \
209 snapcraft/README.snap_build.md \
210 snapcraft/README.usage.md \
211 snapcraft/extra_version_info.txt \
212 snapcraft/scripts \
213 snapcraft/defaults \
214 snapcraft/helpers \
215 snapcraft/snap \
216 babeld/Makefile \
217 bgpd/Makefile \
218 bgpd/rfp-example/librfp/Makefile \
219 bgpd/rfp-example/rfptest/Makefile \
220 doc/Makefile \
221 doc/developer/Makefile \
222 doc/manpages/Makefile \
223 doc/user/Makefile \
224 eigrpd/Makefile \
225 fpm/Makefile \
226 grpc/Makefile \
227 isisd/Makefile \
228 ldpd/Makefile \
229 lib/Makefile \
230 nhrpd/Makefile \
231 ospf6d/Makefile \
232 ospfclient/Makefile \
233 ospfd/Makefile \
234 pbrd/Makefile \
235 pimd/Makefile \
236 qpb/Makefile \
237 ripd/Makefile \
238 ripngd/Makefile \
239 staticd/Makefile \
240 tests/Makefile \
241 tools/Makefile \
242 vtysh/Makefile \
243 watchfrr/Makefile \
244 zebra/Makefile \
245 vrrpd/Makefile \
246 # end
247
248 AM_V_LLVM_BC = $(am__v_LLVM_BC_$(V))
249 am__v_LLVM_BC_ = $(am__v_LLVM_BC_$(AM_DEFAULT_VERBOSITY))
250 am__v_LLVM_BC_0 = @echo " LLVM.BC " $@;
251 am__v_LLVM_BC_1 =
252
253 AM_V_LLVM_LD = $(am__v_LLVM_LD_$(V))
254 am__v_LLVM_LD_ = $(am__v_LLVM_LD_$(AM_DEFAULT_VERBOSITY))
255 am__v_LLVM_LD_0 = @echo " LLVM.LD " $@;
256 am__v_LLVM_LD_1 =
257
258 SUFFIXES += .lo.bc .o.bc
259
260 .o.o.bc:
261 $(AM_V_LLVM_BC)$(COMPILE) -emit-llvm -c -o $@ $(patsubst %.o,%.c,$<)
262 .lo.lo.bc:
263 $(AM_V_LLVM_BC)$(COMPILE) -emit-llvm -c -o $@ $(patsubst %.lo,%.c,$<)
264
265 %.cg.json: %.bc tools/frr-llvm-cg
266 tools/frr-llvm-cg -o $@ $<
267 %.cg.dot: %.cg.json
268 $(PYTHON) $(top_srcdir)/python/callgraph-dot.py $< $@
269 %.cg.svg: %.cg.dot
270 @echo if the following command fails, you need to install graphviz.
271 @echo also, the output is nondeterministic. run it multiple times and use the nicest output.
272 @echo tuning parameters may yield nicer looking graphs as well.
273 fdp -GK=0.7 -Gstart=42231337 -Gmaxiter=2000 -Elen=2 -Gnodesep=1.5 -Tsvg -o$@ $<
274 # don't delete intermediaries
275 .PRECIOUS: %.cg.json %.cg.dot
276
277 # <lib>.la.bc, <lib>.a.bc and <daemon>.bc targets are generated by
278 # python/makefile.py
279 LLVM_LINK = llvm-link-$(llvm_version)
280
281 clean-local: clean-python clean-llvm-bitcode
282 .PHONY: clean-python clean-llvm-bitcode
283 clean-python:
284 find . -name __pycache__ -o -name .pytest_cache | xargs rm -rf
285 find . -name "*.pyc" -o -name "*_clippy.c" | xargs rm -f
286
287 clean-llvm-bitcode:
288 find . -name "*.bc" -o -name "*.cg.json" -o -name "*.cg.dot" -o -name "*.cg.svg" | xargs rm -f
289
290 redistclean:
291 $(MAKE) distclean CONFIG_CLEAN_FILES="$(filter-out $(EXTRA_DIST), $(CONFIG_CLEAN_FILES))"
292
293 indent:
294 tools/indent.py `find sharpd bgpd eigrpd include isisd lib nhrpd ospf6d ospfd pimd qpb ripd vtysh zebra -name '*.[ch]' | grep -v include/linux`
295
296 if HAVE_GCOV
297
298 coverage: check
299 @ find . -name '*.o' -exec gcov {} \;
300
301 yorn:
302 @ echo "OK to upload coverage to https://coverage.io [y/N]:"
303 @ read yn; test "$$yn" = "y"
304
305 upload-check-coverage:
306 @ if [ "x${COMMIT}" = "x" ]; then echo "COMMIT required"; exit 1; fi
307 @ if [ "x${TOKEN}" = "x" ]; then echo "TOKEN required"; exit 1; fi
308 curl -s https://codecov.io/bash | bash -s - -C ${COMMIT} -t ${TOKEN}
309
310 force-check-coverage: coverage upload-check-coverage
311
312 check-coverage: coverage yorn upload-check-coverage
313
314 endif