2006-03-28 15:44:01 +00:00
################################################################
#
# $Id$
#
2007-01-17 18:52:24 +00:00
# $Log: Makefile,v $
# Revision 1.13 2006-12-13 06:52:09 kkurbjun
2006-12-13 06:52:10 +00:00
# Free more plugin memory
#
# Revision 1.12 2006-12-13 05:46:51 kkurbjun
2006-12-13 05:46:51 +00:00
# Will it fit?
#
# Revision 1.11 2006-12-13 04:44:17 kkurbjun
2006-12-13 04:44:17 +00:00
# Dehacked and BEX support for Doom - currently only supports a DEHACKED file in a WAD (not as a standalone file yet).
#
# Revision 1.10 2006-10-27 21:47:55 amiconn
2006-10-27 21:48:06 +00:00
# Next step of Makefile tuning: * Use 'make' internal commands for printing messages. Saves build time especially on cygwin. * SILENT variable used in more places. * Bitmap build system uses one Makefille less.
#
# Revision 1.9 2006-10-23 22:33:36 amiconn
2006-10-23 22:33:39 +00:00
# Consistent style of 'make' messages. Always use ranlib after ar.
#
# Revision 1.8 2006-10-23 14:09:28 markun
2006-10-23 14:09:28 +00:00
# rearrange compiler options to avoid conflicts with header files on FreeBSD
#
# Revision 1.7 2006-10-22 00:21:56 amiconn
2006-10-22 00:21:57 +00:00
# Speed up build process in general by using internal functions of make instead of spawning sub-shells where possible.
#
# Revision 1.6 2006-09-29 20:04:35 barrywardell
2006-09-29 20:04:36 +00:00
# Cleaner implementation of the recent OSX simulator build fix. No need to define SHARED_FLAG in each Makefile. Just have configure create it in the root Makefile instead.
#
# Revision 1.5 2006-09-29 16:15:08 barrywardell
2006-09-29 16:15:11 +00:00
# Allow UI simulator to be build on OS (Slightly updated version of FS5767)
#
# Revision 1.4 2006-07-27 13:27:19 linus
2006-07-27 13:27:31 +00:00
# Moved the X5 button driver to the target tree
#
# Revision 1.3 2006-04-14 21:07:56 kkurbjun
2006-04-14 21:07:56 +00:00
# Start of profiling support for doom.
#
# Revision 1.2 2006-03-29 21:16:45 kkurbjun
2006-03-29 21:16:45 +00:00
# Use rockbox endian defines
#
# Revision 1.1 2006-03-28 15:44:01 dave
2006-03-28 15:44:01 +00:00
# Patch #2969 - Doom! Currently only working on the H300.
#
#
2006-07-27 13:27:31 +00:00
INCLUDES = -I$( APPSDIR) -I.. -I. $( TARGET_INC) -I$( FIRMDIR) /include -I$( FIRMDIR) /export \
2006-03-28 15:44:01 +00:00
-I$( FIRMDIR) /common -I$( FIRMDIR) /drivers -I$( OUTDIR) -I$( BUILDDIR)
2006-10-23 14:09:28 +00:00
CFLAGS = $( INCLUDES) $( GCCOPTS) $( TARGET) $( EXTRA_DEFINES) \
2006-03-28 15:44:01 +00:00
-DTARGET_ID= $( TARGET_ID) -DMEM= ${ MEMORYSIZE } -DPLUGIN \
2006-12-13 04:44:17 +00:00
-Wno-strict-prototypes $( PROFILE_OPTS)
2006-03-28 15:44:01 +00:00
i f d e f A P P E X T R A
INCLUDES += $( patsubst %,-I$( APPSDIR) /%,$( subst :, ,$( APPEXTRA) ) )
e n d i f
2006-12-13 04:44:17 +00:00
# The arm code compiles too large for the plugin buffer when set to optimize for speed
2007-10-07 18:24:53 +00:00
i f e q ( $( CPU ) , a r m )
2006-12-13 04:44:17 +00:00
CFLAGS += -Os
2006-03-28 15:44:01 +00:00
i f n d e f S I M V E R
2006-12-13 06:52:10 +00:00
i f e q ( $( TARGET ) , I R I V E R _ H 1 0 0 )
2006-03-28 15:44:01 +00:00
CFLAGS += -mstructure-size-boundary= 8
e n d i f
2006-12-13 06:52:10 +00:00
e n d i f
2006-12-13 04:44:17 +00:00
e l s e
CFLAGS += -O2
2006-03-28 15:44:01 +00:00
e n d i f
LINKFILE := $( OBJDIR) /link.lds
DEPFILE = $( OBJDIR) /dep-doom
SRC = info.c doomdef.c doomstat.c dstrings.c tables.c \
f_finale.c f_wipe.c d_net.c d_items.c g_game.c m_menu.c m_argv.c \
m_cheat.c m_random.c am_map.c p_ceilng.c p_doors.c p_genlin.c \
p_enemy.c p_floor.c p_inter.c p_lights.c p_map.c p_maputl.c p_plats.c \
p_pspr.c p_setup.c p_sight.c p_spec.c p_switch.c p_mobj.c p_telept.c \
p_tick.c p_saveg.c p_user.c r_bsp.c r_data.c r_draw.c r_main.c \
r_plane.c r_segs.c r_sky.c r_things.c wi_stuff.c v_video.c st_lib.c \
st_stuff.c hu_stuff.c hu_lib.c s_sound.c z_zone.c z_bmalloc.c sounds.c \
d_main.c m_misc.c m_bbox.c i_system.c i_sound.c i_video.c \
2006-12-13 04:44:17 +00:00
w_wad.c rockdoom.c d_deh.c ../../../firmware/common/sscanf.c
# sscanf isn't built into the core right now - should remove from here if that
# changes
2006-03-28 15:44:01 +00:00
SOURCES = $( SRC)
OBJS := $( SRC:%.c= $( OBJDIR) /%.o)
#OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
#OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
DIRS = .
i f n d e f S I M V E R
LDS := ../plugin.lds
OUTPUT = $( OUTDIR) /doom.rock
e l s e ## simulators
OUTPUT = $( OUTDIR) /doom.rock
e n d i f
all : $( OUTPUT )
i f n d e f S I M V E R
$(OBJDIR)/doom.elf : $( OBJS ) $( LINKFILE )
2007-02-15 20:28:08 +00:00
$( call PRINTS,LD $( @F) ) $( CC) $( CFLAGS) -o $@ $( OBJS) -L$( BUILDDIR) -lplugin -lgcc\
2008-01-04 21:07:05 +00:00
-T$( LINKFILE) -Wl,--gc-sections -Wl,-Map,$( OBJDIR) /doom.map
2006-03-28 15:44:01 +00:00
$(OUTPUT) : $( OBJDIR ) /doom .elf
2006-10-27 21:48:06 +00:00
$( call PRINTS,OBJCOPY $( @F) ) $( OC) -O binary $< $@
2006-03-28 15:44:01 +00:00
e l s e
i f e q ( $( SIMVER ) , x 1 1 )
###################################################
# This is the X11 simulator version
$(OUTPUT) : $( OBJS )
2006-10-27 21:48:06 +00:00
$( call PRINTS,LD $( @F) ) $( CC) $( CFLAGS) $( SHARED_FLAG) $( OBJS) -L$( BUILDDIR) -lplugin -o $@
2006-03-28 15:44:01 +00:00
i f e q ( $( findstring CYGWIN ,$ ( UNAME ) ) , C Y G W I N )
# 'x' must be kept or you'll have "Win32 error 5"
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
# #define ERROR_ACCESS_DENIED 5L
e l s e
@chmod -x $@
e n d i f
e l s e # end of x11-simulator
i f e q ( $( SIMVER ) , s d l )
###################################################
# This is the sdl simulator version
$(OUTPUT) : $( OBJS )
2006-10-27 21:48:06 +00:00
$( call PRINTS,LD $( @F) ) $( CC) $( CFLAGS) $( SHARED_FLAG) $( OBJS) -L$( BUILDDIR) -lplugin -o $@
2006-03-28 15:44:01 +00:00
i f e q ( $( findstring CYGWIN ,$ ( UNAME ) ) , C Y G W I N )
# 'x' must be kept or you'll have "Win32 error 5"
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
# #define ERROR_ACCESS_DENIED 5L
e l s e
@chmod -x $@
e n d i f
e l s e # end of sdl-simulator
###################################################
# This is the win32 simulator version
DLLTOOLFLAGS = --export-all
DLLWRAPFLAGS = -s --entry _DllMain@12 --target= i386-mingw32 -mno-cygwin
$(OUTPUT) : $( OBJS )
2006-10-27 21:48:06 +00:00
$( call PRINTS,DLL $( @F) ) $( DLLTOOL) $( DLLTOOLFLAGS) -z $( OBJDIR) /$* .def $( OBJS)
$( SILENT) $( DLLWRAP) $( DLLWRAPFLAGS) --def $( OBJDIR) /$* .def $( OBJS) \
2006-03-28 15:44:01 +00:00
$( BUILDDIR) /libplugin.a -o $@
i f e q ( $( findstring CYGWIN ,$ ( UNAME ) ) , C Y G W I N )
# 'x' must be kept or you'll have "Win32 error 5"
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
# #define ERROR_ACCESS_DENIED 5L
e l s e
@chmod -x $@
e n d i f
e n d i f # end of win32-simulator
e n d i f
e n d i f # end of simulator section
i n c l u d e $( TOOLSDIR ) / m a k e . i n c
# MEMORYSIZE should be passed on to this makefile with the chosen memory size
# given in number of MB
$(LINKFILE) : $( LDS )
2006-10-27 21:48:06 +00:00
$( call PRINTS,build $( @F) ) cat $< | $( CC) -DMEMORYSIZE= $( MEMORYSIZE) $( INCLUDES) $( TARGET) $( DEFINES) \
2006-03-28 15:44:01 +00:00
-E -P - >$@
clean :
2006-10-27 21:48:06 +00:00
$( call PRINTS,cleaning doom) rm -rf $( OBJDIR) /doom
$( SILENT) rm -f $( OBJDIR) /doom.* $( DEPFILE)
2006-03-28 15:44:01 +00:00
- i n c l u d e $( DEPFILE )