-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 1.07 KB
/
Makefile
File metadata and controls
44 lines (34 loc) · 1.07 KB
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
# Define directories and files
BIN_DIR := ./bin
DATA_DIR := $(BIN_DIR)/data
OUTPUT := $(BIN_DIR)/rrserver
FIELDS_DAT := ./data/fields.dat
FUNCTIONS_DAT := ./data/functions.dat
DOCKER_COMPOSE := ./.docker/docker-compose.yml
# Phony targets
.PHONY: run build clean docker-up docker-down
# Default target
run: build
@$(OUTPUT)
docker-up:
@docker compose -f $(DOCKER_COMPOSE) up -d
docker-down:
@docker compose -f $(DOCKER_COMPOSE) down
build: clean | $(BIN_DIR) $(DATA_DIR)
@export GOOS=linux
@export GOARCH=amd64
@go build -o $(OUTPUT) ./cmd/rrserver
@[ -f $(DATA_DIR)/fields.dat ] || cp $(FIELDS_DAT) $(DATA_DIR)
@[ -f $(DATA_DIR)/functions.dat ] || cp $(FUNCTIONS_DAT) $(DATA_DIR)
clean:
@[ ! -f $(OUTPUT) ] || rm -f $(OUTPUT)
# @[ ! -f $(DATA_DIR)/fields.dat ] || rm -f $(DATA_DIR)/fields.dat
# @[ ! -f $(DATA_DIR)/functions.dat ] || rm -f $(DATA_DIR)/functions.dat
# Directory targets
$(BIN_DIR):
@mkdir -p $(BIN_DIR)
$(DATA_DIR): | $(BIN_DIR)
@mkdir -p $(DATA_DIR)
# Clean all
clean-all:
@[ ! -d $(BIN_DIR) ] || rm -rf $(BIN_DIR)