Colour targets: Revert an optimisation from almost 18 months ago that actually turned...
[Rockbox.git] / apps / plugins / mpegplayer / Makefile
blob66a614239739761deff347ae53e1babd663d36e4
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(APPSDIR)/plugins/lib -I$(OUTDIR) -I$(BUILDDIR)
12 CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
13 -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
15 ifdef APPEXTRA
16 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
17 endif
19 LINKFILE := $(OBJDIR)/link.lds
20 DEPFILE = $(OBJDIR)/dep-mpegplayer
22 # This sets up 'SRC' based on the files mentioned in SOURCES
23 include $(TOOLSDIR)/makesrc.inc
25 SOURCES = $(SRC)
26 OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
27 OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
28 DIRS = .
30 LDS := ../plugin.lds
31 OUTPUT = $(OUTDIR)/mpegplayer.rock
33 all: $(OUTPUT)
35 .PHONY: libmad-mpegplayer
37 $(BUILDDIR)/libmad-mpegplayer.a: libmad-mpegplayer
39 libmad-mpegplayer:
40 $(SILENT)mkdir -p $(OBJDIR)/libmad-mpegplayer
41 $(call PRINTS,MAKE in libmad for mpegplayer)$(MAKE) -C $(APPSDIR)/codecs/libmad MPEGPLAYER=1 OBJDIR=$(OBJDIR)/libmad-mpegplayer OUTPUT=$(BUILDDIR)/libmad-mpegplayer.a
43 ifndef SIMVER
44 $(OBJDIR)/mpegplayer.elf: $(OBJS) $(LINKFILE) $(BUILDDIR)/libmad-mpegplayer.a
45 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lmad-mpegplayer -lgcc\
46 $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/mpegplayer.map
48 $(OUTPUT): $(OBJDIR)/mpegplayer.elf
49 $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
50 else
51 # This is the SDL simulator version
53 $(OUTPUT): $(OBJS) $(BUILDDIR)/libmad-mpegplayer.a
54 $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -lmad-mpegplayer -o $@
55 ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
56 # 'x' must be kept or you'll have "Win32 error 5"
57 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
58 # #define ERROR_ACCESS_DENIED 5L
59 else
60 @chmod -x $@
61 endif
63 endif # end of sdl-simulator
65 include $(TOOLSDIR)/make.inc
67 # MEMORYSIZE should be passed on to this makefile with the chosen memory size
68 # given in number of MB
69 $(LINKFILE): $(LDS)
70 $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
71 $(DEFINES) -E -P - >$@
73 clean:
74 $(call PRINTS,cleaning mpegplayer)rm -rf $(OBJDIR)/mpegplayer
75 $(SILENT)rm -f $(OBJDIR)/mpegplayer.* $(DEPFILE)
77 -include $(DEPFILE)