From 1bccb0a07dd76a87ee3185f704cde27994f3a25f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Espen=20Fjellv=C3=A6r=20Olsen?= Date: Mon, 18 Nov 2013 19:27:40 +0100 Subject: [PATCH] Add Makefile for cross compiling on Linux --- pafish/.gitignore | 2 ++ pafish/Makefile | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 pafish/.gitignore create mode 100644 pafish/Makefile diff --git a/pafish/.gitignore b/pafish/.gitignore new file mode 100644 index 0000000..8df9296 --- /dev/null +++ b/pafish/.gitignore @@ -0,0 +1,2 @@ +Objects +Output \ No newline at end of file diff --git a/pafish/Makefile b/pafish/Makefile new file mode 100644 index 0000000..8c65150 --- /dev/null +++ b/pafish/Makefile @@ -0,0 +1,36 @@ +CC = i686-pc-mingw32-gcc +WINDRES = i686-pc-mingw32-windres +OBJDIR = Objects/MingW +SRC = $(wildcard *.c) +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/pafish_private.res +BIN = Output/MingW/pafish.exe +LINKOBJ = $(OBJDIR)/*.o $(OBJDIR)/pafish_private.res +LIBS = -s +CXXFLAGS = -fexpensive-optimizations -O1 -static-libgcc +CFLAGS = -fexpensive-optimizations -O1 +GPROF = i686-pc-mingw32-gprof +LINKFLAGS = -static-libgcc + +ifeq ($(OS),Windows_NT) + RM = del /Q + FixPath = $(subst /,\,$1) +else + RM = rm -f + FixPath = $1 +endif +LINK = i686-pc-mingw32-g++ + +.PHONY: all all-before all-after clean clean-custom +all: all-before $(BIN) all-after + +clean: clean-custom + $(RM) $(call FixPath,$(LINKOBJ)) $(call FixPath,$(BIN)) + +$(BIN): $(OBJ) + $(CC) $(LINKFLAGS) $(LINKOBJ) -o $@ $(LIBS) + +$(OBJDIR)/%.o: %.c + $(CC) $(CFLAGS) $(DIRS) -c $^ -o $@ + +$(OBJDIR)/pafish_private.res: $(OBJDIR)/pafish_private.rc + $(WINDRES) --input-format=rc -o $(OBJDIR)/pafish_private.res $(OBJDIR)/pafish_private.rc -O coff