blob: 94359024f18dea1089db78af9f7161004ce2851a [file] [log] [blame]
Nils Wallménius0e496052007-09-24 15:57:32 +00001# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id $
8#
9
10INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
Nils Wallménius93787dd2007-09-27 18:29:50 +000012
13ifeq ($(CPU),coldfire)
14 MIDIOPTS = -O2
15else
16 MIDIOPTS = -O
17endif
18
19CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) $(MIDIOPTS) \
Nils Wallménius0e496052007-09-24 15:57:32 +000020 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
21
22ifdef APPEXTRA
23 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
24endif
25
26LINKFILE := $(OBJDIR)/link.lds
27DEPFILE = $(OBJDIR)/dep-midiplay
28
29# This sets up 'SRC' based on the files mentioned in SOURCES
30include $(TOOLSDIR)/makesrc.inc
31
32SOURCES = $(SRC)
33OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
34DIRS = .
35
36ifndef SIMVER
37 LDS := ../plugin.lds
38 OUTPUT = $(OUTDIR)/midiplay.rock
39else ## simulators
40 OUTPUT = $(OUTDIR)/midiplay.rock
41endif
42
43all: $(OUTPUT)
44
45ifndef SIMVER
46$(OBJDIR)/midiplay.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
47 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
48 $(LINKBITMAPS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/midiplay.map
49
50$(OUTPUT): $(OBJDIR)/midiplay.elf
51 $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
52else
53
54###################################################
55# This is the SDL simulator version
56
57$(OUTPUT): $(OBJS)
58 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
59ifeq ($(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
63else
64 @chmod -x $@
65endif
66
67endif # end of simulator section
68
69include $(TOOLSDIR)/make.inc
70
71# MEMORYSIZE should be passed on to this makefile with the chosen memory size
72# given in number of MB
73$(LINKFILE): $(LDS)
74 $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
75 $(DEFINES) -E -P - >$@
76
77clean:
78 $(call PRINTS,cleaning midiplay)rm -rf $(OBJDIR)/midiplay
79 $(SILENT)rm -f $(OBJDIR)/midiplay.* $(DEPFILE)
80
81-include $(DEPFILE)