summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockboy/Makefile')
-rw-r--r--apps/plugins/rockboy/Makefile106
1 files changed, 106 insertions, 0 deletions
diff --git a/apps/plugins/rockboy/Makefile b/apps/plugins/rockboy/Makefile
new file mode 100644
index 0000000000..f6042a4b1b
--- /dev/null
+++ b/apps/plugins/rockboy/Makefile
@@ -0,0 +1,106 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers
12CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
13 -DMEM=${MEMORYSIZE} -DPLUGIN
14
15ifdef APPEXTRA
16 INCLUDES += -I$(APPSDIR)/$(APPEXTRA)
17endif
18
19LINKFILE := $(OBJDIR)/link.lds
20DEPFILE = $(OBJDIR)/dep-rockboy
21SRC = cpu.c emu.c events.c exports.c fastmem.c hw.c lcd.c lcdc.c loader.c \
22 main.c mem.c nosound.c rccmds.c rcvars.c rtc.c save.c sound.c split.c \
23 sys_rockbox.c rockboy.c
24SOURCES = $(SRC)
25OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
26DIRS = .
27
28ifndef SIMVER
29ifneq (,$(findstring RECORDER,$(TARGET))) ## Archos recorder targets
30 LDS := archos.lds
31 OUTPUT = $(OUTDIR)/rockboy.ovl
32else ## iRiver target
33 LDS := ../plugin.lds
34 OUTPUT = $(OUTDIR)/rockboy.rock
35endif
36else ## simulators
37 OUTPUT = $(OUTDIR)/rockboy.rock
38endif
39
40all: $(OUTPUT)
41
42ifndef SIMVER
43$(OBJDIR)/rockboy.elf: $(OBJS) $(LINKFILE) $(OUTDIR)/libplugin.a
44 @echo "LD $@"
45 @$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(OUTDIR) -lplugin -lgcc \
46 -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockboy.map
47
48$(OUTPUT): $(OBJDIR)/rockboy.elf
49 @echo "OBJCOPY $<"
50 @$(OC) -O binary $< $@
51else
52
53ifeq ($(SIMVER), x11)
54###################################################
55# This is the X11 simulator version
56
57$(OUTPUT): $(OBJS) $(OUTDIR)/libplugin.a
58 @echo "LD $@"
59 @$(CC) $(CFLAGS) -shared $(OBJS) -L$(OUTDIR) -lplugin -o $@
60ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
61# 'x' must be kept or you'll have "Win32 error 5"
62# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
63# #define ERROR_ACCESS_DENIED 5L
64else
65 @chmod -x $@
66endif
67
68else # end of x11-simulator
69###################################################
70# This is the win32 simulator version
71DLLTOOLFLAGS = --export-all
72DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
73
74$(OUTPUT): $(OBJS) $(OUTDIR)/libplugin.a
75 @echo "DLL $@"
76 @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
77 @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
78 $(OUTDIR)/libplugin.a -o $@
79ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
80# 'x' must be kept or you'll have "Win32 error 5"
81# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
82# #define ERROR_ACCESS_DENIED 5L
83else
84 @chmod -x $@
85endif
86endif # end of win32-simulator
87
88endif # end of simulator section
89
90
91include $(TOOLSDIR)/make.inc
92
93# MEM should be passed on to this makefile with the chosen memory size given
94# in number of MB
95$(LINKFILE): $(LDS)
96 @echo "build $@"
97 @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) \
98 -E -P - >$@
99
100clean:
101 @echo "cleaning rockboy"
102 @rm -rf $(OBJDIR)/rockboy
103 @rm -f $(OBJDIR)/rockboy.*
104
105-include $(DEPFILE)
106