2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 ZXBOX_SRCDIR
= $(APPSDIR
)/plugins
/zxbox
11 ZXBOX_OBJDIR
= $(BUILDDIR
)/apps
/plugins
/zxbox
13 ZXBOX_SRC
:= $(call preprocess
, $(ZXBOX_SRCDIR
)/SOURCES
)
14 ZXBOX_OBJ
:= $(call c2obj
, $(ZXBOX_SRC
))
16 OTHER_SRC
+= $(ZXBOX_SRC
)
19 ifneq (,$(strip $(foreach tgt
,RECORDER ONDIO
,$(findstring $(tgt
),$(TARGET
)))))
21 ROCKS
+= $(ZXBOX_OBJDIR
)/zxbox.ovl
22 ZXBOX_OUTLDS
= $(ZXBOX_OBJDIR
)/zxbox.link
23 ZXBOX_LDFLAGS
= -T
$(ZXBOX_OUTLDS
) -Wl
,--gc-sections
-Wl
,-Map
,$(basename $@
).map
26 ROCKS
+= $(ZXBOX_OBJDIR
)/zxbox.rock
30 ROCKS
+= $(ZXBOX_OBJDIR
)/zxbox.rock
33 ZXBOXFLAGS
= $(filter-out -O
%,$(PLUGINFLAGS
)) -O3
-funroll-loops
35 $(ZXBOX_OBJDIR
)/zxbox.rock
: $(ZXBOX_OBJ
)
37 $(ZXBOX_OBJDIR
)/zxbox.refmap
: $(ZXBOX_OBJ
)
39 $(ZXBOX_OUTLDS
): $(PLUGIN_LDS
) $(ZXBOX_OBJDIR
)/zxbox.refmap
40 $(call PRINTS
,PP
$(@F
))$(call preprocess2file
,$<,$@
,-DOVERLAY_OFFSET
=$(shell \
41 $(TOOLSDIR
)/ovl_offset.pl
$(ZXBOX_OBJDIR
)/zxbox.refmap
))
43 $(ZXBOX_OBJDIR
)/zxbox.ovl
: $(ZXBOX_OBJ
) $(ZXBOX_OUTLDS
)
44 $(SILENT
)$(CC
) $(PLUGINFLAGS
) -o
$(basename $@
).elf \
47 -lgcc
$(ZXBOX_LDFLAGS
)
48 $(call PRINTS
,LD
$(@F
))$(OC
) -O binary
$(basename $@
).elf
$@
50 # special pattern rule for compiling zxbox with extra flags
51 $(ZXBOX_OBJDIR
)/%.o
: $(ZXBOX_SRCDIR
)/%.c
$(ZXBOX_SRCDIR
)/zxbox.make
52 $(SILENT
)mkdir
-p
$(dir $@
)
53 $(call PRINTS
,CC
$(subst $(ROOTDIR
)/,,$<))$(CC
) -I
$(dir $<) $(ZXBOXFLAGS
) -c
$< -o
$@