forked from yinheli/udppunch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (18 loc) · 780 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
# Makefile for build
SERVER=punch-server
CLIENT=punch-client
PLATFORMS=darwin linux windows
ARCHITECTURES=amd64 arm64
LDFLAGS=-ldflags '-s -w -extldflags "-static"'
all: clean build_all
build:
go build ${LDFLAGS} -o dist/${SERVER} server/server.go
go build ${LDFLAGS} -o dist/${CLIENT} client/client.go
build_all:
$(foreach GOOS, $(PLATFORMS),\
$(foreach GOARCH, $(ARCHITECTURES), $(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build $(LDFLAGS) -o dist/$(SERVER)-$(GOOS)-$(GOARCH) server/server.go)))
$(foreach GOOS, $(PLATFORMS),\
$(foreach GOARCH, $(ARCHITECTURES), $(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build $(LDFLAGS) -o dist/$(CLIENT)-$(GOOS)-$(GOARCH) client/client.go)))
clean:
@rm -rf dist
.PHONY: all build build_all clean