Nils Wallménius | 0e49605 | 2007-09-24 15:57:32 +0000 | [diff] [blame] | 1 | # __________ __ ___. |
| 2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 6 | # \/ \/ \/ \/ \/ |
| 7 | # $Id $ |
| 8 | # |
| 9 | |
| 10 | INCLUDES = -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énius | 93787dd | 2007-09-27 18:29:50 +0000 | [diff] [blame] | 12 | |
| 13 | ifeq ($(CPU),coldfire) |
| 14 | MIDIOPTS = -O2 |
| 15 | else |
| 16 | MIDIOPTS = -O |
| 17 | endif |
| 18 | |
| 19 | CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) $(MIDIOPTS) \ |
Nils Wallménius | 0e49605 | 2007-09-24 15:57:32 +0000 | [diff] [blame] | 20 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN |
| 21 | |
| 22 | ifdef APPEXTRA |
| 23 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) |
| 24 | endif |
| 25 | |
| 26 | LINKFILE := $(OBJDIR)/link.lds |
| 27 | DEPFILE = $(OBJDIR)/dep-midiplay |
| 28 | |
| 29 | # This sets up 'SRC' based on the files mentioned in SOURCES |
| 30 | include $(TOOLSDIR)/makesrc.inc |
| 31 | |
| 32 | SOURCES = $(SRC) |
| 33 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) |
| 34 | DIRS = . |
| 35 | |
| 36 | ifndef SIMVER |
| 37 | LDS := ../plugin.lds |
| 38 | OUTPUT = $(OUTDIR)/midiplay.rock |
| 39 | else ## simulators |
| 40 | OUTPUT = $(OUTDIR)/midiplay.rock |
| 41 | endif |
| 42 | |
| 43 | all: $(OUTPUT) |
| 44 | |
| 45 | ifndef 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 $< $@ |
| 52 | else |
| 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 $@ |
| 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 |
| 66 | |
| 67 | endif # end of simulator section |
| 68 | |
| 69 | include $(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 | |
| 77 | clean: |
| 78 | $(call PRINTS,cleaning midiplay)rm -rf $(OBJDIR)/midiplay |
| 79 | $(SILENT)rm -f $(OBJDIR)/midiplay.* $(DEPFILE) |
| 80 | |
| 81 | -include $(DEPFILE) |