-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
42 lines (33 loc) · 965 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
EXTENSION :=
ifeq ($(OS),Windows_NT)
EXTENSION += .exe
endif
PROJECTS = $(shell find exes/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n')
# Static libraries
target/release/lib%.a: libs/%
cargo build --release -p $*
# Executables
target/release/%$(EXTENSION):
cargo build --release -p $*
# Copy static libraries
build/lib/%: target/release/%
@mkdir -p build/lib
cp target/release/$* build/lib/$*
# Copy executables
build/bin/%$(EXTENSION): target/release/%$(EXTENSION)
@mkdir -p build/bin
cp target/release/$*$(EXTENSION) build/bin/$*$(EXTENSION)
# All in one binary
build/bin/nova$(EXTENSION): build/lib/liball_in_one.a
@mkdir -p build/bin
go build -a -ldflags '-s' -o build/bin/nova cmd/nova/nova.go
BINS=$(PROJECTS:%=build/bin/%$(EXTENSION))
all: $(BINS) build/bin/nova$(EXTENSION)
clean:
rm -rf build
rm -rf $(PROJECTS:%=target/release/%$(EXTENSION))
rm -rf target/release/liball_in_one.a
test:
cargo test
go test
.PHONY: clean all test