summaryrefslogtreecommitdiff
path: root/Makefile
blob: 8552afb9d3aa78c587bfd4716f8932a4aa163c22 (plain)
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
43
44
45
46
47
48
49
50
51
52
ifeq ($(OS),Windows_NT)
	detected_OS := Windows
else
	detected_OS := $(shell uname -s)
endif

# Creates the bin folder for build artifacts
build/{bin,lib}:
	@mkdir -p build/{lib,bin}

# Builds all rust targets
build/lib/liball_in_one.a build/bin/{cache,gateway,ratelimit,rest,webhook}{,.exe}: build/{bin,lib}
	@echo "Building rust project"
	cargo build --release
	@cp target/release/liball_in_one.a build/lib
	@cp target/release/{cache,gateway,ratelimit,rest,webhook}{,.exe} build/bin

build/lib/liball_in_one.a build/bin/{cache,gateway,ratelimit,rest,webhook}: build/{bin,lib}
	@echo "Building rust project"
	cargo build --release
	@cp target/release/liball_in_one.a build/lib
	@cp target/release/{cache,gateway,ratelimit,rest,webhook} build/bin

# Generated by a rust build script.
internal/pkg/all-in-one/all-in-one.h: build/lib/liball_in_one.a

# All in one program build
build/bin/nova: build/lib/liball_in_one.a internal/pkg/all-in-one/all-in-one.h
	go build -a -ldflags '-s' -o build/bin/nova cmd/nova/nova.go

ifeq ($(detected_OS),Windows)
	all: build/bin/{cache,gateway,ratelimit,rest,webhook}{,.exe} build/bin/nova
endif
ifeq ($(detected_OS),Linux)
	all: build/bin/{cache,gateway,ratelimit,rest,webhook} build/bin/nova
endif
ifeq ($(detected_OS),Darwin)
	all: build/bin/{cache,gateway,ratelimit,rest,webhook} build/bin/nova
endif

docker-images:
	docker-compose build

docker-push:
	docker-compose push

rust-test:
	cargo test

test: rust-test

.PHONY: all docker-images docker-push test rust-test