1
0
forked from MTSR/mapserver
mapserver/server/Makefile

56 lines
1.5 KiB
Makefile
Raw Normal View History

2019-01-11 10:49:19 +01:00
STATIC_VFS=vfs/static.go
2019-01-23 09:11:55 +01:00
OUT_DIR=output
2019-01-24 19:20:11 +01:00
ENV=GO111MODULE=on
2019-03-29 10:18:23 +01:00
VERSION=git-$(shell git rev-parse HEAD)
2019-01-11 10:49:19 +01:00
2019-03-29 10:18:23 +01:00
# -ldflags="-X mapserver/app.Version=1.0"
GO_LDFLAGS=-ldflags "-linkmode external -extldflags -static -X mapserver/app.Version=$(VERSION)"
GO_LDFLAGS_WIN=-ldflags "-X mapserver/app.Version=$(VERSION)"
GO_BUILD=CGO_ENABLED=1 go build
2019-01-28 10:09:11 +01:00
2019-03-29 09:07:06 +01:00
BINARIES = $(OUT_DIR)/mapserver-linux-x86_64
BINARIES += $(OUT_DIR)/mapserver-linux-x86
BINARIES += $(OUT_DIR)/mapserver-windows-x86.exe
BINARIES += $(OUT_DIR)/mapserver-windows-x86-64.exe
BINARIES += $(OUT_DIR)/mapserver-linux-arm
2019-01-23 09:11:55 +01:00
$(OUT_DIR):
mkdir $@
2019-02-14 09:09:04 +01:00
fmt:
go fmt ./...
2019-02-13 14:42:53 +01:00
test: $(OUT_DIR)
go generate
go build
2019-01-24 19:20:11 +01:00
$(ENV) go test ./...
2019-01-05 17:21:24 +01:00
2019-01-21 19:18:07 +01:00
clean:
2019-01-22 20:19:04 +01:00
rm -rf $(STATIC_VFS)
2019-01-23 09:11:55 +01:00
rm -rf $(OUT_DIR)
2019-01-21 19:18:07 +01:00
2019-03-29 09:07:06 +01:00
$(STATIC_VFS):
2019-02-13 14:42:53 +01:00
go generate
2019-02-22 19:40:26 +01:00
2019-03-29 09:07:06 +01:00
$(OUT_DIR)/mapserver-linux-x86_64: $(OUT_DIR)
# native (linux x86_64)
2019-03-29 10:18:23 +01:00
GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc $(GO_BUILD) $(GO_LDFLAGS) -o $@
2019-03-29 09:07:06 +01:00
$(OUT_DIR)/mapserver-linux-x86: $(OUT_DIR)
2019-01-28 10:09:11 +01:00
# apt install gcc-8-i686-linux-gnu
2019-03-29 10:18:23 +01:00
GOOS=linux GOARCH=386 CC=i686-linux-gnu-gcc-7 $(GO_BUILD) $(GO_LDFLAGS) -o $@
2019-03-29 09:07:06 +01:00
$(OUT_DIR)/mapserver-windows-x86.exe: $(OUT_DIR)
2019-01-28 09:50:25 +01:00
# apt install gcc-mingw-w64
2019-03-29 10:18:23 +01:00
GOARCH=386 GOOS=windows CC=i686-w64-mingw32-gcc $(GO_BUILD) $(GO_LDFLAGS_WIN) -o $@
2019-03-29 09:07:06 +01:00
$(OUT_DIR)/mapserver-windows-x86-64.exe: $(OUT_DIR)
2019-03-29 10:18:23 +01:00
GOARCH=amd64 GOOS=windows CC=x86_64-w64-mingw32-gcc $(GO_BUILD) $(GO_LDFLAGS_WIN) -o $@
2019-03-29 09:07:06 +01:00
$(OUT_DIR)/mapserver-linux-arm: $(OUT_DIR)
2019-02-15 09:08:22 +01:00
# apt install gcc-5-arm-linux-gnueabihf
2019-03-29 10:18:23 +01:00
GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc-5 $(GO_BUILD) $(GO_LDFLAGS) -o $@
2019-02-04 15:22:56 +01:00
2019-03-29 09:07:06 +01:00
all: $(STATIC_VFS) $(BINARIES)