2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 OPT_FLAGS
=-O3
-funroll-loops
10 INCLUDES
= -I
$(APPSDIR
) -I..
-I.
-I
$(FIRMDIR
)/include -I
$(FIRMDIR
)/export \
11 -I
$(FIRMDIR
)/common
-I
$(FIRMDIR
)/drivers
-I
$(OUTDIR
) -I
$(BUILDDIR
) -I.
$(TARGET_INC
)
12 CFLAGS
= $(INCLUDES
) $(GCCOPTS
) $(TARGET
) $(EXTRA_DEFINES
) \
13 -DTARGET_ID
=$(TARGET_ID
) -DMEM
=${MEMORYSIZE} -DPLUGIN
$(OPT_FLAGS
) $(PROFILE_OPTS
)
16 INCLUDES
+= $(patsubst %,-I
$(APPSDIR
)/%,$(subst :, ,$(APPEXTRA
)))
19 LINKFILE
:= $(OBJDIR
)/link.lds
20 DEPFILE
= $(OBJDIR
)/dep-zxbox
22 # This sets up 'SRC' based on the files mentioned in SOURCES
23 include $(TOOLSDIR
)/makesrc.inc
26 OBJS2
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
27 OBJS
= $(patsubst %.S
, $(OBJDIR
)/%.o
, $(OBJS2
))
31 ifneq (,$(strip $(foreach tgt
,RECORDER ONDIO
,$(findstring $(tgt
),$(TARGET
)))))
33 OUTPUT
= $(OUTDIR
)/zxbox.ovl
34 else ## iRiver/iPod/... targets
36 OUTPUT
= $(OUTDIR
)/zxbox.rock
39 OUTPUT
= $(OUTDIR
)/zxbox.rock
45 $(OBJDIR
)/zxbox.elf
: $(OBJS
) $(LINKFILE
)
46 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -O
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
) -lplugin
-lgcc \
47 -T
$(LINKFILE
) -Wl
,-Map
,$(OBJDIR
)/zxbox.map
49 $(OUTPUT
): $(OBJDIR
)/zxbox.elf
50 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) -O binary
$< $@
54 ###################################################
55 # This is the SDL simulator version
58 $(call PRINTS
,LD
$(@F
))$(CC
) $(CFLAGS
) $(SHARED_FLAG
) $(OBJS
) -L
$(BUILDDIR
) -lplugin
-o
$@
59 ifeq ($(findstring CYGWIN
,$(UNAME
)),CYGWIN
)
60 # 'x' must be kept or you'll have "Win32 error 5"
61 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
62 # #define ERROR_ACCESS_DENIED 5L
68 endif # end of simulator section
71 include $(TOOLSDIR
)/make.inc
73 # MEMORYSIZE should be passed on to this makefile with the chosen memory size
74 # given in number of MB
76 $(call PRINTS
,build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) \
77 $(DEFINES
) -E
-P
- >$@
80 $(call PRINTS
,cleaning zxbox
)rm -rf
$(OBJDIR
)/zxbox
81 $(SILENT
)rm -f
$(OBJDIR
)/zxbox.
* $(DEPFILE
)