52 lines
1.7 KiB
Makefile
52 lines
1.7 KiB
Makefile
PROJECT_NAME := "alchemyst-go"
|
|
PKG := "lab.zaar.be/thefish/$(PROJECT_NAME)"
|
|
GO=$(shell which go)
|
|
CWD=$(shell pwd)
|
|
OS=$(shell basename $(shell echo $@ | tr '.' '/' ))
|
|
DISTFOLDER=$(CWD)/dist/$(OS)
|
|
PKG_VER=$(shell git describe --tags | head)
|
|
|
|
LDFLAGS="-X \"main.versionInfo=${PKG_VER}-${CI_PIPELINE_ID} built at $(shell date) on $(shell hostname) with $(shell go version)\""
|
|
|
|
.PHONY: all build test
|
|
|
|
all: build test
|
|
|
|
#build: build.spec build.server
|
|
build: build.game
|
|
|
|
build.game:
|
|
build.game.linux64
|
|
build.game.win64
|
|
|
|
build.deps:
|
|
GIT_SSL_NO_VERIFY=true $(GO) mod vendor
|
|
|
|
build.game.linux64:
|
|
cp $(CWD)/vendor/lab.zaar.be/thefish/bearlibterminal/libBearLibTerminal.so $(DISTFOLDER) && \
|
|
cp $(CWD)/config.json $(DISTFOLDER) && \
|
|
cp -r $(CWD)/resources $(DISTFOLDER) && \
|
|
$(GO) build -ldflags $(LDFLAGS) -o $(DISTFOLDER)/game $(CWD)/cmd/game/main.go && \
|
|
strip $(DISTFOLDER)/game && \
|
|
cd $(DISTFOLDER) && zip -r ../$(PROJECT_NAME)-$(OS)-${PKG_VER}.zip . -x *.git*
|
|
|
|
build.game.win64:
|
|
cp $(CWD)/lib/win64/BearLibTerminal.dll $(DISTFOLDER) && \
|
|
cp $(CWD)/config.json $(DISTFOLDER) && \
|
|
cp -r $(CWD)/resources $(DISTFOLDER) && \
|
|
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ $(GO) build -o $(DISTFOLDER)/game.exe -ldflags $(LDFLAGS) $(CWD)/cmd/game/main.go && \
|
|
strip $(DISTFOLDER)/game.exe && \
|
|
cd $(DISTFOLDER) && zip -r ../$(PROJECT_NAME)-$(OS)-${PKG_VER}.zip . -x *.git*
|
|
|
|
test:
|
|
$(GO) test -v $(go list ./... | grep -v /vendor/)
|
|
|
|
distclean:
|
|
# find . ! -name '.gitkeep' ! -path 'linux64' ! -path 'win64' -exec rm -rf {} \;
|
|
cd $(CWD)/dist && find . -type f -not \( -name .gitkeep -o -name README \) -delete && \
|
|
find . -type d -not \( -name .gitkeep -o -name linux64 -o -name win64 \) -delete
|
|
|
|
|
|
|
|
|