Skip to contentSkip to conversation

bpf: Rebuild bpf.o for any dependency update

PATCH Applied Mickaël Salaün 2 participants 2 messages Feb 11, 2017 – Feb 15, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Rebuild bpf.o for any dependency update

This is needed to force a rebuild of bpf.o when one of its dependencies (e.g. uapi/linux/bpf.h) is updated.

Add a phony target.

Cc Alexei Starovoitov <[email protected]>
Cc Daniel Borkmann <[email protected]>
Cc David S. Miller <[email protected]>
Cc Wang Nan <[email protected]>
---
 tools/testing/selftests/bpf/Makefile | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/Makefile +13 -2
index a35f564f66a1..c7816fe60feb 100644
@@ -1,13 +1,24 @@
-CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I../../../lib
+LIBDIR := ../../../lib
+BPFOBJ := $(LIBDIR)/bpf/bpf.o
+
+CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR)
 
 test_objs = test_verifier test_tag test_maps test_lru_map test_lpm_map
 
 TEST_PROGS := $(test_objs) test_kmod.sh
 TEST_FILES := $(test_objs)
 
+.PHONY: all clean force
+
 all: $(test_objs)
 
-$(test_objs): ../../../lib/bpf/bpf.o
+# force a rebuild of BPFOBJ when its dependencies are updated
+force:
+
+$(BPFOBJ): force
+	$(MAKE) -C $(dir $(BPFOBJ))
+
+$(test_objs): $(BPFOBJ)
 
 include ../lib.mk
 
Signature · 1 line
2.11.0