-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
45 lines (41 loc) · 1.5 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
BUILD_ENV := CGO_ENABLED=0
APP=wechatmp2markdown
VERSION=v1.1.9
# linux or mac 环境编译
# make [cmd]
build-linux: clean
${BUILD_ENV} GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o build/${APP}-${VERSION}_linux_amd64 main.go
build-osx: clean
${BUILD_ENV} GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o build/${APP}-${VERSION}_osx_amd64 main.go
build-win64: clean
${BUILD_ENV} GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o build/${APP}-${VERSION}_win64.exe main.go
build-win32: clean
${BUILD_ENV} GOOS=windows GOARCH=386 go build -ldflags "-s -w" -o build/${APP}-${VERSION}_win32.exe main.go
build-all: build-linux build-osx build-win32 build-win64
# windows环境编译 需gcc,推荐安装tdm64-gcc
# mingw32-make [cmd]
win-build-linux: clean
go env -w ${BUILD_ENV}
go env -w GOOS=linux
go env -w GOARCH=amd64
go build -ldflags "-s -w" -o build/${APP}-${VERSION}_linux_amd64 main.go
win-build-osx: clean
go env -w ${BUILD_ENV}
go env -w GOOS=darwin
go env -w GOARCH=amd64
go build -ldflags "-s -w" -o build/${APP}-${VERSION}_osx_amd64 main.go
win-build-win64: clean
go env -w ${BUILD_ENV}
go env -w GOOS=windows
go env -w GOARCH=amd64
go build -ldflags "-s -w" -o build/${APP}-${VERSION}_win64.exe main.go
win-build-win32: clean
go env -w ${BUILD_ENV}
go env -w GOOS=windows
go env -w GOARCH=386
go build -ldflags "-s -w" -o build/${APP}-${VERSION}_win32.exe main.go
win-build-all: win-build-linux win-build-osx win-build-win32 win-build-win64
run:
go run main.go
clean:
go clean