-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (37 loc) · 953 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
43
44
45
46
47
48
49
50
# Directories
SERVER_DIR := server
CLIENT_DIR := client
DIST_DIR := dist
PUBLIC_DIR := $(DIST_DIR)/public
BINARY_NAME := countersign
DATASET_DIR := dataset
# Go build flags
GOFLAGS := -v
# NPM command (use npm or yarn as needed)
NPM := npm
.PHONY: all build clean server client copy-dataset
all: clean build
build: client server copy-dataset
clean:
rm -rf $(DIST_DIR)
cd $(CLIENT_DIR) && $(NPM) run clean
server:
mkdir -p $(DIST_DIR)
cd $(SERVER_DIR) && go build $(GOFLAGS) -o ../$(DIST_DIR)/$(BINARY_NAME) main.go
client:
cd $(CLIENT_DIR) && $(NPM) install
cd $(CLIENT_DIR) && $(NPM) run build
mkdir -p $(PUBLIC_DIR)
rm -rf $(PUBLIC_DIR)/*
mv $(CLIENT_DIR)/dist/* $(PUBLIC_DIR)/
copy-dataset:
mkdir -p $(DIST_DIR)
cp -r $(DATASET_DIR) $(DIST_DIR)/
run: build
cd $(DIST_DIR) && ./$(BINARY_NAME)
dev:
make -j2 dev-client dev-server
dev-client:
cd $(CLIENT_DIR) && $(NPM) run dev
dev-server:
cd $(SERVER_DIR) && go run main.go