summaryrefslogtreecommitdiff
path: root/apps/plugins/zxbox/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/zxbox/Makefile')
-rw-r--r--apps/plugins/zxbox/Makefile89
1 files changed, 89 insertions, 0 deletions
diff --git a/apps/plugins/zxbox/Makefile b/apps/plugins/zxbox/Makefile
new file mode 100644
index 0000000000..d9f75d44c5
--- /dev/null
+++ b/apps/plugins/zxbox/Makefile
@@ -0,0 +1,89 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7#
8
9INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
10 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) -I. $(TARGET_INC)
11CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
12 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
13
14
15ifdef APPEXTRA
16 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
17endif
18
19LINKFILE := $(OBJDIR)/link.lds
20DEPFILE = $(OBJDIR)/dep-zxbox
21
22# This sets up 'SRC' based on the files mentioned in SOURCES
23include $(TOOLSDIR)/makesrc.inc
24
25SOURCES = $(SRC)
26OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
27OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
28DIRS = .
29
30ifndef SIMVER
31ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
32 LDS := archos.lds
33 OUTPUT = $(OUTDIR)/zxbox.ovl
34else ## iRiver/iPod/... targets
35 LDS := ../plugin.lds
36 OUTPUT = $(OUTDIR)/zxbox.rock
37endif
38else ## simulators
39 OUTPUT = $(OUTDIR)/zxbox.rock
40endif
41
42all: $(OUTPUT)
43
44ifndef SIMVER
45$(OBJDIR)/zxbox.elf: $(OBJS) $(LINKFILE)
46 @echo "LD "`basename $@`
47 @$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
48 -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/zxbox.map
49
50$(OUTPUT): $(OBJDIR)/zxbox.elf
51 @echo "OBJCOPY "`basename $@`
52 @$(OC) -O binary $< $@
53else
54
55ifeq ($(SIMVER), sdl)
56###################################################
57# This is the SDL simulator version
58
59$(OUTPUT): $(OBJS)
60 @echo "LD $<"
61 @$(CC) $(CFLAGS) -shared $(OBJS) -L$(BUILDDIR) -lplugin -o $@
62ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
63# 'x' must be kept or you'll have "Win32 error 5"
64# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
65# #define ERROR_ACCESS_DENIED 5L
66else
67 @chmod -x $@
68endif
69
70endif
71endif # end of simulator section
72
73
74include $(TOOLSDIR)/make.inc
75
76# MEMORYSIZE should be passed on to this makefile with the chosen memory size
77# given in number of MB
78$(LINKFILE): $(LDS)
79 @echo "build "`basename $@`
80 @cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
81 $(DEFINES) -E -P - >$@
82
83clean:
84 @echo "cleaning zxbox"
85 @rm -rf $(OBJDIR)/zxbox
86 @rm -f $(OBJDIR)/zxbox.* $(DEPFILE)
87
88-include $(DEPFILE)
89