Skip to content

Commit

Permalink
add makefile for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
vs49688 committed Jun 26, 2020
1 parent 2672121 commit fdda54d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fdda54d

Please sign in to comment.