Nova/Makefile

44 lines
947 B
Makefile
Raw Normal View History

2023-01-16 12:43:10 +01:00
EXTENSION :=
ifeq ($(OS),Windows_NT)
EXTENSION += .exe
endif
dir_guard=@mkdir -p $(@D)
PROJECTS = $(shell find exes/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n')
BINS=$(PROJECTS:%=build/bin/%$(EXTENSION))
# Static libraries
target/release/lib%.a:
cargo build --release -p $*
# Executables
target/release/%$(EXTENSION):
cargo build --release -p $*
# Copy static libraries
build/lib/%: target/release/%
$(dir_guard)
cp target/release/$* build/lib
# Copy executables
build/bin/%$(EXTENSION): target/release/%$(EXTENSION)
$(dir_guard)
cp target/release/$*$(EXTENSION) build/lib/
# All in one binary
build/bin/nova$(EXTENSION): build/lib/liball_in_one.a
$(dir_guard)
2023-01-15 23:03:18 +01:00
go build -a -ldflags '-s' -o build/bin/nova cmd/nova/nova.go
2023-01-16 12:43:10 +01:00
all: $(BINS) build/bin/nova$(EXTENSION)
2023-01-13 19:35:46 +01:00
2023-01-16 12:43:10 +01:00
clean:
rm -rf build
rm -rf $(PROJECTS:%=target/release/%$(EXTENSION))
rm -rf target/release/liball_in_one.a
2023-01-13 19:35:46 +01:00
2023-01-16 12:43:10 +01:00
test:
2023-01-13 19:35:46 +01:00
cargo test
2023-01-16 12:43:10 +01:00
go test
2023-01-13 19:35:46 +01:00
2023-01-16 12:43:10 +01:00
.PHONY: clean all test