Skip to content

Commit a08bb55

Browse files
committed
Makefile: do not rebuild if nothing changed
If the src has not changed there is no need to rebuild. This removes the -debug suffix from the binary if build with debug set, I doubt anyone actually uses this and we need the same name for the bin/netavark target to actually work. This is even better because now you could build a debug binary and run the test with it without changing the test path manually. Fixes #1178 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
1 parent 4ac1563 commit a08bb55

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ CARGO ?= cargo
2929
CARGO_TARGET_DIR ?= targets
3030
export CARGO_TARGET_DIR # 'cargo' is sensitive to this env. var. value.
3131

32+
SOURCES = src/** Cargo.toml Cargo.lock
33+
3234
ifdef debug
3335
$(info debug is $(debug))
3436
# These affect both $(CARGO_TARGET_DIR) layout and contents
@@ -50,10 +52,13 @@ $(CARGO_TARGET_DIR):
5052
mkdir -p $@
5153

5254
.PHONY: build
53-
build: bin $(CARGO_TARGET_DIR)
55+
build: bin/netavark
56+
57+
bin/netavark: $(SOURCES) bin $(CARGO_TARGET_DIR)
5458
$(CARGO) build $(release)
55-
cp $(CARGO_TARGET_DIR)/$(profile)/netavark bin/netavark$(if $(debug),.debug,)
56-
cp $(CARGO_TARGET_DIR)/$(profile)/netavark-dhcp-proxy-client bin/netavark-dhcp-proxy-client$(if $(debug),.debug,)
59+
cp $(CARGO_TARGET_DIR)/$(profile)/netavark bin/netavark
60+
cp $(CARGO_TARGET_DIR)/$(profile)/netavark-dhcp-proxy-client bin/netavark-dhcp-proxy-client
61+
5762

5863
.PHONY: examples
5964
examples: bin $(CARGO_TARGET_DIR)

0 commit comments

Comments
 (0)