# Makefile -- Copyright (c) 2001-2002 Eberhard Mattes
#
# This file is part of epocemx.
#
# epocemx 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, or (at your option)
# any later version.
#
# epocemx 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 epocemx; see the file COPYING.  If not, write to the
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

# cf. <emxuid.h>
KEmxConsoleUidValue=0x101f3dcd

I=/usr/local/epocemx/include

FILES=emxconsole.app emxconsole.rsc emxconsole.aif
default: $(FILES)

.PHONY: default sis sis-minor sis-minor-helper

sis: emxconsole.sis

CC=arm-epoc-pe-gcc -Wall

emxconsole.app: emxconsole.cc emxconsole.hrh emxconsole.rsg \
		emxconsole.def $(I)/emx.h $(I)/emxuid.h \
		$(I)/emxdll/config.h $(I)/emxdll/emxconsole.h
	$(CC) -shared -o emxconsole.app \
		emxconsole.cc emxconsole.def \
		-lbafl -lgdi -lws32 -letext -lcone -lapparc -leikon \
		-lefsrv -lestor -lapgrfx \
		-uid3 $(KEmxConsoleUidValue)

emxconsole.rsc emxconsole.rsg: emxconsole.rss emxconsole.hrh
	emxrsc -s emxconsole.rss -o emxconsole.rsc -h emxconsole.rsg

emxconsole.aif: aif.rss emxconsole.mbm
	emxaif -o emxconsole.aif aif.rss emxconsole.mbm

emxconsole.sis: emxconsole.pkg emxconsole.app emxconsole.rsc emxconsole.aif
	emxsis -D KEmxConsoleUidValue=$(KEmxConsoleUidValue) emxconsole.pkg emxconsole.sis

sis-minor: $(FILES) sis-minor-helper emxconsole.sis

sis-minor-helper:
	emxsis -iv -D KEmxConsoleUidValue=$(KEmxConsoleUidValue) emxconsole.pkg tmp.pkg
	mv -f tmp.pkg emxconsole.pkg

clean:
	rm -f $(FILES) emxconsole.rsg emxconsole.sis tmp.pkg
