2016-11-20 20:16:41 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
PUZZLES_SRCDIR = $(APPSDIR)/plugins/puzzles
|
|
|
|
PUZZLES_OBJDIR = $(BUILDDIR)/apps/plugins/puzzles
|
|
|
|
|
|
|
|
# define this as "yes" to do a monolithic build -- remember to also
|
|
|
|
# uncomment the sgt-puzzles loader in apps/plugins/SOURCES
|
|
|
|
PUZZLES_COMBINED =
|
|
|
|
|
|
|
|
ifdef PUZZLES_COMBINED
|
|
|
|
PUZZLES_SRC := $(call preprocess, $(PUZZLES_SRCDIR)/SOURCES, -DCOMBINED)
|
|
|
|
else
|
|
|
|
PUZZLES_SRC := $(call preprocess, $(PUZZLES_SRCDIR)/SOURCES)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef PUZZLES_COMBINED
|
|
|
|
PUZZLES_SHARED_OBJ := $(call c2obj, $(PUZZLES_SRC))
|
|
|
|
endif
|
|
|
|
|
|
|
|
PUZZLES_GAMES_SRC := $(call preprocess, $(PUZZLES_SRCDIR)/SOURCES.games)
|
|
|
|
PUZZLES_SRC += $(PUZZLES_GAMES_SRC)
|
|
|
|
PUZZLES_OBJ := $(call c2obj, $(PUZZLES_SRC))
|
|
|
|
OTHER_SRC += $(PUZZLES_SRC)
|
|
|
|
|
|
|
|
ifdef PUZZLES_COMBINED
|
|
|
|
ifndef APP_TYPE
|
|
|
|
ROCKS += $(PUZZLES_OBJDIR)/puzzles.ovl
|
|
|
|
PUZZLES_OUTLDS = $(PUZZLES_OBJDIR)/puzzles.link
|
|
|
|
PUZZLES_OVLFLAGS = -T$(PUZZLES_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map
|
|
|
|
else
|
|
|
|
ROCKS += $(PUZZLES_OBJDIR)/puzzles.rock
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
PUZZLES_ROCKS := $(addprefix $(PUZZLES_OBJDIR)/sgt-, $(notdir $(PUZZLES_GAMES_SRC:.c=.rock)))
|
|
|
|
ROCKS += $(PUZZLES_ROCKS)
|
|
|
|
endif
|
|
|
|
|
2017-01-16 15:38:15 +00:00
|
|
|
PUZZLESOPTIMIZE := -O2
|
2017-01-15 19:07:18 +00:00
|
|
|
ifeq ($(MODELNAME), sansac200v2)
|
|
|
|
PUZZLESOPTIMIZE := -Os
|
|
|
|
endif
|
|
|
|
|
|
|
|
# we suppress all warnings
|
|
|
|
PUZZLESFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) $(PUZZLESOPTIMIZE) \
|
2017-01-09 18:21:27 +00:00
|
|
|
-Wno-unused-parameter -Wno-sign-compare -Wno-strict-aliasing -w \
|
2017-01-05 01:31:06 +00:00
|
|
|
-DFOR_REAL -I$(PUZZLES_SRCDIR)
|
2016-11-20 20:16:41 +00:00
|
|
|
ifdef PUZZLES_COMBINED
|
|
|
|
PUZZLESFLAGS += -DCOMBINED
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef PUZZLES_COMBINED
|
|
|
|
$(PUZZLES_OBJDIR)/puzzles.rock: $(PUZZLES_OBJ) $(TLSFLIB)
|
|
|
|
|
|
|
|
$(PUZZLES_OBJDIR)/puzzles.refmap: $(PUZZLES_OBJ) $(TLSFLIB)
|
|
|
|
|
|
|
|
$(PUZZLES_OUTLDS): $(PLUGIN_LDS) $(PUZZLES_OBJDIR)/puzzles.refmap
|
|
|
|
$(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
|
|
|
|
$(TOOLSDIR)/ovl_offset.pl $(PUZZLES_OBJDIR)/puzzles.refmap))
|
|
|
|
|
|
|
|
$(PUZZLES_OBJDIR)/puzzles.ovl: $(PUZZLES_OBJ) $(PUZZLES_OUTLDS) $(TLSFLIB)
|
|
|
|
$(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
|
|
|
|
$(filter %.o, $^) \
|
|
|
|
$(filter %.a, $+) \
|
|
|
|
-lgcc $(PUZZLES_OVLFLAGS)
|
|
|
|
$(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
|
|
|
|
else
|
2017-02-10 03:34:20 +00:00
|
|
|
$(PUZZLES_OBJDIR)/sgt-%.rock: $(PUZZLES_OBJDIR)/%.o $(PUZZLES_SHARED_OBJ) $(TLSFLIB)
|
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
|
|
|
|
$(filter %.o, $^) \
|
|
|
|
$(filter %.a, $+) \
|
|
|
|
-lgcc $(PLUGINLDFLAGS)
|
|
|
|
$(SILENT)$(call objcopy,$(BUILDDIR)/$*.elf,$@)
|
2016-11-20 20:16:41 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# special pattern rule for compiling puzzles with extra flags
|
|
|
|
$(PUZZLES_OBJDIR)/%.o: $(PUZZLES_SRCDIR)/%.c $(PUZZLES_SRCDIR)/puzzles.make
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PUZZLESFLAGS) -c $< -o $@
|
2017-01-05 01:31:06 +00:00
|
|
|
|
|
|
|
$(PUZZLES_OBJDIR)/unfinished/%.o: $(PUZZLES_SRCDIR)/unfinished/%.c $(PUZZLES_SRCDIR)/puzzles.make
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PUZZLESFLAGS) -c $< -o $@
|