From fdda54d33d28c442f7884d3201387aa10fab231d Mon Sep 17 00:00:00 2001 From: Zane van Iperen Date: Fri, 26 Jun 2020 20:32:13 +1000 Subject: [PATCH] add makefile for ci --- Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 Makefile diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..4e34535 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +#!/usr/bin/make -f + +LINCC?=gcc +LINCXX?=g++ + +WINCC?=x86_64-w64-mingw32-gcc +WINCXX?=x86_64-w64-mingw32-g++ + +CFLAGS?=-O3 -flto +LDFLAGS?=-static + +BUILDROOT?=build + +VERSION?=$(shell git describe) + +all: $(BUILDROOT)/maptool-linux-amd64-$(VERSION) $(BUILDROOT)/maptool-windows-amd64-$(VERSION).exe + +$(BUILDROOT)/linux-amd64/maptool/maptool: + mkdir -p $(BUILDROOT)/linux-amd64 + cmake \ + -B $(BUILDROOT)/linux-amd64 \ + -G "Unix Makefiles" \ + -DCMAKE_C_COMPILER=$(LINCC) \ + -DCMAKE_CXX_COMPILER=$(LINCXX) \ + -DCMAKE_C_FLAGS="$(CFLAGS)" \ + -DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \ + . + $(MAKE) -C $(BUILDROOT)/linux-amd64 maptool + +$(BUILDROOT)/windows-amd64/maptool/maptool.exe: + mkdir -p $(BUILDROOT)/windows-amd64 + cmake \ + -B $(BUILDROOT)/windows-amd64 \ + -G "Unix Makefiles" \ + -DCMAKE_C_COMPILER=$(WINCC) \ + -DCMAKE_CXX_COMPILER=$(WINCXX) \ + -DCMAKE_C_FLAGS="$(CFLAGS)" \ + -DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \ + -DCMAKE_SYSTEM_NAME="Windows" \ + . + $(MAKE) -C $(BUILDROOT)/windows-amd64 maptool + +$(BUILDROOT)/maptool-linux-amd64-$(VERSION): $(BUILDROOT)/linux-amd64/maptool/maptool + cp $< $@ + +$(BUILDROOT)/maptool-windows-amd64-$(VERSION).exe: $(BUILDROOT)/windows-amd64/maptool/maptool.exe + cp $< $@ + +.PHONY: all