From 6e3f529f7cc5ac280c92ae4c17c5da1bc6185264 Mon Sep 17 00:00:00 2001 From: jason Date: Sun, 20 Apr 2008 23:13:02 -0400 Subject: [PATCH] added Makefile.win_cross for cross-compiling the windows binary on linux --- Makefile.win_cross | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 Makefile.win_cross diff --git a/Makefile.win_cross b/Makefile.win_cross new file mode 100644 index 0000000..047c6ee --- /dev/null +++ b/Makefile.win_cross @@ -0,0 +1,109 @@ +# Variations on Rockdodger +# Copyright (C) 2004 Joshua Grams + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +# This makefile is for cross-compiling to a windows binary from a linux host +# +# It's ugly, in that it's just a copy of Makefile with the ldflags and cflags +# hardcoded and the install actions removed. +# +# With this cross-compiler (mingw package in ubuntu) the order of -l gcc +# options matters, so the $(ldflags) was moved to the end of the link script + + +CC=i586-mingw32msvc-gcc +LD=i586-mingw32msvc-ld +AR=i586-mingw32msvc-ar +RC=i586-mingw32msvc-windres + + + +# hard coded, must go at the end of the commandline for linking +ldflags = -L/usr/i586-mingw32msvc/lib -lmingw32 -lSDL_image -lpng -lz -lSDL_mixer -lSDLmain -lSDL -lwinmm -lgdi32 -mwindows -lm +cflags = -Wall -O3 -I/usr/i586-mingw32msvc/include -I/usr/i586-mingw32msvc/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main + + + +my_objects := args.o dust.o file.o mt.o rocks.o score.o sprite.o sound.o autopilot.o +my_objects += main.o +libs := font.o +objects := $(libs) $(my_objects) + +rocks := 00 01 02 03 04 05 06 07 08 09 +rocks += 10 11 12 13 14 15 16 17 18 19 +rocks += 20 21 22 23 24 25 26 27 28 29 +rocks += 30 31 32 33 34 35 36 37 38 39 +rocks += 40 41 42 43 44 45 46 47 48 49 +rocks := $(rocks:%=data/rock%.png) +graphics := data/ship.png data/icon.png data/life.png data/font.png $(rocks) + + +.PHONY: all clean maintainer-clean +.PHONY: program program-clean +.PHONY: data data-clean + +all: program data + +data: $(graphics) + +program: vor.exe + +%.o: %.c + @echo compiling $@ from $< + @$(CC) $(cflags) -c -o $@ $< + +$(my_objects): config.h + +font.o: font.h + +args.o: args.h + +dust.o: globals.h dust.h float.h mt.h + +file.o: file.h common.h + +main.o: args.h common.h dust.h file.h float.h globals.h mt.h rocks.h score.h sprite.h sound.h autopilot.h + +mt.o: mt.h + +rocks.o: rocks.h common.h file.h globals.h mt.h sprite.h + +score.o: score.h common.h file.h + +sound.o: sound.h args.h common.h + +sprite.o: sprite.h common.h + +vor.exe: $(objects) + @echo linking $@ from $^ + @$(CC) $^ -o $@ $(ldflags) + +include gfx.mk + +tags: *.c *.h + exuberant-ctags *.c *.h /usr/include/SDL/* + +clean: program-clean + rm -f tags + +maintainer-clean: program-clean data-clean + +program-clean: + rm -f *.o vor.exe + +data-clean: + rm -f $(graphics) font_guts font_guts.pov -- 1.7.10.4