#//////////////////////////////////////////////////////////////////////////
#
# Filename:	Makefile 
# Purpose:	This is the makefile for GUItenMark.  It will probably
#		work only with GNU make, and as far as compilers are 
#		concerned, is intended to be used with GNU gcc.
# Mods:		04/19/2008 RSB	Began.
#		05/09/2008 RSB	Added GUItenMark-macosx target for
#				cross-compilation.
#		06/01/2008 RSB	Replaced all ".phony" with ".PHONY", as I
#				am informed (thanks, Jason Pollock!), that
#				".phony" is not merely theoretically 
#				incorrect, but also doesn't work on all 
#				platforms.
#		03/09/09 RSB	Changed so that when *I* compile it, the
#				native-Linux version compiles for 32-bit 
#				CPU even if I'm using a 64-bit machine 
#				to compile it.  changed the default target
#				so that only the native application is built
#				and added the all-archs target which will
#				instead build it for native Linux, Win32,
#				and Mac OS X.
#		05/10/09 RSB	Removed the explicit --unicode flag from the
#				Mac OS X build.  It will still used Unicode
#				if that's the wxWidgets configuration 
#				installed, but it caused failure on my
#				build-box.
#
#  Copyright 2008-2009 Ronald S. Burkey <info@sandroid.org>
#
#  This file is part of GutenMark.
#
#  GutenMark 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.
#
#  GutenMark 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 GutenMark; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# 	///////////////////////////////////////////////////////////
#				IMPORTANT NOTE!
#		This Makefile builds not only a Linux version 
#		of GUItenMark, but also Win32 and Mac OS X
#		versions of GUItenMark, and the Win32 and 
#		builds are done on a Linux box!  This
#		assumes that you have installed the Cross-Compiler
#		system of the "I'm Cross!" project (refer to
#		http://www.sandroid.org/imcross).  I'm sure 
#		that it's possible to build GUItenMark from 
#		within Windows or Mac OS X, but I've not tried
#		it, and I'm sure this Makefile (while correct in
#		spirit) won't work in Windows or Mac OS X as-is, 
#		and I don't care to offer any advice on the matter.
#		Linux is free, IMCROSS is free, so use them.
#	///////////////////////////////////////////////////////////
#
#//////////////////////////////////////////////////////////////////////////


ifndef DARWIN_VERSION
DARWIN_VERSION=darwin9
endif

APPLIST=GUItenMark GUItenMark.exe GUItenMark-macosx
CSOURCE=main.cpp GUItenMark.cpp
CHEADERS=GUItenMark.h

.PHONY:  default
default: GUItenMark

.PHONY:  all-archs
all-archs: ${APPLIST}

.PHONY:  clean
clean:
	-rm ${APPLIST}

# Note that the following is defined merely because when I build GUItenMark
# I need it to be portable, and I happen to have wxGTK static libraries 
# installed.  For someone merely compiling it for themself, that's not
# something to worry about, so I don't set it in those cases.
ifeq "${USER}" "rburkey"
WXSTATIC=--static
endif

GUItenMark:  ${CSOURCE} ${CHEADERS} Makefile
	g++ ${ARCH32} \
		`wx-config ${WXSTATIC} --cxxflags` \
		${CSOURCE} \
		`wx-config ${WXSTATIC} --libs` \
		-o $@
	strip $@

GUItenMark.exe:  ${CSOURCE} ${CHEADERS} Makefile
	i386-mingw32-g++ \
		`${IMCROSS_PATH}/i386-mingw32/bin/wx-config --static --cxxflags` \
		${CSOURCE} \
		`${IMCROSS_PATH}/i386-mingw32/bin/wx-config --static --libs` \
		-o $@
	i386-mingw32-strip $@

GUItenMark-macosx:  ${CSOURCE} ${CHEADERS} Makefile
	powerpc-apple-${DARWIN_VERSION}-g++ \
		${MAC_TARGETS} -isysroot ${IMCROSS_PATH}/mac/SDKs/MacOSX10.4u.sdk \
		`${IMCROSS_PATH}/mac/bin/wx-config --static --cxxflags` \
		${CSOURCE} \
		`${IMCROSS_PATH}/mac/bin/wx-config --static --libs` \
		-o $@
	powerpc-apple-${DARWIN_VERSION}-strip $@


