-
Notifications
You must be signed in to change notification settings - Fork 113
/
Makefile
43 lines (37 loc) · 1.23 KB
/
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
# only for linux and macos
BINARY_NAME := anqicms
GO := go
GOOS := $(shell $(GO) env GOOS)
ifeq ($(version),)
version := $(shell git describe --tags --always --dirty="-dev")
endif
LDFLAGS := -ldflags '-w -s'
.PHONY: all clean tidy build archive
all: clean tidy build archive
clean:
@echo "🧹 Cleaning..."
@rm -rf ./release
tiny:
@echo "🧼 Tidying up dependencies..."
$(GO) mod tidy
$(GO) mod vendor
build:
@echo "🔨 Building for current platform..."
mkdir -p -v ./release/$(GOOS)/cache
mkdir -p -v ./release/$(GOOS)/public
cp -r ./doc ./release/$(GOOS)/
cp -r ./public/static ./release/$(GOOS)/public/
cp -r ./public/*.xsl ./release/$(GOOS)/public/
cp -r ./template ./release/$(GOOS)/
cp -r ./system ./release/$(GOOS)/
cp -r ./locales ./release/$(GOOS)/
cp -r ./CHANGELOG.md ./release/$(GOOS)/
cp -r ./License ./release/$(GOOS)/
cp -r ./clientFiles ./release/$(GOOS)/
cp -r ./README.md ./release/$(GOOS)/
cp -r ./dictionary.txt ./release/$(GOOS)/
find ./release/$(GOOS) -name '.DS_Store' | xargs rm -f
$(GO) build -trimpath $(LDFLAGS) -o ./release/$(GOOS)/$(BINARY_NAME) kandaoni.com/anqicms/main
archive:
@echo "📦 Creating archive..."
@(cd ./release/$(GOOS)/ && zip -r -9 ../$(BINARY_NAME)-$(GOOS)-$(version).zip .)