summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 3 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 3dcd788..dc57dfa 100644
--- a/Makefile
+++ b/Makefile
@@ -19,16 +19,16 @@ FUZZ_TIME ?= 30s
all: $(BINARY)
# Build the Go binary
+# Use a temporary build file to ensure we don't leave a partially-built or stale binary
$(BINARY): $(LAUNCHER_BIN)
- CGO_ENABLED=$(CGO_ENABLED) go build $(GO_BUILD_FLAGS) -o $(BINARY) cmd/wg-wrap/main.go
+ CGO_ENABLED=$(CGO_ENABLED) go build $(GO_BUILD_FLAGS) -o $(BINARY).tmp cmd/wg-wrap/main.go && mv $(BINARY).tmp $(BINARY)
# Build the embedded C launcher binary
$(LAUNCHER_BIN): $(LAUNCHER_SRC)
$(CC) $(CFLAGS) $(LAUNCHER_SRC) -o $(LAUNCHER_BIN)
# Run tests
-test: clean
- $(MAKE) $(BINARY)
+test: $(BINARY)
@echo "Running tests with WG_WRAP_BIN=$(shell pwd)/$(BINARY)"
WG_WRAP_BIN=$(shell pwd)/$(BINARY) go test -v -race ./...