Skip to content
Snippets Groups Projects
Commit b652e25d authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[pkg] use cross-build flag in makefile

parent eb5b2d35
No related branches found
No related tags found
1 merge request!80Feat/snap missing boiler
...@@ -11,6 +11,7 @@ PROVIDER ?= $(shell grep ^'provider =' branding/config/vendor.conf | cut -d '=' ...@@ -11,6 +11,7 @@ PROVIDER ?= $(shell grep ^'provider =' branding/config/vendor.conf | cut -d '='
PROVIDER_CONFIG ?= branding/config/vendor.conf PROVIDER_CONFIG ?= branding/config/vendor.conf
DEFAULT_PROVIDER = branding/assets/default/ DEFAULT_PROVIDER = branding/assets/default/
VERSION ?= $(shell git describe) VERSION ?= $(shell git describe)
XBUILD ?= 0
# go paths # go paths
GOPATH = $(shell go env GOPATH) GOPATH = $(shell go env GOPATH)
...@@ -52,10 +53,23 @@ dependsDarwin: ...@@ -52,10 +53,23 @@ dependsDarwin:
@brew install --default-names gnu-sed @brew install --default-names gnu-sed
dependsCygwin: dependsCygwin:
choco install -y golang python nssm nsis wget 7zip @choco install -y golang python nssm nsis wget 7zip
build:
$(MAKE) _buildparts
ifeq($(XBUILD),"yes")
build_cross_win
build_cross_osx
$(MAKE) _build_xbuild_done
else ifeq ($(XBUILD), "win")
build_cross_win
$(MAKE) _build_done
else ifeq ($(XBUILD), "osx")
build_cross_osx
$(MAKE) _build_done
endif
build: $(foreach path,$(wildcard cmd/*),build_$(patsubst cmd/%,%,$(path))) build_done _buildparts: $(foreach path,$(wildcard cmd/*),build_$(patsubst cmd/%,%,$(path)))
build_%: build_%:
@mkdir -p build/bin/${PLATFORM} @mkdir -p build/bin/${PLATFORM}
...@@ -75,14 +89,18 @@ build_win: ...@@ -75,14 +89,18 @@ build_win:
CROSS_WIN_FLAGS = CGO_ENABLED=1 GOARCH=386 GOOS=windows CC="/usr/bin/i686-w64-mingw32-gcc" CGO_LDFLAGS="-lssp" CXX="i686-w64-mingw32-c++" CROSS_WIN_FLAGS = CGO_ENABLED=1 GOARCH=386 GOOS=windows CC="/usr/bin/i686-w64-mingw32-gcc" CGO_LDFLAGS="-lssp" CXX="i686-w64-mingw32-c++"
PLATFORM_WIN = PLATFORM=windows PLATFORM_WIN = PLATFORM=windows
build_cross_win: build_cross_win:
$(CROSS_WIN_FLAGS) $(PLATFORM_WIN) $(MAKE) build $(CROSS_WIN_FLAGS) $(PLATFORM_WIN) $(MAKE) _buildparts
CROSS_OSX_FLAGS = MACOSX_DEPLOYMENT_TARGET=10.10 CGO_ENABLED=1 GOOS=darwin CC="o64-clang" CROSS_OSX_FLAGS = MACOSX_DEPLOYMENT_TARGET=10.10 CGO_ENABLED=1 GOOS=darwin CC="o64-clang"
PLATFORM_OSX = PLATFORM=darwin PLATFORM_OSX = PLATFORM=darwin
build_cross_osx: build_cross_osx:
$(CROSS_OSX_FLAGS) $(PLATFORM_OSX) $(MAKE) build $(CROSS_OSX_FLAGS) $(PLATFORM_OSX) $(MAKE) _buildparts
_build_done:
@echo
@echo 'Done. You can build your package now.'
build_done: _build_xbuild_done:
@echo @echo
@echo 'Done. You can do "make packages" now.' @echo 'Done. You can do "make packages" now.'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment