diff options
Diffstat (limited to 'apps/plugins/zxbox/Makefile')
-rw-r--r-- | apps/plugins/zxbox/Makefile | 89 |
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 | |||
9 | INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | ||
10 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) -I. $(TARGET_INC) | ||
11 | CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \ | ||
12 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN | ||
13 | |||
14 | |||
15 | ifdef APPEXTRA | ||
16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) | ||
17 | endif | ||
18 | |||
19 | LINKFILE := $(OBJDIR)/link.lds | ||
20 | DEPFILE = $(OBJDIR)/dep-zxbox | ||
21 | |||
22 | # This sets up 'SRC' based on the files mentioned in SOURCES | ||
23 | include $(TOOLSDIR)/makesrc.inc | ||
24 | |||
25 | SOURCES = $(SRC) | ||
26 | OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o) | ||
27 | OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2)) | ||
28 | DIRS = . | ||
29 | |||
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 | ||
41 | |||
42 | all: $(OUTPUT) | ||
43 | |||
44 | ifndef 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 $< $@ | ||
53 | else | ||
54 | |||
55 | ifeq ($(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 $@ | ||
62 | ifeq ($(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 | ||
66 | else | ||
67 | @chmod -x $@ | ||
68 | endif | ||
69 | |||
70 | endif | ||
71 | endif # end of simulator section | ||
72 | |||
73 | |||
74 | include $(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 | |||
83 | clean: | ||
84 | @echo "cleaning zxbox" | ||
85 | @rm -rf $(OBJDIR)/zxbox | ||
86 | @rm -f $(OBJDIR)/zxbox.* $(DEPFILE) | ||
87 | |||
88 | -include $(DEPFILE) | ||
89 | |||