2017-01-21 20:18:31 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# 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)
|
2019-07-08 02:00:20 +00:00
|
|
|
WOLF3D_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES.wolf)
|
2018-02-11 20:34:30 +00:00
|
|
|
QUAKE_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES.quake)
|
2017-01-21 20:18:31 +00:00
|
|
|
|
|
|
|
SDL_OBJ := $(call c2obj, $(SDL_SRC))
|
|
|
|
DUKE3D_OBJ = $(call c2obj, $(DUKE3D_SRC))
|
2019-07-08 02:00:20 +00:00
|
|
|
WOLF3D_OBJ = $(call c2obj, $(WOLF3D_SRC))
|
2018-02-11 20:34:30 +00:00
|
|
|
QUAKE_OBJ = $(call c2obj, $(QUAKE_SRC))
|
2017-01-21 20:18:31 +00:00
|
|
|
|
|
|
|
# add source files to OTHER_SRC to get automatic dependencies
|
2018-02-11 20:34:30 +00:00
|
|
|
OTHER_SRC += $(SDL_SRC) $(DUKE3D_SRC) $(WOLF3D_SRC) $(QUAKE_SRC)
|
2017-01-21 20:18:31 +00:00
|
|
|
OTHER_INC += -I$(SDL_SRCDIR)/include
|
|
|
|
|
|
|
|
# include comes first because of possible system SDL headers taking
|
|
|
|
# precedence
|
2018-02-11 20:34:30 +00:00
|
|
|
# some of these are for Quake only
|
|
|
|
SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
|
|
|
|
-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wcast-align \
|
|
|
|
-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
|
|
|
|
-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -w # disable all warnings
|
2017-01-21 20:18:31 +00:00
|
|
|
|
2020-04-05 00:24:33 +00:00
|
|
|
# WIP SDLFLAGS for warning deletions
|
|
|
|
#SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
|
|
|
|
#-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wno-sign-compare \
|
|
|
|
#-Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-unknown-pragmas \
|
|
|
|
#-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
|
|
|
|
#-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF
|
|
|
|
|
2017-01-21 20:18:31 +00:00
|
|
|
ifndef APP_TYPE
|
|
|
|
### no target has a big enough plugin buffer
|
2018-02-11 20:34:30 +00:00
|
|
|
ROCKS += $(SDL_OBJDIR)/duke3d.ovl
|
|
|
|
ROCKS += $(SDL_OBJDIR)/wolf3d.ovl
|
|
|
|
ROCKS += $(SDL_OBJDIR)/quake.ovl
|
|
|
|
|
2017-01-21 20:18:31 +00:00
|
|
|
DUKE3D_OUTLDS = $(SDL_OBJDIR)/duke3d.link
|
2019-07-08 02:00:20 +00:00
|
|
|
WOLF3D_OUTLDS = $(SDL_OBJDIR)/wolf3d.link
|
2018-02-11 20:34:30 +00:00
|
|
|
QUAKE_OUTLDS = $(SDL_OBJDIR)/quake.link
|
|
|
|
|
2019-07-09 17:07:35 +00:00
|
|
|
SDL_OVLFLAGS = -Wl,--gc-sections -Wl,-Map,$(basename $@).map
|
2017-01-21 20:18:31 +00:00
|
|
|
else
|
|
|
|
### simulator
|
|
|
|
ROCKS += $(SDL_OBJDIR)/duke3d.rock
|
2019-07-08 02:00:20 +00:00
|
|
|
ROCKS += $(SDL_OBJDIR)/wolf3d.rock
|
2018-02-11 20:34:30 +00:00
|
|
|
ROCKS += $(SDL_OBJDIR)/quake.rock
|
2017-01-21 20:18:31 +00:00
|
|
|
endif
|
|
|
|
|
2019-07-08 02:00:20 +00:00
|
|
|
# Duke3D
|
|
|
|
|
2017-01-21 20:18:31 +00:00
|
|
|
$(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, $+) \
|
2019-07-09 17:07:35 +00:00
|
|
|
-lgcc -T$(DUKE3D_OUTLDS) $(SDL_OVLFLAGS)
|
2017-01-21 20:18:31 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
|
|
|
|
2019-07-08 02:00:20 +00:00
|
|
|
# Wolf3D
|
|
|
|
|
|
|
|
$(SDL_OBJDIR)/wolf3d.rock: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB)
|
|
|
|
|
|
|
|
$(SDL_OBJDIR)/wolf3d.refmap: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB)
|
|
|
|
|
|
|
|
$(WOLF3D_OUTLDS): $(PLUGIN_LDS) $(SDL_OBJDIR)/wolf3d.refmap
|
|
|
|
$(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
|
|
|
|
$(TOOLSDIR)/ovl_offset.pl $(SDL_OBJDIR)/wolf3d.refmap))
|
|
|
|
|
|
|
|
$(SDL_OBJDIR)/wolf3d.ovl: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB) $(WOLF3D_OUTLDS)
|
|
|
|
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
|
|
|
|
$(filter %.o, $^) \
|
|
|
|
$(filter %.a, $+) \
|
2019-07-09 17:07:35 +00:00
|
|
|
-lgcc -T$(WOLF3D_OUTLDS) $(SDL_OVLFLAGS)
|
2019-07-08 02:00:20 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
|
|
|
|
2018-02-11 20:34:30 +00:00
|
|
|
# Quake
|
|
|
|
###
|
|
|
|
|
|
|
|
$(SDL_OBJDIR)/quake.rock: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB)
|
|
|
|
|
|
|
|
$(SDL_OBJDIR)/quake.refmap: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB)
|
|
|
|
|
|
|
|
$(QUAKE_OUTLDS): $(PLUGIN_LDS) $(SDL_OBJDIR)/quake.refmap
|
|
|
|
$(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
|
|
|
|
$(TOOLSDIR)/ovl_offset.pl $(SDL_OBJDIR)/quake.refmap))
|
|
|
|
|
|
|
|
$(SDL_OBJDIR)/quake.ovl: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB) $(QUAKE_OUTLDS)
|
|
|
|
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
|
|
|
|
$(filter %.o, $^) \
|
|
|
|
$(filter %.a, $+) \
|
|
|
|
-lgcc -T$(QUAKE_OUTLDS) $(SDL_OVLFLAGS)
|
|
|
|
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
|
|
|
|
|
|
|
###
|
|
|
|
|
2019-07-08 02:00:20 +00:00
|
|
|
# common
|
|
|
|
|
2017-12-24 18:29:09 +00:00
|
|
|
$(SDL_OBJDIR)/%.o: $(SDL_SRCDIR)/%.c $(SDL_SRCDIR)/sdl.make $(BUILDDIR)/sysfont.h
|
2017-01-21 20:18:31 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2019-08-22 18:58:52 +00:00
|
|
|
$(call PRINTS,CC $(call full_path_subst,$(ROOTDIR)/%,%,$<))$(CC) -I$(dir $<) $(SDLFLAGS) -c $< -o $@
|
2017-01-21 20:18:31 +00:00
|
|
|
$(SILENT)$(OC) --redefine-syms=$(SDL_SRCDIR)/redefines.txt $@
|