-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
35 lines (26 loc) · 983 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
.PHONY: all clean
SHELL := /bin/bash
GO_DIR := $(shell git rev-parse --show-toplevel)
UI_DIR := $(shell git rev-parse --show-toplevel)
GO_SOURCE = \
$(GO_DIR)/go.mod $(GO_DIR)/go.sum \
$(shell find $(GO_DIR) -type f ! -path "*node_modules/*" ! -path "*/.git/*" ! -path "*/docs/*" ) \
$(NULL)
UI_SOURCE = \
$(UI_DIR)/package.json \
$(shell find $(UI_DIR)/static/ -type f) \
$(shell find $(UI_DIR)/src/ -type f) \
$(shell find $(UI_DIR)/views/ -type f) \
$(NULL)
VERSION := $(shell git describe --match 'v[0-9]*' --always --tags --abbrev=8)
all: ./build/bin/gpt-zmide-server
# npm install
$(UI_DIR)/node_modules/.package-lock.json: $(UI_DIR)/package.json
cd $(UI_DIR); npm install
./dist/: $(UI_DIR)/node_modules/.package-lock.json $(UI_SOURCE)
npm run build
./build/bin/gpt-zmide-server: ./dist/ $(GO_SOURCE)
cd $(GO_DIR); CGO_ENABLED=0 go build -ldflags="-s -w" -o ./build/bin/gpt-zmide-server .
clean:
rm -rf ./build/bin/gpt-zmide-server ./dist/
go clean -i .