makefile: add a makefile to the template

pull/16/head
William Findlay 4 years ago
parent 509073c454
commit 66aaa7f2a6
No known key found for this signature in database
GPG Key ID: 7162B44E9E560373

@ -0,0 +1,44 @@
CARGO = cargo
RUNNER = sudo -E
RUN_ARGS = # User provided args could go here, or be specified at cmd line
DEBUG = target/debug/{{project-name}}
RELEASE = target/release/{{project-name}}
DEBUG_BPF = target/bpfel-unknown-none/debug/{{project-name}}
RELEASE_BPF = target/bpfel-unknown-none/release/{{project-name}}
USER_SRCS = $(wildcard {{project-name}}-common/**/*)
COMMON_SRCS = $(wildcard {{project-name}}/**/*)
BPF_SRCS = $(wildcard {{project-name}}-ebpf/**/*)
.PHONY: build
build: $(DEBUG)
.PHONY: run
run: $(DEBUG)
$(RUNNER) ./$(DEBUG) --path $(DEBUG_BPF) $(RUN_ARGS)
.PHONY: build-release
build-release: $(RELEASE)
.PHONY: run-release
run-release: $(RELEASE)
$(RUNNER) ./$(RELEASE) --path $(RELEASE_BPF) $(RUN_ARGS)
.PHONY: clean
clean:
$(CARGO) clean
$(DEBUG): $(DEBUG_BPF) $(USER_SRCS) $(COMMON_SRCS)
$(CARGO) build
$(DEBUG_BPF): $(BPF_SRCS) $(COMMON_SRCS)
$(CARGO) xtask build-ebpf
$(RELEASE): $(RELEASE_BPF) $(USER_SRCS) $(COMMON_SRCS)
$(CARGO) build --release
$(RELEASE_BPF): $(BPF_SRCS) $(COMMON_SRCS)
$(CARGO) xtask build-ebpf --release
Loading…
Cancel
Save