Skip to content

Commit 767d17e

Browse files
committed
make: lets also make bpf program outside of container
Signed-off-by: Djalal Harouni <[email protected]>
1 parent 3f81407 commit 767d17e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Makefile

+5-4
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ clean: clean-in-container clean-images ## Remove bpflock docker images including
5151
##@ Inside container targets
5252

5353
# This builds inside container
54-
.PHONY: container-bpf-tools
55-
container-bpf-tools: pre-build | defined-BASE_IMAGE ## Builds bpf tools using libbpf inside container.
56-
$(info MAKE: start building cbpf tools inside container)
54+
.PHONY: bpf-programs
55+
bpf-programs: pre-build ## Builds bpf programs using libbpf (will run inside container).
56+
$(info MAKE: start building bpf programs)
5757
$(info MAKE -C bpf all)
5858
@$(MAKE) -C $(shell pwd)/bpf all
5959

@@ -64,8 +64,9 @@ bpflock-daemon: pre-build | defined-BASE_IMAGE ## Build bpflock daemon inside co
6464
@$(MAKE) -C $(shell pwd)/cmd all
6565

6666
.PHONY: clean-in-container
67-
clean-in-container: ## Clean bpf-tools build directories.
67+
clean-in-container: ## Clean bpf programs build directories.
6868
@$(RM) -R $(BUILD)
69+
@$(MAKE) -C $(shell pwd)/bpf clean
6970
$(info Clean bpf-tools build directories)
7071

7172
##@ Code checks and tests

bpf/Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ $(BUILDLIB) $(BUILDLIB)/libbpf:
4646
$(Q)mkdir -p $@
4747

4848
$(LIBBPF_SRC):
49-
test -d $(LIBBPF_SRC) || (echo "Error: libbpf sources are missing - please do: 'git submodule update --init'" ; false)
49+
test -d $(LIBBPF_SRC) || (echo "Error: libbpf sources are missing - please do: 'git submodule update --init --recursive'" ; false)
5050

5151
# Build libbpf.a
5252
$(LIBBPF_OBJ): $(LIBBPF_SRC) $(wildcard $(LIBBPF_SRC)/*.[ch]) | $(BUILDLIB) $(BUILDLIB)/libbpf
@@ -75,6 +75,11 @@ $(BUILD)/%.skel.h: $(BUILD)/%.bpf.o | $(BUILD)
7575
$(call msg,GEN-SKEL,$@)
7676
$(Q)$(BPFTOOL) gen skeleton $< > $@
7777

78+
.PHONY: clean
79+
clean:
80+
@$(RM) -R $(BUILD)
81+
82+
.PHONY: install
7883
install: $(TARGETS)
7984
$(call msg, INSTALL bpf programs)
8085
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(BINDIR)

images/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ WORKDIR /go/src/github.com/linux-lock/bpflock
3636
COPY . .
3737

3838
# Make bpf tools and bpflock daemon
39-
RUN make container-bpf-tools
39+
RUN make bpf-programs
4040
RUN make bpflock-daemon
4141

4242
# Generate runtime image

0 commit comments

Comments
 (0)