Next step of Makefile tuning: * Use 'make' internal commands for printing messages...
[Rockbox.git] / apps / plugins / zxbox / Makefile
blob3ca5d300f1ad35d4f8e4783787b3d6ba8d2195f5
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
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)
15 ifdef APPEXTRA
16 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
17 endif
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
25 SOURCES = $(SRC)
26 OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
27 OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
28 DIRS = .
30 ifndef SIMVER
31 ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
32 LDS := archos.lds
33 OUTPUT = $(OUTDIR)/zxbox.ovl
34 else ## iRiver/iPod/... targets
35 LDS := ../plugin.lds
36 OUTPUT = $(OUTDIR)/zxbox.rock
37 endif
38 else ## simulators
39 OUTPUT = $(OUTDIR)/zxbox.rock
40 endif
42 all: $(OUTPUT)
44 ifndef SIMVER
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 $< $@
51 else
53 ifeq ($(SIMVER), sdl)
54 ###################################################
55 # This is the SDL simulator version
57 $(OUTPUT): $(OBJS)
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
63 else
64 @chmod -x $@
65 endif
67 endif
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
75 $(LINKFILE): $(LDS)
76 $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
77 $(DEFINES) -E -P - >$@
79 clean:
80 $(call PRINTS,cleaning zxbox)rm -rf $(OBJDIR)/zxbox
81 $(SILENT)rm -f $(OBJDIR)/zxbox.* $(DEPFILE)
83 -include $(DEPFILE)