forked from olebedev/go-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
31 lines (24 loc) · 857 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
TARGET = bin/server
BUNDLE = server/data/static/build/bundle.js
EMBEDDED_DATA = server/rice-box.go
NODE_BIN = $(shell npm bin)
GO_FILES = $(shell find ./server -type f -name "*.go")
APP_FILES = $(shell find client -type f)
GIT_HASH = $(shell git rev-parse HEAD)
LDFLAGS = -X main.commitHash=$(GIT_HASH)
build: clean $(TARGET)
$(TARGET): $(EMBEDDED_DATA) $(GO_FILES)
@go build -i -ldflags '$(LDFLAGS)' -o $@ server/*.go
@go build -ldflags '$(LDFLAGS)' -o $@ server/*.go
$(EMBEDDED_DATA): $(BUNDLE)
@(cd server; rice embed -v)
$(BUNDLE): $(APP_FILES) $(NODE_BIN)/webpack
@$(NODE_BIN)/webpack --progress --colors --bail
$(NODE_BIN)/webpack:
npm install
clean:
@rm -rf server/data/static/build # includes $(BUNDLE)
@rm -f $(TARGET) $(EMBEDDED_DATA)
lint:
@eslint client || true
@golint $(GO_FILES) || true