summaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2020-05-04 18:39:35 +0200
committerDavid Lamparter <equinox@diac24.net>2020-05-05 14:39:12 +0200
commit8fb40377decf45a23d6eefc9ba803b8ff40557d0 (patch)
treeb01fcaa751b72f2761356f4caafef65e63f3e934 /Makefile.am
parenttools: frr-llvm-cg (diff)
downloadfrr-8fb40377decf45a23d6eefc9ba803b8ff40557d0.tar.xz
frr-8fb40377decf45a23d6eefc9ba803b8ff40557d0.zip
build: add LLVM bitcode targets
Just an easy way to produce LLVM .bc (bitcode) files. Not used during normal builds. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am32
1 files changed, 30 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index f99f05ed5..f37ae628c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,6 +93,7 @@ EXTRA_PROGRAMS =
BUILT_SOURCES =
CLEANFILES =
DISTCLEANFILES =
+SUFFIXES =
examplesdir = $(exampledir)
@@ -232,12 +233,39 @@ EXTRA_DIST += \
vrrpd/Makefile \
# end
-clean-local: clean-python
-.PHONY: clean-python
+AM_V_LLVM_BC = $(am__v_LLVM_BC_$(V))
+am__v_LLVM_BC_ = $(am__v_LLVM_BC_$(AM_DEFAULT_VERBOSITY))
+am__v_LLVM_BC_0 = @echo " LLVM.BC " $@;
+am__v_LLVM_BC_1 =
+
+AM_V_LLVM_LD = $(am__v_LLVM_LD_$(V))
+am__v_LLVM_LD_ = $(am__v_LLVM_LD_$(AM_DEFAULT_VERBOSITY))
+am__v_LLVM_LD_0 = @echo " LLVM.LD " $@;
+am__v_LLVM_LD_1 =
+
+SUFFIXES += .lo.bc .o.bc
+
+.o.o.bc:
+ $(AM_V_LLVM_BC)$(COMPILE) -emit-llvm -c -o $@ $(patsubst %.o,%.c,$<)
+.lo.lo.bc:
+ $(AM_V_LLVM_BC)$(COMPILE) -emit-llvm -c -o $@ $(patsubst %.lo,%.c,$<)
+
+%.cg.json: %.bc tools/frr-llvm-cg
+ tools/frr-llvm-cg -o $@ $<
+
+# <lib>.la.bc, <lib>.a.bc and <daemon>.bc targets are generated by
+# python/makefile.py
+LLVM_LINK = llvm-link-$(llvm_version)
+
+clean-local: clean-python clean-llvm-bitcode
+.PHONY: clean-python clean-llvm-bitcode
clean-python:
find . -name __pycache__ -o -name .pytest_cache | xargs rm -rf
find . -name "*.pyc" -o -name "*_clippy.c" | xargs rm -f
+clean-llvm-bitcode:
+ find . -name "*.bc" -o -name "*.cg.json" | xargs rm -f
+
redistclean:
$(MAKE) distclean CONFIG_CLEAN_FILES="$(filter-out $(EXTRA_DIST), $(CONFIG_CLEAN_FILES))"