Cleaner solution to plugin-included core files.
[kugel-rb.git] / apps / plugins / doom / doom.make
blobfc73729c228d63e1ce31404b115a884706eeb5fc
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 DOOMSRCDIR := $(APPSDIR)/plugins/doom
11 DOOMBUILDDIR := $(BUILDDIR)/apps/plugins/doom
13 ROCKS += $(DOOMBUILDDIR)/doom.rock
15 DOOM_SRC := $(call preprocess, $(DOOMSRCDIR)/SOURCES)
16 DOOM_SRC += $(ROOTDIR)/firmware/common/sscanf.c
17 DOOM_OBJ := $(call c2obj, $(DOOM_SRC))
19 # add source files to OTHER_SRC to get automatic dependencies
20 OTHER_SRC += $(DOOM_SRC)
22 DOOMCFLAGS = $(PLUGINFLAGS) -Wno-strict-prototypes
24 # The arm code compiles too large for the plugin buffer when set to optimize for speed
25 ifeq ($(CPU), arm)
26 DOOMCFLAGS += -Os
27 ifndef SIMVER
28 ifeq ($(TARGET), IRIVER_H100)
29 DOOMCCFLAGS += -mstructure-size-boundary=8
30 endif
31 endif
32 else
33 DOOMCFLAGS += -O2
34 endif
36 $(DOOMBUILDDIR)/doom.rock: $(DOOM_OBJ)
37 # for some reason, this doesn't match the implicit rule in plugins.make,
38 # so we have to duplicate the link command here
39 $(call PRINTS,LD $(@F))
40 $(SILENT)$(CC) $(PLUGINFLAGS) -o $*.elf \
41 $(filter %.o, $^) \
42 $(filter %.a, $^) \
43 -lgcc $(PLUGINLDFLAGS)
44 ifdef SIMVER
45 $(SILENT)cp $*.elf $@
46 else
47 $(SILENT)$(OC) -O binary $*.elf $@
48 endif
50 # new rule needed to use extra compile flags
51 $(DOOMBUILDDIR)/%.o: $(DOOMSRCDIR)/%.c
52 $(SILENT)mkdir -p $(dir $@)
53 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(DOOMCFLAGS) -c $< -o $@