-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
41 lines (40 loc) · 912 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
YARNCMD=yarn
YARNINSTALL=$(YARNCMD) install
YARNBUILD=$(YARNCMD) build
BUILD_FOLDER=build
BINARY_NAME=uploadexpress
BINARY_UNIX=$(BINARY_NAME)_unix
FRONT_PATH=www
SERVER_MAIN_PATH=cmd/server/main.go
TEMPLATES_PATH=templates
FRONT_BUILD_FOLDER=$(FRONT_PATH)/build
FRONT_DESTINATION=$(BUILD_FOLDER)/front
all: test build
build:
$(GOBUILD) -o $(BUILD_FOLDER)/$(BINARY_NAME) -v $(SERVER_MAIN_PATH)
cd $(FRONT_PATH); \
$(YARNINSTALL); \
$(YARNBUILD);
cp -R $(FRONT_BUILD_FOLDER) $(FRONT_DESTINATION)
cp -R $(TEMPLATES_PATH) $(BUILD_FOLDER)
if [ -e .env ]; \
then cp .env build; \
fi
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -rf $(BUILD_FOLDER)
rm -rf $(FRONT_BUILD_FOLDER)
run:
$(GOBUILD) -o $(BUILD_FOLDER)/$(BINARY_NAME) -v ./...
./$(BINARY_NAME)
deps:
$(GOGET) ./...
.PHONY: build