-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
37 lines (32 loc) · 920 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
PACKAGE=github.com/aureleoules/epitaf
MAIN_PACKAGE=$(PACKAGE)
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
BUILD_DIRECTORY=./
BINARY_NAME=epitaf
STATIC_ARGS=CGO_ENABLED=0 GOOS=linux GOARCH=amd64
VERSION=`git describe --always`
COMPILE_FLAGS=-ldflags="-w -s -X $(PACKAGE)/cmd.version=$(VERSION)"
.PHONY: prep build
all: prep build
prep:
@mkdir -p build
swag:
@echo "Building swagger documentation..."
@swag init --parseDependency
@echo "Built swagger documentation."
build:
@echo "Compiling $(PACKAGE)..."
@$(STATIC_ARGS) $(GOBUILD) -o $(BUILD_DIRECTORY)/$(BINARY_NAME) $(MAIN_PACKAGE)
@echo "Compiled $(BINARY_NAME)."
prod:
@echo "Compiling $(PACKAGE) for production..."
@$(STATIC_ARGS) $(GOBUILD) -o $(BUILD_DIRECTORY)/$(BINARY_NAME) -v $(COMPILE_FLAGS) $(MAIN_PACKAGE)
@echo "Compiled $(BINARY_NAME)."
test:
$(GOTEST) -v ./...
clean:
@$(GOCLEAN)
@rm -f $(BINARY_NAME)