-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
56 lines (45 loc) · 1.06 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
44
45
46
47
48
49
50
51
52
53
54
55
56
GO ?= go
TINYGO ?= tinygo
STRIP ?= strip
OUTDIR ?= $(CURDIR)/out
APPNAME ?= $(shell basename $(CURDIR))
SOURCES ?= $(wildcard *.go) \
$(wildcard internal/nostd/*.go) \
$(wildcard internal/data/*.go) \
$(wildcard internal/console/*.go)
.PHONY: all
all: tiny
.PHONY: clean
clean:
@rm -rf $(OUTDIR)
$(OUTDIR):
@mkdir -p $(OUTDIR)
$(OUTDIR)/$(APPNAME)_normal: $(OUTDIR) $(SOURCES)
@echo "building with $(GO)..."
@$(GO) build -a -gcflags=all="-l -B -wb=false" -ldflags="-s -w" -o $@ main.go
@$(STRIP) $@
@ls -ahl $@
$(OUTDIR)/$(APPNAME): $(OUTDIR) $(SOURCES)
@echo "building with $(TINYGO)..."
$(TINYGO) build -gc leaking -scheduler none -opt z -o $@ main.go
@$(STRIP) $@
@ls -ahl $@
.PHONY: run
run:
@$(GO) run main.go
.PHONY: tiny
tiny: $(OUTDIR)/$(APPNAME)
.PHONY: normal
normal: $(OUTDIR)/$(APPNAME)_normal
.PHONY: info
info:
@echo SOURCES=$(SOURCES)
@echo TINYGO=$(TINYGO)
@echo GO=$(GO)
@echo STRIP=$(STRIP)
@echo OUTDIR=$(OUTDIR)
@echo OUTDIR=$(OUTDIR)
@echo APPNAME=$(APPNAME)
.PHONY: test
test:
@go test github.com/leizongmin/luckypg/...