summaryrefslogtreecommitdiffstats
path: root/apps/plugins/sdl/sdl.make
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-01-21 15:18:31 -0500
committerFranklin Wei <git@fwei.tk>2017-12-23 21:01:26 -0500
commita855d6202536ff28e5aae4f22a0f31d8f5b325d0 (patch)
tree8c75f224dd64ed360505afa8843d016b0d75000b /apps/plugins/sdl/sdl.make
parent01c6dcf6c7b9bb1ad2fa0450f99bacc5f3d3e04b (diff)
downloadrockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.tar.gz
rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.tar.bz2
rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.zip
Port of Duke Nukem 3D
This ports Fabien Sanglard's Chocolate Duke to run on a version of SDL for Rockbox. Change-Id: I8f2c4c78af19de10c1633ed7bb7a997b43256dd9
Diffstat (limited to 'apps/plugins/sdl/sdl.make')
-rw-r--r--apps/plugins/sdl/sdl.make56
1 files changed, 56 insertions, 0 deletions
diff --git a/apps/plugins/sdl/sdl.make b/apps/plugins/sdl/sdl.make
new file mode 100644
index 0000000000..fedbaa5399
--- /dev/null
+++ b/apps/plugins/sdl/sdl.make
@@ -0,0 +1,56 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id$
+#
+
+SDL_SRCDIR := $(APPSDIR)/plugins/sdl
+SDL_OBJDIR := $(BUILDDIR)/apps/plugins/sdl
+
+SDL_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES)
+DUKE3D_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES.duke)
+
+SDL_OBJ := $(call c2obj, $(SDL_SRC))
+DUKE3D_OBJ = $(call c2obj, $(DUKE3D_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(SDL_SRC) $(DUKE3D_SRC)
+OTHER_INC += -I$(SDL_SRCDIR)/include
+
+# include comes first because of possible system SDL headers taking
+# precedence
+SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
+-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wcast-align
+
+ifndef APP_TYPE
+ ### no target has a big enough plugin buffer
+ ROCKS += $(SDL_OBJDIR)/duke3d.ovl
+ DUKE3D_OUTLDS = $(SDL_OBJDIR)/duke3d.link
+ SDL_OVLFLAGS = -T$(DUKE3D_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
+else
+ ### simulator
+ ROCKS += $(SDL_OBJDIR)/duke3d.rock
+endif
+
+$(SDL_OBJDIR)/duke3d.rock: $(SDL_OBJ) $(DUKE3D_OBJ) $(TLSFLIB)
+
+$(SDL_OBJDIR)/duke3d.refmap: $(SDL_OBJ) $(DUKE3D_OBJ) $(TLSFLIB)
+
+$(DUKE3D_OUTLDS): $(PLUGIN_LDS) $(SDL_OBJDIR)/duke3d.refmap
+ $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
+ $(TOOLSDIR)/ovl_offset.pl $(SDL_OBJDIR)/duke3d.refmap))
+
+$(SDL_OBJDIR)/duke3d.ovl: $(SDL_OBJ) $(DUKE3D_OBJ) $(TLSFLIB) $(DUKE3D_OUTLDS)
+ $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $+) \
+ -lgcc $(SDL_OVLFLAGS)
+ $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
+
+$(SDL_OBJDIR)/%.o: $(SDL_SRCDIR)/%.c $(SDL_SRCDIR)/sdl.make
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(SDLFLAGS) -c $< -o $@
+ $(SILENT)$(OC) --redefine-syms=$(SDL_SRCDIR)/redefines.txt $@