New makefile solution: A single invocation of 'make' to build the entire tree. Fully controlled dependencies give faster and more correct recompiles.
Many #include lines adjusted to conform to the new standards.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19146 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/Makefile b/apps/Makefile
deleted file mode 100644
index 97d7c77..0000000
--- a/apps/Makefile
+++ /dev/null
@@ -1,268 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. \
- -I$(BUILDDIR) -I$(BUILDDIR)/bitmaps -I$(OBJDIR)
-
-DEPFILE = $(OBJDIR)/dep-apps
-
-LDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/app.lds
-
-ROMLDS := $(FIRMDIR)/rom.lds
-
-ifdef SOFTWARECODECS
-CODECS=build-codecs
-
-# This sets up the parameters for building and linking libspeex for core voice
-VOICE=libspeex-rockbox
-LINKVOICE= -lspeex-rockbox
-
-endif
-
-# Set up the bitmap libraries
-BITMAPLIBS =
-LINKBITMAPS =
-ifneq ($(strip $(BMP2RB_MONO)),)
- BITMAPLIBS += bitmapsmono
- LINKBITMAPS += -lbitmapsmono
-endif
-ifneq ($(strip $(BMP2RB_NATIVE)),)
- BITMAPLIBS += bitmapsnative
- LINKBITMAPS += -lbitmapsnative
-endif
-ifneq ($(strip $(BMP2RB_REMOTEMONO)),)
- BITMAPLIBS += bitmapsremotemono
- LINKBITMAPS += -lbitmapsremotemono
-endif
-ifneq ($(strip $(BMP2RB_REMOTENATIVE)),)
- BITMAPLIBS += bitmapsremotenative
- LINKBITMAPS += -lbitmapsremotenative
-endif
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-DEFINES = $(DEBUG)
-
-DIRS = .
-
-ifdef APPEXTRA
- DIRS += $(subst :, ,$(APPEXTRA))
- INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA)))
-endif
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(BUILDDATE) $(DEFINES) \
- -DTARGET_ID=$(TARGET_ID) \
- -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} \
- -DTARGET_NAME=\"$(MODELNAME)\"
-
-OBJS2 := $(OBJDIR)/lang.o $(patsubst %.c, $(OBJDIR)/%.o, $(SRC))
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-SOURCES = $(SRC)
-LINKFILE = $(OBJDIR)/linkage.lds
-LINKROM = $(OBJDIR)/linkrom.lds
-MAXINFILE = $(OBJDIR)/romstart.temp
-MAXOUTFILE = $(OBJDIR)/romstart
-
-LIBROCKBOX = $(BUILDDIR)/librockbox.a
-
-ifdef SIMVER
-# this is a sim build
-
-all: simbuild
-
-else
-# regular target build
-
-ifdef DEBUG
-REALBIN = $(OBJDIR)/rockbox.elf
-else
-# this is not needed to get built when doing debug builds
-REALBIN = $(BUILDDIR)/$(BINARY)
-endif
-
-all: build
-
-endif
-
-build: $(DEPFILE) $(BITMAPLIBS) build-codecs build-pluginlib
-ifdef ENABLEDPLUGINS
- $(call PRINTS,MAKE in plugins)$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins
-endif
- $(call PRINTS,MAKE in apps)$(MAKE) $(REALBIN) $(FLASHFILE) $(ARCHOSROM)
-
-simbuild: $(DEPFILE) $(BITMAPLIBS) build-codecs build-pluginlib
-ifdef ENABLEDPLUGINS
- $(call PRINTS,MAKE in plugins)$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins
-endif
- $(call PRINTS,MAKE in apps)$(MAKE) $(BUILDDIR)/$(BINARY)
-
-build-codecs:
-ifdef SOFTWARECODECS
- $(SILENT)$(MAKE) -C codecs/lib OBJDIR=$(OBJDIR)/codecs/lib
- $(SILENT)$(MAKE) -C codecs OBJDIR=$(OBJDIR)/codecs
-endif
-
-build-pluginlib:
-ifdef ENABLEDPLUGINS
- $(SILENT)$(MAKE) -C plugins/lib OBJDIR=$(OBJDIR)/plugins/lib
-endif
-
-bitmapsmono:
- $(call PRINTS,MAKE in bitmaps/mono)$(MAKE) -C bitmaps/mono OBJDIR=$(OBJDIR)/bitmaps/mono
-
-bitmapsnative:
- $(call PRINTS,MAKE in bitmaps/native)$(MAKE) -C bitmaps/native OBJDIR=$(OBJDIR)/bitmaps/native
-
-bitmapsremotemono:
- $(call PRINTS,MAKE in bitmaps/remote_mono)$(MAKE) -C bitmaps/remote_mono OBJDIR=$(OBJDIR)/bitmaps/remote_mono
-
-bitmapsremotenative:
- $(call PRINTS,MAKE in bitmaps/remote_native)$(MAKE) -C bitmaps/remote_native OBJDIR=$(OBJDIR)/bitmaps/remote_native
-
-rocks: build-codecs build-pluginlib
- $(SILENT)$(MAKE) -C plugins OBJDIR=$(OBJDIR)/plugins
-
-libspeex-rockbox:
- $(SILENT)mkdir -p $(OBJDIR)/libspeex-rockbox
- $(call PRINTS,MAKE in libspeex for rockbox core)$(MAKE) -C $(APPSDIR)/codecs/libspeex ROCKBOX_VOICE_CODEC=1 OBJDIR=$(OBJDIR)/libspeex-rockbox OUTPUT=$(BUILDDIR)/libspeex-rockbox.a
-
-$(LINKFILE): $(LDS)
- $(call PRINTS,Build $(@F))cat $< | $(CC) -DLOADADDRESS=$(LOADADDRESS) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
-
-$(LINKROM): $(ROMLDS)
- $(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
-
-$(MAXOUTFILE):
- $(SILENT)echo '#include "config.h"' > $(MAXINFILE)
- $(SILENT)echo "ROM_START" >> $(MAXINFILE)
- $(SILENT)cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
- $(SILENT)rm $(MAXINFILE)
-
-$(OBJDIR)/rombox.elf : $(LINKROM) $(LIBROCKBOX) $(VOICE)
- $(call PRINTS,MAKE objs)$(MAKE) objs
- $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lgcc $(LINKVOICE) $(LINKBITMAPS) -L$(BUILDDIR)/firmware -T$(LINKROM) -Wl,-Map,$(OBJDIR)/rombox.map
-
-objs: $(OBJS)
-
-ifndef SIMVER
-
-$(OBJDIR)/rockbox.elf : $(LINKFILE) $(LIBROCKBOX) $(VOICE) $(BITMAPLIBS)
- $(call PRINTS,MAKE objs)$(MAKE) objs
- $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR)/firmware -L$(BUILDDIR) -lrockbox $(LINKVOICE) $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map
-
-$(OBJDIR)/rockbox.bin : $(OBJDIR)/rockbox.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
-
-$(OBJDIR)/rombox.bin : $(OBJDIR)/rombox.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-
-$(OBJDIR)/rockbox.asm: $(OBJDIR)/rockbox.bin
- $(TOOLSDIR)/sh2d -sh1 $< > $@
-
-#
-# If there's a flashfile defined for this target (rockbox.ucl for Archos
-# models) Then check if the mkfirmware script fails, as then it is (likely)
-# because the image is too big and we need to create a compressed image
-# instead.
-#
-$(BUILDDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin $(FLASHFILE) $(BITMAPLIBS)
- $(call PRINTS,Build firmware file)($(MKFIRMWARE) $< $@; \
- stat=$$?; \
- if test -n "$(FLASHFILE)"; then \
- if test "$$stat" -ne 0; then \
- echo "Image too big, making a compressed version!"; \
- $(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \
- $(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \
- fi \
- fi )
-
-else
-# this is a simulator build
-
-ifeq ($(SIMVER), win32)
-# OK, this is ugly but we need it on the link line to make it do right
-EXTRAOBJ = $(BUILDDIR)/sim/uisw32-res.o
-LDOPTS += -lwinmm
-endif
-
-# OS X's ld does not support -Map
-ifeq ($(UNAME), Darwin)
-SIMULATOR_MAP=
-else
-#SIMULATOR_MAP=-Wl,-Map,$(OBJDIR)/rockbox.map
-endif
-
-$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/libsim.a \
- $(BUILDDIR)/libcomsim.a $(LIBROCKBOX) $(VOICE) $(BITMAPLIBS)
- $(call PRINTS,MAKE objs)$(MAKE) objs
- $(call PRINTS,LD $(BINARY))$(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(BUILDDIR) -lrockbox -lsim -lcomsim $(LINKVOICE) $(LINKBITMAPS) $(LDOPTS) $(EXTRAOBJ) $(SIMULATOR_MAP)
-endif
-
-$(BUILDDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin
- $(call PRINTS,UCLPACK rockbox)$(TOOLSDIR)/uclpack --best --2e -b1048576 $< $@ >/dev/null 2>&1
-
-$(BUILDDIR)/rombox.ucl: $(OBJDIR)/rombox.bin $(MAXOUTFILE)
- $(call PRINTS,UCLPACK rombox)$(TOOLSDIR)/uclpack --none $< $@ >/dev/null 2>&1; \
- perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
- if test $$? -ne 0; then \
- echo "removing UCL file again, making it a fake one"; \
- echo "fake" > $@; \
- fi
-
-$(BUILDDIR)/rombox.iriver: $(OBJDIR)/rombox.bin
- $(call PRINTS,Build ROM file)$(MKFIRMWARE) $< $@
-
-# make.inc contains the $(DEPFILE) generation
-include $(TOOLSDIR)/make.inc
-
-# apps/features.txt is a file that (is preprocessed and) lists named features
-# based on defines in the config-*.h files. The named features will be passed
-# to genlang and thus (translated) phrases can be used based on those names.
-# button.h is included for the HAS_BUTTON_HOLD define.
-#
-
-features: $(OBJDIR)/features
-
-$(OBJDIR)/features: features.txt
- $(SILENT)mkdir -p $(OBJDIR)
- $(SILENT)cat $< | $(HOSTCC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
- $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -imacros "config.h" -imacros "button.h" - | \
- grep -v "^\#" | grep -v "^$$" > $@; \
- for f in `cat $(OBJDIR)/features`; do feat="$$feat:$$f" ; done ; \
- echo "$$feat" >$(OBJDIR)/genlang-features
-
-$(OBJDIR)/lang.o: lang/$(LANGUAGE).lang $(OBJDIR)/features
- $(SILENT)for f in `cat $(OBJDIR)/features`; do feat="$$feat:$$f" ; done; \
- perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $<
- $(call PRINTS,CC lang.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang.c -o $@
-
-clean:
- $(call PRINTS,cleaning apps)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/rockbox.asm \
- $(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.elf $(OBJDIR)/*.map \
- $(OBJDIR)/lang.o $(OBJDIR)/build.lang $(BUILDDIR)/lang.[ch] \
- $(LINKFILE) $(BUILDDIR)/rockbox.ucl $(LINKROM) \
- $(BUILDDIR)/rombox.ucl $(OBJDIR)/rombox.bin $(OBJDIR)/rombox.elf \
- $(MAXOUTFILE) $(DEPFILE)
- $(SILENT)$(MAKE) -C bitmaps/mono clean OBJDIR=$(OBJDIR)/bitmaps/mono
- $(SILENT)$(MAKE) -C bitmaps/native clean OBJDIR=$(OBJDIR)/bitmaps/native
- $(SILENT)$(MAKE) -C bitmaps/remote_mono clean OBJDIR=$(OBJDIR)/bitmaps/remote_mono
- $(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native
- $(SILENT)$(MAKE) -C plugins clean OBJDIR=$(OBJDIR)/plugins
- $(SILENT)$(MAKE) -C codecs clean OBJDIR=$(OBJDIR)/codecs
- $(SILENT)rm -rf $(OBJDIR)/recorder $(OBJDIR)/player
- $(SILENT)rm -rf $(BUILDDIR)/bitmaps
- $(SILENT)rm -rf $(BUILDDIR)/pluginbitmaps
-ifdef SIMVER
- $(SILENT)$(MAKE) -C $(SIMDIR) clean
-endif
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/apps.make b/apps/apps.make
new file mode 100644
index 0000000..1b0bf64
--- /dev/null
+++ b/apps/apps.make
@@ -0,0 +1,25 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+INCLUDES += -I$(APPSDIR) $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
+SRC += $(call preprocess, $(APPSDIR)/SOURCES)
+
+# apps/features.txt is a file that (is preprocessed and) lists named features
+# based on defines in the config-*.h files. The named features will be passed
+# to genlang and thus (translated) phrases can be used based on those names.
+# button.h is included for the HAS_BUTTON_HOLD define.
+#
+features $(BUILDDIR)/apps/features $(BUILDDIR)/apps/genlang-features: $(APPSDIR)/features.txt
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,PP $(<F))
+ $(SILENT)$(CC) $(PPCFLAGS) \
+ -E -P -imacros "config.h" -imacros "button.h" -x c $< | \
+ grep -v "^\#" | grep -v "^$$" > $@; \
+ for f in `cat $@`; do feat="$$feat:$$f" ; done ; \
+ echo "$$feat" >$(BUILDDIR)/apps/genlang-features
diff --git a/apps/bitmaps/bitmaps.make b/apps/bitmaps/bitmaps.make
new file mode 100644
index 0000000..8d00545
--- /dev/null
+++ b/apps/bitmaps/bitmaps.make
@@ -0,0 +1,51 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+BITMAPDIR = $(ROOTDIR)/apps/bitmaps
+BMPINCDIR = $(BUILDDIR)/bitmaps
+
+INCLUDES += -I$(BMPINCDIR)
+
+ifneq ($(strip $(BMP2RB_MONO)),)
+BMP = $(call preprocess, $(BITMAPDIR)/mono/SOURCES)
+endif
+ifneq ($(strip $(BMP2RB_NATIVE)),)
+BMP += $(call preprocess, $(BITMAPDIR)/native/SOURCES)
+endif
+ifneq ($(strip $(BMP2RB_REMOTEMONO)),)
+BMP += $(call preprocess, $(BITMAPDIR)/remote_mono/SOURCES)
+endif
+ifneq ($(strip $(BMP2RB_REMOTENATIVE)),)
+BMP += $(call preprocess, $(BITMAPDIR)/remote_native/SOURCES)
+endif
+
+BMPOBJ = $(BMP:$(ROOTDIR)/%.bmp=$(BUILDDIR)/%.o)
+
+BMPHFILES = $(BMPINCDIR)/usblogo.h $(BMPINCDIR)/remote_usblogo.h \
+ $(BMPINCDIR)/default_icons.h $(BMPINCDIR)/remote_default_icons.h \
+ $(BMPINCDIR)/rockboxlogo.h $(BMPINCDIR)/remote_rockboxlogo.h
+
+$(BMPHFILES): $(BMPOBJ)
+
+# pattern rules to create .c files from .bmp, one for each subdir:
+$(BUILDDIR)/apps/bitmaps/mono/%.c: $(ROOTDIR)/apps/bitmaps/mono/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(BMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_MONO) -h $(BMPINCDIR) $< > $@
+
+$(BUILDDIR)/apps/bitmaps/native/%.c: $(ROOTDIR)/apps/bitmaps/native/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(BMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_NATIVE) -h $(BMPINCDIR) $< > $@
+
+$(BUILDDIR)/apps/bitmaps/remote_mono/%.c: $(ROOTDIR)/apps/bitmaps/remote_mono/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(BMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_REMOTEMONO) -h $(BMPINCDIR) $< > $@
+
+$(BUILDDIR)/apps/bitmaps/remote_native/%.c: $(ROOTDIR)/apps/bitmaps/remote_native/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(BMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_REMOTENATIVE) -h $(BMPINCDIR) $< > $@
diff --git a/apps/bitmaps/mono/Makefile b/apps/bitmaps/mono/Makefile
deleted file mode 100644
index 28893e9..0000000
--- a/apps/bitmaps/mono/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-mono
-
-BMP2RB = $(BMP2RB_MONO)
-OUTPUT = $(BUILDDIR)/libbitmapsmono.a
-BMPINCDIR = $(BUILDDIR)/bitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning bitmaps/mono)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- $(SILENT)rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/bitmaps/native/Makefile b/apps/bitmaps/native/Makefile
deleted file mode 100644
index 96f7e50..0000000
--- a/apps/bitmaps/native/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-native
-
-BMP2RB = $(BMP2RB_NATIVE)
-OUTPUT = $(BUILDDIR)/libbitmapsnative.a
-BMPINCDIR = $(BUILDDIR)/bitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning bitmaps/native)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- $(SILENT)rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/bitmaps/remote_mono/Makefile b/apps/bitmaps/remote_mono/Makefile
deleted file mode 100644
index db707c7..0000000
--- a/apps/bitmaps/remote_mono/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-remotemono
-
-BMP2RB = $(BMP2RB_REMOTEMONO)
-OUTPUT = $(BUILDDIR)/libbitmapsremotemono.a
-BMPINCDIR = $(BUILDDIR)/bitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning bitmaps/remotemono)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- $(SILENT)rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/bitmaps/remote_native/Makefile b/apps/bitmaps/remote_native/Makefile
deleted file mode 100644
index 03eccfd..0000000
--- a/apps/bitmaps/remote_native/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-remotenative
-
-BMP2RB = $(BMP2RB_REMOTENATIVE)
-OUTPUT = $(BUILDDIR)/libbitmapsremotenative.a
-BMPINCDIR = $(BUILDDIR)/bitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning bitmaps/remote_native)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- $(SILENT)rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/codecs/Makefile b/apps/codecs/Makefile
deleted file mode 100644
index 6d3f1f6..0000000
--- a/apps/codecs/Makefile
+++ /dev/null
@@ -1,256 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \
- -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DCODEC
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-ifdef SOFTWARECODECS
- CODECLIBS = -lspc -lmad -la52 -lffmpegFLAC -ltremor -lwavpack -lmusepack -lalac -lfaad -lm4a -lspeex -ldemac -lwma -lasap
- OUTPUT = libspc libmad liba52 libffmpegFLAC libwma libtremor libwavpack libmusepack libalac libfaad libm4a libspeex libdemac libasap
-endif
-
-# we "borrow" the plugin LDS file
-LDS := $(APPSDIR)/plugins/plugin.lds
-
-LINKCODEC := $(OBJDIR)/codeclink.lds
-DEPFILE = $(OBJDIR)/dep-codecs
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-ROCKS := $(SRC:%.c=$(OBJDIR)/%.codec)
-SOURCES = $(SRC)
-ELFS := $(SRC:%.c=$(OBJDIR)/%.elf)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-# as created by the cross-compiler for win32:
-DEFS := $(SRC:%.c=$(OBJDIR)/%.def)
-DIRS = .
-
-CODECLIB := $(BUILDDIR)/libcodec.a
-CODECDEPS = $(LINKCODEC) $(CODECLIB)
-
-.PHONY: libspc libmad liba52 libffmpegFLAC libtremor libspeex libwavpack libmusepack libalac libfaad libm4a libdemac libwma libasap
-
-all: $(LINKCODEC) $(ROCKS)
-
-ifndef SIMVER
-$(BUILDDIR)/%.a : % $(CODECDEPS)
-
-# special dependencies
-$(OBJDIR)/spc.elf : $(BUILDDIR)/libspc.a
-$(OBJDIR)/mpa.elf : $(BUILDDIR)/libmad.a
-$(OBJDIR)/a52.elf : $(BUILDDIR)/liba52.a
-$(OBJDIR)/flac.elf : $(BUILDDIR)/libffmpegFLAC.a
-$(OBJDIR)/vorbis.elf : $(BUILDDIR)/libtremor.a
-$(OBJDIR)/speex.elf : $(BUILDDIR)/libspeex.a
-$(OBJDIR)/mpc.elf : $(BUILDDIR)/libmusepack.a
-$(OBJDIR)/wavpack.elf : $(BUILDDIR)/libwavpack.a
-$(OBJDIR)/alac.elf : $(BUILDDIR)/libalac.a $(BUILDDIR)/libm4a.a
-$(OBJDIR)/aac.elf : $(BUILDDIR)/libfaad.a $(BUILDDIR)/libm4a.a
-$(OBJDIR)/shorten.elf : $(BUILDDIR)/libffmpegFLAC.a
-$(OBJDIR)/ape.elf : $(BUILDDIR)/libdemac.a
-$(OBJDIR)/wma.elf : $(BUILDDIR)/libwma.a
-$(OBJDIR)/wavpack_enc.elf: $(BUILDDIR)/libwavpack.a
-$(OBJDIR)/asap.elf : $(BUILDDIR)/libasap.a
-
-# standard dependencies
-$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(OBJDIR)/codec_crt0.o $(CODECLIB)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $^ \
- -L$(BUILDDIR) -lcodec -lgcc -T$(LINKCODEC) \
- -Wl,--gc-sections,-Map,$(OBJDIR)/$*.map
-
-$(OBJDIR)/%.codec : $(OBJDIR)/%.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(OBJDIR)/codec_crt0.o $(BUILDDIR)/libcodec.a $(OUTPUT)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< $(OBJDIR)/codec_crt0.o -L$(BUILDDIR) $(CODECLIBS) -lcodec -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- $(SILENT)chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(OBJDIR)/codec_crt0.o $(BUILDDIR)/libcodec.a $(OUTPUT)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< $(OBJDIR)/codec_crt0.o -L$(BUILDDIR) $(CODECLIBS) -lcodec -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- $(SILENT)chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OBJDIR)/%.codec : $(OBJDIR)/%.o $(OBJDIR)/codec_crt0.o $(BUILDDIR)/libcodec.a $(OUTPUT)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< $(OBJDIR)/codec_crt0.o
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/codec_crt0.o\
- $(BUILDDIR)/libcodec.a $(patsubst -l%,$(BUILDDIR)/lib%.a,$(CODECLIBS)) \
- -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- $(SILENT)chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-
-endif # end of simulator section
-
-include $(TOOLSDIR)/make.inc
-
-$(BUILDDIR)/libcodec.a:
- $(SILENT)mkdir -p $(OBJDIR)/lib
- $(call PRINTS,MAKE in codecs/lib)$(MAKE) -C lib OBJDIR=$(OBJDIR)/lib
-
-$(LINKCODEC): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) -DCODEC $(INCLUDES) $(TARGET) $(DEFINES) -E -P - >$@
-
-$(BUILDDIR)/libspc.a: libspc
-
-libspc:
- $(SILENT)mkdir -p $(OBJDIR)/libspc
- $(call PRINTS,MAKE in libspc)$(MAKE) -C libspc OBJDIR=$(OBJDIR)/libspc OUTPUT=$(BUILDDIR)/libspc.a
-
-$(BUILDDIR)/libmad.a: libmad
-
-libmad:
- $(SILENT)mkdir -p $(OBJDIR)/libmad
- $(call PRINTS,MAKE in libmad)$(MAKE) -C libmad OBJDIR=$(OBJDIR)/libmad OUTPUT=$(BUILDDIR)/libmad.a
-
-$(BUILDDIR)/liba52.a: liba52
-
-liba52:
- $(SILENT)mkdir -p $(OBJDIR)/liba52
- $(call PRINTS,MAKE in liba52)$(MAKE) -C liba52 OBJDIR=$(OBJDIR)/liba52 OUTPUT=$(BUILDDIR)/liba52.a
-
-$(BUILDDIR)/libwma.a: libwma
-
-libwma:
- $(SILENT)mkdir -p $(OBJDIR)/libwma
- $(call PRINTS,MAKE in libwma)$(MAKE) -C libwma OBJDIR=$(OBJDIR)/libwma OUTPUT=$(BUILDDIR)/libwma.a
-
-$(BUILDDIR)/libffmpegFLAC.a: libffmpegFLAC
-
-libffmpegFLAC:
- $(SILENT)mkdir -p $(OBJDIR)/libffmpegFLAC
- $(call PRINTS,MAKE in libffmpegFLAC)$(MAKE) -C libffmpegFLAC OBJDIR=$(OBJDIR)/libffmpegFLAC OUTPUT=$(BUILDDIR)/libffmpegFLAC.a
-
-$(BUILDDIR)/libtremor.a: libtremor
-
-libtremor:
- $(SILENT)mkdir -p $(OBJDIR)/libtremor
- $(call PRINTS,MAKE in libtremor)$(MAKE) -C libtremor OBJDIR=$(OBJDIR)/libtremor OUTPUT=$(BUILDDIR)/libtremor.a
-
-$(BUILDDIR)/libspeex.a: libspeex
-
-libspeex:
- $(SILENT)mkdir -p $(OBJDIR)/libspeex
- $(call PRINTS,MAKE in libspeex)$(MAKE) -C libspeex OBJDIR=$(OBJDIR)/libspeex OUTPUT=$(BUILDDIR)/libspeex.a
-
-$(BUILDDIR)/libwavpack.a: libwavpack
-
-libwavpack:
- $(SILENT)mkdir -p $(OBJDIR)/libwavpack
- $(call PRINTS,MAKE in libwavpack)$(MAKE) -C libwavpack OBJDIR=$(OBJDIR)/libwavpack OUTPUT=$(BUILDDIR)/libwavpack.a
-
-$(BUILDDIR)/libmusepack.a: libmusepack
-
-libmusepack:
- $(SILENT)mkdir -p $(OBJDIR)/libmusepack
- $(call PRINTS,MAKE in libmusepack)$(MAKE) -C libmusepack OBJDIR=$(OBJDIR)/libmusepack OUTPUT=$(BUILDDIR)/libmusepack.a
-
-$(BUILDDIR)/libalac.a: libalac
-
-libalac:
- $(SILENT)mkdir -p $(OBJDIR)/libalac
- $(call PRINTS,MAKE in libalac)$(MAKE) -C libalac OBJDIR=$(OBJDIR)/libalac OUTPUT=$(BUILDDIR)/libalac.a
-
-$(BUILDDIR)/libm4a.a: libm4a
-
-libm4a:
- $(SILENT)mkdir -p $(OBJDIR)/libm4a
- $(call PRINTS,MAKE in libm4a)$(MAKE) -C libm4a OBJDIR=$(OBJDIR)/libm4a OUTPUT=$(BUILDDIR)/libm4a.a
-
-$(BUILDDIR)/libfaad.a: libfaad
-
-libfaad:
- $(SILENT)mkdir -p $(OBJDIR)/libfaad
- $(call PRINTS,MAKE in libfaad)$(MAKE) -C libfaad OBJDIR=$(OBJDIR)/libfaad OUTPUT=$(BUILDDIR)/libfaad.a
-
-$(BUILDDIR)/libdemac.a: libdemac
-
-libdemac:
- $(SILENT)mkdir -p $(OBJDIR)/libdemac
- $(call PRINTS,MAKE in libdemac)$(MAKE) -C demac/libdemac OBJDIR=$(OBJDIR)/libdemac OUTPUT=$(BUILDDIR)/libdemac.a
-
-$(BUILDDIR)/libasap.a: libasap
-
-libasap:
- $(SILENT)mkdir -p $(OBJDIR)/libasap
- $(call PRINTS,MAKE in libasap)$(MAKE) -C libasap OBJDIR=$(OBJDIR)/libasap OUTPUT=$(BUILDDIR)/libasap.a
-clean:
- $(call PRINTS,cleaning codecs)rm -fr \
- $(OBJDIR)/libspc $(BUILDDIR)/libspc.a \
- $(OBJDIR)/libmad $(BUILDDIR)/libmad.a \
- $(OBJDIR)/liba52 $(BUILDDIR)/liba52.a \
- $(OBJDIR)/libffmpegFLAC $(BUILDDIR)/libffmpegFLAC.a \
- $(OBJDIR)/libtremor $(BUILDDIR)/libtremor.a \
- $(OBJDIR)/libspeex $(BUILDDIR)/libSpeex.a \
- $(OBJDIR)/libwavpack $(BUILDDIR)/libwavpack.a \
- $(OBJDIR)/libmusepack $(BUILDDIR)/libmusepack.a \
- $(OBJDIR)/libalac $(BUILDDIR)/libalac.a \
- $(OBJDIR)/libfaad $(BUILDDIR)/libfaad.a \
- $(OBJDIR)/libm4a $(BUILDDIR)/libm4a.a \
- $(OBJDIR)/libdemac $(BUILDDIR)/libdemac.a \
- $(OBJDIR)/libwma $(BUILDDIR)/libwma.a
- $(OBJDIR)/libasap $(BUILDDIR)/libasap.a
- $(SILENT)$(MAKE) -C libspc clean OBJDIR=$(OBJDIR)/libspc
- $(SILENT)$(MAKE) -C libmad clean OBJDIR=$(OBJDIR)/libmad
- $(SILENT)$(MAKE) -C liba52 clean OBJDIR=$(OBJDIR)/liba52
- $(SILENT)$(MAKE) -C libffmpegFLAC clean OBJDIR=$(OBJDIR)/libffmpegFLAC
- $(SILENT)$(MAKE) -C libtremor clean OBJDIR=$(OBJDIR)/libtremor
- $(SILENT)$(MAKE) -C libspeex clean OBJDIR=$(OBJDIR)/libspeex
- $(SILENT)$(MAKE) -C libwavpack clean OBJDIR=$(OBJDIR)/libwavpack
- $(SILENT)$(MAKE) -C libmusepack clean OBJDIR=$(OBJDIR)/libmusepack
- $(SILENT)$(MAKE) -C libalac clean OBJDIR=$(OBJDIR)/libalac
- $(SILENT)$(MAKE) -C libfaad clean OBJDIR=$(OBJDIR)/libfaad
- $(SILENT)$(MAKE) -C libm4a clean OBJDIR=$(OBJDIR)/libm4a
- $(SILENT)$(MAKE) -C demac/libdemac clean OBJDIR=$(OBJDIR)/libdemac
- $(SILENT)$(MAKE) -C libwma clean OBJDIR=$(OBJDIR)/libwma
- $(SILENT)$(MAKE) -C libasap clean OBJDIR=$(OBJDIR)/libasap
- $(SILENT)$(MAKE) -C lib clean OBJDIR=$(OBJDIR)/lib
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/ape.c b/apps/codecs/ape.c
index f0d15ee..97f9ee6 100644
--- a/apps/codecs/ape.c
+++ b/apps/codecs/ape.c
@@ -20,7 +20,6 @@
****************************************************************************/
#include "codeclib.h"
-#define ROCKBOX
#include <codecs/demac/libdemac/demac.h>
CODEC_HEADER
diff --git a/apps/codecs/codec.h b/apps/codecs/codec.h
deleted file mode 100644
index 2ee4e47..0000000
--- a/apps/codecs/codec.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2005 Jens Arnold
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-/* Global declarations to be used in rockbox software codecs */
-
-#include "config.h"
-#include "system.h"
-
-#include <sys/types.h>
-
-extern struct codec_api *ci;
-
-/* Get these functions 'out of the way' of the standard functions. Not doing
- * so confuses the cygwin linker, and maybe others. These functions need to
- * be implemented elsewhere */
-#define malloc(x) codec_malloc(x)
-#define calloc(x,y) codec_calloc(x,y)
-#define realloc(x,y) codec_realloc(x,y)
-#define free(x) codec_free(x)
-#define alloca(x) __builtin_alloca(x)
-
-void* codec_malloc(size_t size);
-void* codec_calloc(size_t nmemb, size_t size);
-void* codec_realloc(void* ptr, size_t size);
-void codec_free(void* ptr);
-
-#define abs(x) ((x)>0?(x):-(x))
-#define labs(x) abs(x)
-
-void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
-
diff --git a/apps/codecs/codecs.make b/apps/codecs/codecs.make
new file mode 100644
index 0000000..a65dc4f
--- /dev/null
+++ b/apps/codecs/codecs.make
@@ -0,0 +1,103 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+CODECDIR = $(BUILDDIR)/apps/codecs
+CODECS_SRC := $(call preprocess, $(APPSDIR)/codecs/SOURCES)
+OTHER_SRC += $(CODECS_SRC)
+
+CODECS := $(CODECS_SRC:.c=.codec)
+CODECS := $(subst $(ROOTDIR),$(BUILDDIR),$(CODECS))
+
+# the codec helper library
+include $(APPSDIR)/codecs/lib/libcodec.make
+
+# the codec libraries
+include $(APPSDIR)/codecs/demac/libdemac.make
+include $(APPSDIR)/codecs/liba52/liba52.make
+include $(APPSDIR)/codecs/libalac/libalac.make
+include $(APPSDIR)/codecs/libasap/libasap.make
+include $(APPSDIR)/codecs/libfaad/libfaad.make
+include $(APPSDIR)/codecs/libffmpegFLAC/libffmpegFLAC.make
+include $(APPSDIR)/codecs/libm4a/libm4a.make
+include $(APPSDIR)/codecs/libmad/libmad.make
+include $(APPSDIR)/codecs/libmusepack/libmusepack.make
+include $(APPSDIR)/codecs/libspc/libspc.make
+include $(APPSDIR)/codecs/libspeex/libspeex.make
+include $(APPSDIR)/codecs/libtremor/libtremor.make
+include $(APPSDIR)/codecs/libwavpack/libwavpack.make
+include $(APPSDIR)/codecs/libwma/libwma.make
+
+# compile flags for codecs
+CODECFLAGS = $(CFLAGS) -I$(APPSDIR)/codecs -I$(APPSDIR)/codecs/lib \
+ -DCODEC
+
+CODEC_LDS := $(APPSDIR)/plugins/plugin.lds # codecs and plugins use same file
+CODECLINK_LDS := $(CODECDIR)/codec.link
+CODEC_CRT0 := $(CODECDIR)/codec_crt0.o
+
+CODECLIBS := $(DEMACLIB) $(A52LIB) $(ALACLIB) $(ASAPLIB) \
+ $(FAADLIB) $(FFMPEGFLACLIB) $(M4ALIB) $(MADLIB) $(MUSEPACKLIB) \
+ $(SPCLIB) $(SPEEXLIB) $(TREMORLIB) $(WAVPACKLIB) $(WMALIB) \
+ $(CODECLIB)
+
+$(CODECS): $(CODEC_CRT0) $(CODECLINK_LDS)
+
+$(CODECLINK_LDS): $(CODEC_LDS)
+ $(call PRINTS,PP $(@F))
+ $(call preprocess2file, $<, $@)
+
+# codec/library dependencies
+$(CODECDIR)/spc.codec : $(CODECDIR)/libspc.a
+$(CODECDIR)/mpa.codec : $(CODECDIR)/libmad.a
+$(CODECDIR)/a52.codec : $(CODECDIR)/liba52.a
+$(CODECDIR)/flac.codec : $(CODECDIR)/libffmpegFLAC.a
+$(CODECDIR)/vorbis.codec : $(CODECDIR)/libtremor.a
+$(CODECDIR)/speex.codec : $(CODECDIR)/libspeex.a
+$(CODECDIR)/mpc.codec : $(CODECDIR)/libmusepack.a
+$(CODECDIR)/wavpack.codec : $(CODECDIR)/libwavpack.a
+$(CODECDIR)/alac.codec : $(CODECDIR)/libalac.a $(CODECDIR)/libm4a.a
+$(CODECDIR)/aac.codec : $(CODECDIR)/libfaad.a $(CODECDIR)/libm4a.a
+$(CODECDIR)/shorten.codec : $(CODECDIR)/libffmpegFLAC.a
+$(CODECDIR)/ape.codec : $(CODECDIR)/libdemac.a
+$(CODECDIR)/wma.codec : $(CODECDIR)/libwma.a
+$(CODECDIR)/wavpack_enc.codec: $(CODECDIR)/libwavpack.a
+$(CODECDIR)/asap.codec : $(CODECDIR)/libasap.a
+
+$(CODECS): $(CODECLIB) # this must be last in codec dependency list
+
+# libfaad and libmusepack both contain a huffman.h file, with different
+# content. So we compile them with special command lines:
+
+# pattern rule for compiling codecs
+$(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
+ -I$(dir $<) $(CODECFLAGS) -c $< -o $@
+
+# pattern rule for compiling codecs
+$(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.S
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
+ -I$(dir $<) $(CODECFLAGS) -c $< -o $@
+
+ifdef SIMVER
+ CODECLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
+else
+ CODECLDFLAGS = -T$(CODECLINK_LDS) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map
+ CODECFLAGS += -UDEBUG -DNDEBUG
+endif
+
+$(CODECDIR)/%.codec: $(CODECDIR)/%.o
+ $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(CODECLDFLAGS)
+ $(call PRINTS,OC $(@F))$(OC) -O binary $(CODECDIR)/$*.elf $@
+
+
diff --git a/apps/codecs/demac/libdemac.make b/apps/codecs/demac/libdemac.make
new file mode 100644
index 0000000..ba764f8
--- /dev/null
+++ b/apps/codecs/demac/libdemac.make
@@ -0,0 +1,24 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libdemac
+DEMACLIB := $(CODECDIR)/libdemac.a
+DEMACLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/demac/libdemac/SOURCES)
+DEMACLIB_OBJ := $(call c2obj, $(DEMACLIB_SRC))
+OTHER_SRC += $(DEMACLIB_SRC)
+
+$(DEMACLIB): $(DEMACLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+DEMACFLAGS = $(filter-out -O%,$(CODECFLAGS))
+DEMACFLAGS += -O3
+
+$(CODECDIR)/demac/%.o: $(ROOTDIR)/apps/codecs/demac/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(DEMACFLAGS) -c $< -o $@
diff --git a/apps/codecs/demac/libdemac/demac_config.h b/apps/codecs/demac/libdemac/demac_config.h
index 86c2d24..dd3aaa3 100644
--- a/apps/codecs/demac/libdemac/demac_config.h
+++ b/apps/codecs/demac/libdemac/demac_config.h
@@ -33,7 +33,7 @@
#include "config.h"
#ifndef __ASSEMBLER__
-#include "../lib/codeclib.h"
+#include "codeclib.h"
#include <codecs.h>
#endif
diff --git a/apps/codecs/lib/Makefile b/apps/codecs/lib/Makefile
deleted file mode 100644
index 4a33a58..0000000
--- a/apps/codecs/lib/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-# ../.. for the codec.h in the apps dir
-# .. for stuff in the codecs dir
-# . for stuff in the codeclib dir
-INCLUDES=-I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) \
-$(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} -DCODEC
-
-# Sectioned compilation for target
-ifndef SIMVER
- CFLAGS += -ffunction-sections -fdata-sections
-endif
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-codeclib
-DIRS = .
-
-OUTPUT = $(BUILDDIR)/libcodec.a
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning codecs/lib)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/codecs/lib/codeclib.c b/apps/codecs/lib/codeclib.c
index 6e11eb1..8cc4089 100644
--- a/apps/codecs/lib/codeclib.c
+++ b/apps/codecs/lib/codeclib.c
@@ -27,8 +27,8 @@
#include "codeclib.h"
#include "metadata.h"
-long mem_ptr;
-long bufsize;
+size_t mem_ptr;
+size_t bufsize;
unsigned char* mp3buf; // The actual MP3 buffer from Rockbox
unsigned char* mallocbuf; // 512K from the start of MP3 buffer
unsigned char* filebuf; // The rest of the MP3 buffer
diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h
index 6e92e29..1df85d6 100644
--- a/apps/codecs/lib/codeclib.h
+++ b/apps/codecs/lib/codeclib.h
@@ -25,14 +25,23 @@
#include <sys/types.h>
extern struct codec_api *ci;
-extern long mem_ptr;
-extern long bufsize;
+extern size_t mem_ptr;
+extern size_t bufsize;
extern unsigned char* mp3buf; /* The actual MP3 buffer from Rockbox */
extern unsigned char* mallocbuf; /* The free space after the codec in the codec buffer */
extern unsigned char* filebuf; /* The rest of the MP3 buffer */
/* Standard library functions that are used by the codecs follow here */
+/* Get these functions 'out of the way' of the standard functions. Not doing
+ * so confuses the cygwin linker, and maybe others. These functions need to
+ * be implemented elsewhere */
+#define malloc(x) codec_malloc(x)
+#define calloc(x,y) codec_calloc(x,y)
+#define realloc(x,y) codec_realloc(x,y)
+#define free(x) codec_free(x)
+#define alloca(x) __builtin_alloca(x)
+
void* codec_malloc(size_t size);
void* codec_calloc(size_t nmemb, size_t size);
void* codec_realloc(void* ptr, size_t size);
diff --git a/apps/codecs/lib/libcodec.make b/apps/codecs/lib/libcodec.make
new file mode 100644
index 0000000..5e96f75
--- /dev/null
+++ b/apps/codecs/lib/libcodec.make
@@ -0,0 +1,23 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+CODECLIB := $(CODECDIR)/libcodec.a
+CODECLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/lib/SOURCES)
+CODECLIB_OBJ := $(call c2obj, $(CODECLIB_SRC))
+OTHER_SRC += $(CODECLIB_SRC)
+
+$(CODECLIB): $(CODECLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+CODECLIBFLAGS = $(CODECFLAGS) -ffunction-sections
+
+$(CODECDIR)/lib/%.o: $(ROOTDIR)/apps/codecs/lib/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
+ -I$(dir $<) $(CODECLIBFLAGS) -c $< -o $@
diff --git a/apps/codecs/liba52/Makefile b/apps/codecs/liba52/Makefile
deleted file mode 100644
index 798ebc3..0000000
--- a/apps/codecs/liba52/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-A52OPTS = -O2
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(A52OPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-liba52
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning liba52)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/liba52/config-a52.h b/apps/codecs/liba52/config-a52.h
index 9e38034..ade7ecf 100644
--- a/apps/codecs/liba52/config-a52.h
+++ b/apps/codecs/liba52/config-a52.h
@@ -1,4 +1,4 @@
-#include "../codec.h"
+#include "codeclib.h"
/* a52dec profiling */
/* #undef A52DEC_GPROF */
diff --git a/apps/codecs/liba52/liba52.make b/apps/codecs/liba52/liba52.make
new file mode 100644
index 0000000..4e0353d
--- /dev/null
+++ b/apps/codecs/liba52/liba52.make
@@ -0,0 +1,17 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# liba52
+A52LIB := $(CODECDIR)/liba52.a
+A52LIB_SRC := $(call preprocess, $(APPSDIR)/codecs/liba52/SOURCES)
+A52LIB_OBJ := $(call c2obj, $(A52LIB_SRC))
+OTHER_SRC += $(A52LIB_SRC)
+
+$(A52LIB): $(A52LIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
diff --git a/apps/codecs/libalac/Makefile b/apps/codecs/libalac/Makefile
deleted file mode 100644
index 1c52687..0000000
--- a/apps/codecs/libalac/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-ALACOPTS = -O3
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(ALACOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libalac
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libalac)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libalac/alac.c b/apps/codecs/libalac/alac.c
index d5d9be1..d747cae 100644
--- a/apps/codecs/libalac/alac.c
+++ b/apps/codecs/libalac/alac.c
@@ -35,7 +35,7 @@
#include <string.h>
#include <inttypes.h>
-#include "../codec.h"
+#include "codeclib.h"
#include "decomp.h"
int16_t predictor_coef_table[32] IBSS_ATTR;
diff --git a/apps/codecs/libalac/libalac.make b/apps/codecs/libalac/libalac.make
new file mode 100644
index 0000000..b6b22d1
--- /dev/null
+++ b/apps/codecs/libalac/libalac.make
@@ -0,0 +1,24 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libalac
+ALACLIB := $(CODECDIR)/libalac.a
+ALACLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libalac/SOURCES)
+ALACLIB_OBJ := $(call c2obj, $(ALACLIB_SRC))
+OTHER_SRC += $(ALACLIB_SRC)
+
+$(ALACLIB): $(ALACLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+ALACFLAGS = $(filter-out -O%,$(CODECFLAGS))
+ALACFLAGS += -O3
+
+$(CODECDIR)/libalac/%.o: $(ROOTDIR)/apps/codecs/libalac/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(ALACFLAGS) -c $< -o $@
diff --git a/apps/codecs/libasap/Makefile b/apps/codecs/libasap/Makefile
deleted file mode 100644
index d20f239..0000000
--- a/apps/codecs/libasap/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id: Makefile 13920 2007-07-16 21:16:52Z jethead71 $
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I../lib -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-SPCOPTS = -O -DROCKBOX
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(SPCOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS) -DCODEC=1
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-spc
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning spc)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libasap/libasap.make b/apps/codecs/libasap/libasap.make
new file mode 100644
index 0000000..443dfbe
--- /dev/null
+++ b/apps/codecs/libasap/libasap.make
@@ -0,0 +1,24 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libasap
+ASAPLIB := $(CODECDIR)/libasap.a
+ASAPLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libasap/SOURCES)
+ASAPLIB_OBJ := $(call c2obj, $(ASAPLIB_SRC))
+OTHER_SRC += $(ASAPLIB_SRC)
+
+$(ASAPLIB): $(ASAPLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+ASAPFLAGS = $(filter-out -O%,$(CODECFLAGS))
+ASAPFLAGS += -O1
+
+$(CODECDIR)/libasap/%.o: $(ROOTDIR)/apps/codecs/libasap/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(ASAPFLAGS) -c $< -o $@
diff --git a/apps/codecs/libfaad/Makefile b/apps/codecs/libfaad/Makefile
deleted file mode 100644
index 8288b4c..0000000
--- a/apps/codecs/libfaad/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-FAADOPTS = -O2 -Wno-char-subscripts
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(FAADOPTS) $(TARGET) \
- $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libfaad
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libfaad)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libfaad/common.h b/apps/codecs/libfaad/common.h
index 59d9625..a9c67a5 100644
--- a/apps/codecs/libfaad/common.h
+++ b/apps/codecs/libfaad/common.h
@@ -33,8 +33,7 @@
#endif
#include "faad_config.h"
-#include "../codec.h"
-#include "../lib/codeclib.h"
+#include "codeclib.h"
extern struct codec_api* ci;
diff --git a/apps/codecs/libfaad/libfaad.make b/apps/codecs/libfaad/libfaad.make
new file mode 100644
index 0000000..0af2cfb
--- /dev/null
+++ b/apps/codecs/libfaad/libfaad.make
@@ -0,0 +1,18 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libfaad
+FAADLIB := $(CODECDIR)/libfaad.a
+FAADLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libfaad/SOURCES)
+FAADLIB_OBJ := $(call c2obj, $(FAADLIB_SRC))
+OTHER_SRC += $(FAADLIB_SRC)
+OTHER_INC += -I$(APPSDIR)/codecs/libfaad
+
+$(FAADLIB): $(FAADLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
diff --git a/apps/codecs/libffmpegFLAC/Makefile b/apps/codecs/libffmpegFLAC/Makefile
deleted file mode 100644
index 02e91d6..0000000
--- a/apps/codecs/libffmpegFLAC/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-FLACOPTS = -O2
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(FLACOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libffmpegFLAC
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libffmpegFLAC)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libffmpegFLAC/decoder.c b/apps/codecs/libffmpegFLAC/decoder.c
index aa3ce30..ed17554 100644
--- a/apps/codecs/libffmpegFLAC/decoder.c
+++ b/apps/codecs/libffmpegFLAC/decoder.c
@@ -34,7 +34,7 @@
#include <inttypes.h>
#include <stdbool.h>
#ifndef BUILD_STANDALONE
-#include "../codec.h"
+#include "codeclib.h"
#endif
#include "bitstream.h"
diff --git a/apps/codecs/libffmpegFLAC/libffmpegFLAC.make b/apps/codecs/libffmpegFLAC/libffmpegFLAC.make
new file mode 100644
index 0000000..41addbe
--- /dev/null
+++ b/apps/codecs/libffmpegFLAC/libffmpegFLAC.make
@@ -0,0 +1,17 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libffmpegFLAC
+FFMPEGFLACLIB := $(CODECDIR)/libffmpegFLAC.a
+FFMPEGFLACLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libffmpegFLAC/SOURCES)
+FFMPEGFLACLIB_OBJ := $(call c2obj, $(FFMPEGFLACLIB_SRC))
+OTHER_SRC += $(FFMPEGFLACLIB_SRC)
+
+$(FFMPEGFLACLIB): $(FFMPEGFLACLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
diff --git a/apps/codecs/libffmpegFLAC/tables.c b/apps/codecs/libffmpegFLAC/tables.c
index 5dbb54e..58b1bb6 100644
--- a/apps/codecs/libffmpegFLAC/tables.c
+++ b/apps/codecs/libffmpegFLAC/tables.c
@@ -1,7 +1,7 @@
#ifdef BUILD_STANDALONE
#define ICONST_ATTR
#else
-#include "../codec.h"
+#include "codeclib.h"
#endif
#include <inttypes.h>
diff --git a/apps/codecs/libm4a/Makefile b/apps/codecs/libm4a/Makefile
deleted file mode 100644
index 1bc71e5..0000000
--- a/apps/codecs/libm4a/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-M4AOPTS = -O3
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(M4AOPTS) $(TARGET) \
- $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libm4a
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libm4a)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c
index 912e732..e9b5c2c 100644
--- a/apps/codecs/libm4a/demux.c
+++ b/apps/codecs/libm4a/demux.c
@@ -33,11 +33,14 @@
#include <inttypes.h>
#include <stdlib.h>
-#include "../codec.h"
+#include "codeclib.h"
#include "m4a.h"
#if defined(DEBUG) || defined(SIMULATOR)
+#ifdef DEBUGF
+#undef DEBUGF
+#endif
#define DEBUGF qtmovie->stream->ci->debugf
#else
#define DEBUGF(...)
diff --git a/apps/codecs/libm4a/libm4a.make b/apps/codecs/libm4a/libm4a.make
new file mode 100644
index 0000000..6c092ba
--- /dev/null
+++ b/apps/codecs/libm4a/libm4a.make
@@ -0,0 +1,24 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libm4a
+M4ALIB := $(CODECDIR)/libm4a.a
+M4ALIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libm4a/SOURCES)
+M4ALIB_OBJ := $(call c2obj, $(M4ALIB_SRC))
+OTHER_SRC += $(M4ALIB_SRC)
+
+$(M4ALIB): $(M4ALIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+M4AFLAGS = $(filter-out -O%,$(CODECFLAGS))
+M4AFLAGS += -O3
+
+$(CODECDIR)/libm4a/%.o: $(ROOTDIR)/apps/codecs/libm4a/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(M4AFLAGS) -c $< -o $@
diff --git a/apps/codecs/libm4a/m4a.c b/apps/codecs/libm4a/m4a.c
index da3e912..f066640 100644
--- a/apps/codecs/libm4a/m4a.c
+++ b/apps/codecs/libm4a/m4a.c
@@ -23,13 +23,6 @@
#include <inttypes.h>
#include "m4a.h"
-#if defined(DEBUG) || defined(SIMULATOR)
-extern struct codec_api* rb;
-#define DEBUGF rb->debugf
-#else
-#define DEBUGF(...)
-#endif
-
/* Implementation of the stream.h functions used by libalac */
#define _Swap32(v) do { \
diff --git a/apps/codecs/libmad/Makefile b/apps/codecs/libmad/Makefile
deleted file mode 100644
index 4d838db..0000000
--- a/apps/codecs/libmad/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-# NOTE: FPM_ define has been moved to global.h
-MADOPTS = -UDEBUG -DNDEBUG -O2
-
-# We build libmad separately for mpegplayer
-ifdef MPEGPLAYER
-EXTRA_DEFINES += -DMPEGPLAYER
-endif
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(MADOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libmad
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libmad)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libmad/frame.c b/apps/codecs/libmad/frame.c
index 2c7fdca..3fb971d 100644
--- a/apps/codecs/libmad/frame.c
+++ b/apps/codecs/libmad/frame.c
@@ -31,7 +31,7 @@
# include "timer.h"
# include "layer12.h"
# include "layer3.h"
-# include "../lib/codeclib.h"
+# include "codeclib.h"
static
unsigned long const bitrate_table[5][15] = {
diff --git a/apps/codecs/libmad/global.h b/apps/codecs/libmad/global.h
index 1dad4d5..93dfd0a 100644
--- a/apps/codecs/libmad/global.h
+++ b/apps/codecs/libmad/global.h
@@ -19,7 +19,7 @@
* $Id$
*/
-#include "../codec.h"
+#include "codeclib.h"
# ifndef LIBMAD_GLOBAL_H
# define LIBMAD_GLOBAL_H
diff --git a/apps/codecs/libmad/libmad.make b/apps/codecs/libmad/libmad.make
new file mode 100644
index 0000000..f033495
--- /dev/null
+++ b/apps/codecs/libmad/libmad.make
@@ -0,0 +1,54 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# we need to build two different mad libraries
+# (one for codec, one for mpegplayer)
+# so a little trickery is necessary
+
+MADFLAGS = $(CODECFLAGS) -UDEBUG -DNDEBUG -I$(APPSDIR)/codecs/libmad
+MPEGMADFLAGS = $(MADFLAGS) -DMPEGPLAYER
+
+# libmad
+MADLIB := $(CODECDIR)/libmad.a
+MADLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libmad/SOURCES)
+MADLIB_OBJ := $(call c2obj, $(MADLIB_SRC))
+OTHER_SRC += $(MADLIB_SRC)
+
+$(MADLIB): $(MADLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+# libmad-mpeg
+MPEGMADLIB := $(CODECDIR)/libmad-mpeg.a
+MPEGMADLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libmad/SOURCES)
+MPEGMADLIB_OBJ := $(subst .c,.o,$(subst .S,.o,$(subst $(ROOTDIR)/apps/codecs/libmad,$(BUILDDIR)/apps/codecs/libmad-mpeg,$(MPEGMADLIB_SRC))))
+
+$(MPEGMADLIB): $(MPEGMADLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+# pattern rules
+
+$(CODECDIR)/libmad-mpeg/%.o : $(ROOTDIR)/apps/codecs/libmad/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<)) \
+ $(CC) $(MPEGMADFLAGS) -c $< -o $@
+
+$(CODECDIR)/libmad-mpeg/%.o : $(ROOTDIR)/apps/codecs/libmad/%.S
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<)) \
+ $(CC) $(MPEGMADFLAGS) -c $< -o $@
+
+$(CODECDIR)/libmad/%.o: $(ROOTDIR)/apps/codecs/libmad/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<)) \
+ $(CC) $(MADFLAGS) -c $< -o $@
+
+$(CODECDIR)/libmad/%.o: $(ROOTDIR)/apps/codecs/libmad/%.S
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<)) \
+ $(CC) $(MADFLAGS) -c $< -o $@
diff --git a/apps/codecs/libmusepack/Makefile b/apps/codecs/libmusepack/Makefile
deleted file mode 100644
index a70d336..0000000
--- a/apps/codecs/libmusepack/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-# libmusepack is faster on ARM-targets with -O1 instead of -O2
-ifeq ($(CPU),arm)
- MUSEPACKOPTS += -O1
-else
- MUSEPACKOPTS += -O2
-endif
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(MUSEPACKOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libmusepack
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libmusepack)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libmusepack/huffsv46.c b/apps/codecs/libmusepack/huffsv46.c
index 833b64b..20d754c 100644
--- a/apps/codecs/libmusepack/huffsv46.c
+++ b/apps/codecs/libmusepack/huffsv46.c
@@ -35,9 +35,9 @@
/// \file huffsv46.c
/// Implementations of huffman decoding for streamversions < 7.
-#include <musepack.h>
-#include <requant.h>
-#include <huffman.h>
+#include "musepack.h"
+#include "requant.h"
+#include "huffman.h"
#ifdef MPC_SUPPORT_SV456
diff --git a/apps/codecs/libmusepack/huffsv7.c b/apps/codecs/libmusepack/huffsv7.c
index ae2b902..9ca77ce 100644
--- a/apps/codecs/libmusepack/huffsv7.c
+++ b/apps/codecs/libmusepack/huffsv7.c
@@ -35,9 +35,9 @@
/// \file huffsv7.c
/// Implementations of sv7 huffman decoding functions.
-#include <musepack.h>
-#include <huffman.h>
-#include <requant.h>
+#include "musepack.h"
+#include "huffman.h"
+#include "requant.h"
const HuffmanTyp mpc_table_HuffHdr [10] ICONST_ATTR =
{{2147483648u,1,0},{1610612736u,3,1},{1577058304u,7,-4},{1568669696u,9,3},{1560281088u,9,4},{1543503872u,8,-5},{1476395008u,6,2},{1342177280u,5,-3},{1073741824u,4,-2},{0u,2,-1},};
diff --git a/apps/codecs/libmusepack/libmusepack.make b/apps/codecs/libmusepack/libmusepack.make
new file mode 100644
index 0000000..736f58b
--- /dev/null
+++ b/apps/codecs/libmusepack/libmusepack.make
@@ -0,0 +1,29 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libmusepack
+MUSEPACKLIB := $(CODECDIR)/libmusepack.a
+MUSEPACKLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libmusepack/SOURCES)
+MUSEPACKLIB_OBJ := $(call c2obj, $(MUSEPACKLIB_SRC))
+OTHER_SRC += $(MUSEPACKLIB_SRC)
+
+$(MUSEPACKLIB): $(MUSEPACKLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+# libmusepack is faster on ARM-targets with -O1 than -O2
+MUSEPACKFLAGS = $(filter-out -O%,$(CODECFLAGS)) -I$(APPSDIR)/codecs/libmusepack
+ifeq ($(CPU),arm)
+ MUSEPACKFLAGS += -O1
+else
+ MUSEPACKFLAGS += -O2
+endif
+
+$(CODECDIR)/libmusepack/%.o: $(ROOTDIR)/apps/codecs/libmusepack/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(MUSEPACKFLAGS) -c $< -o $@
diff --git a/apps/codecs/libmusepack/musepack.h b/apps/codecs/libmusepack/musepack.h
index b9aff48..1c98de6 100644
--- a/apps/codecs/libmusepack/musepack.h
+++ b/apps/codecs/libmusepack/musepack.h
@@ -45,7 +45,9 @@
//#include <stdlib.h>
#include <string.h>
-#include "../codec.h"
+#ifndef SIMULATOR
+#include "codecs.h"
+#endif
#include "config_types.h"
#include "decoder.h"
#include "math.h"
diff --git a/apps/codecs/libspc/Makefile b/apps/codecs/libspc/Makefile
deleted file mode 100644
index 8929149..0000000
--- a/apps/codecs/libspc/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-SPCOPTS = -O -DROCKBOX
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(SPCOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS) -DCODEC=1
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-spc
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning spc)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libspc/libspc.make b/apps/codecs/libspc/libspc.make
new file mode 100644
index 0000000..62f788b
--- /dev/null
+++ b/apps/codecs/libspc/libspc.make
@@ -0,0 +1,24 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libspc
+SPCLIB := $(CODECDIR)/libspc.a
+SPCLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libspc/SOURCES)
+SPCLIB_OBJ := $(call c2obj, $(SPCLIB_SRC))
+OTHER_SRC += $(SPCLIB_SRC)
+
+$(SPCLIB): $(SPCLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+SPCFLAGS = $(filter-out -O%,$(CODECFLAGS))
+SPCFLAGS += -O1
+
+$(CODECDIR)/libspc/%.o: $(ROOTDIR)/apps/codecs/libspc/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SPCFLAGS) -c $< -o $@
diff --git a/apps/codecs/libspc/spc_codec.h b/apps/codecs/libspc/spc_codec.h
index 33e566a..a6dcd0a 100644
--- a/apps/codecs/libspc/spc_codec.h
+++ b/apps/codecs/libspc/spc_codec.h
@@ -30,7 +30,9 @@
#define _SPC_CODEC_H_
/* rather than comment out asserts, just define NDEBUG */
+#ifndef NDEBUG
#define NDEBUG
+#endif
#include <assert.h>
/** Basic configuration options **/
diff --git a/apps/codecs/libspc/spc_cpu.c b/apps/codecs/libspc/spc_cpu.c
index 6aa9499..d308e6e 100644
--- a/apps/codecs/libspc/spc_cpu.c
+++ b/apps/codecs/libspc/spc_cpu.c
@@ -22,8 +22,7 @@
****************************************************************************/
/* The CPU portion (shock!) */
-#include "codec.h"
-#include "codecs.h"
+#include "codeclib.h"
#include "spc_codec.h"
#include "spc_profiler.h"
diff --git a/apps/codecs/libspc/spc_dsp.c b/apps/codecs/libspc/spc_dsp.c
index 153950c..d1facf8 100644
--- a/apps/codecs/libspc/spc_dsp.c
+++ b/apps/codecs/libspc/spc_dsp.c
@@ -23,8 +23,7 @@
****************************************************************************/
/* The DSP portion (awe!) */
-#include "codec.h"
-#include "codecs.h"
+#include "codeclib.h"
#include "spc_codec.h"
#include "spc_profiler.h"
diff --git a/apps/codecs/libspc/spc_emu.c b/apps/codecs/libspc/spc_emu.c
index e646e08..1bebc86 100644
--- a/apps/codecs/libspc/spc_emu.c
+++ b/apps/codecs/libspc/spc_emu.c
@@ -20,8 +20,7 @@
* KIND, either express or implied.
*
****************************************************************************/
-#include "codec.h"
-#include "codecs.h"
+#include "codeclib.h"
#include "spc_codec.h"
#include "spc_profiler.h"
diff --git a/apps/codecs/libspc/spc_profiler.c b/apps/codecs/libspc/spc_profiler.c
index 5dc5162..3184ad7 100644
--- a/apps/codecs/libspc/spc_profiler.c
+++ b/apps/codecs/libspc/spc_profiler.c
@@ -25,7 +25,7 @@
#if defined(SPC_PROFILE) && defined(USEC_TIMER)
-#include "codec.h"
+#include "codeclib.h"
#include "spc_codec.h"
#define SPC_DEFINE_PROFILER_TIMERS
#include "spc_profiler.h"
diff --git a/apps/codecs/libspeex/Makefile b/apps/codecs/libspeex/Makefile
deleted file mode 100644
index 3bda53d..0000000
--- a/apps/codecs/libspeex/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id: Makefile,v 1.16 2006-09-02 22:34:13 bagder Exp $
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-SPEEXOPTS = -DHAVE_CONFIG_H -DSPEEX_DISABLE_ENCODER -DROCKBOX
-
-# We're faster on ARM-targets with -O1 instead of -O2
-ifeq ($(CPU),arm)
- SPEEXOPTS += -O
-else
- SPEEXOPTS += -O2
-endif
-
-# We build Speex separately for use as a voice codec
-ifdef ROCKBOX_VOICE_CODEC
-EXTRA_DEFINES += -DROCKBOX_VOICE_CODEC
-endif
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(SPEEXOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} ${PROFILE_OPTS} -Wno-unused-parameter
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-Speex
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- @echo "AR+RANLIB $(notdir $@)"
- @$(AR) ruv $@ $+ >/dev/null 2>&1
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- @echo "cleaning Speex"
- @rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libspeex/bits.c b/apps/codecs/libspeex/bits.c
index 78b38db..9d6cad8 100644
--- a/apps/codecs/libspeex/bits.c
+++ b/apps/codecs/libspeex/bits.c
@@ -36,7 +36,7 @@
#include "config-speex.h"
#endif
-#include <speex/speex_bits.h>
+#include "speex/speex_bits.h"
#include "arch.h"
#include "os_support.h"
diff --git a/apps/codecs/libspeex/cb_search.c b/apps/codecs/libspeex/cb_search.c
index d280757..8a190e5 100644
--- a/apps/codecs/libspeex/cb_search.c
+++ b/apps/codecs/libspeex/cb_search.c
@@ -522,6 +522,9 @@
spx_int32_t *seed
)
{
+ (void)nsf;
+ (void)stack;
+ (void)seed;
int i,j;
VARDECL(int *ind);
VARDECL(int *signs);
@@ -609,6 +612,9 @@
spx_int32_t *seed
)
{
+ (void)par;
+ (void)bits;
+ (void)stack;
int i;
/* FIXME: This is bad, but I don't think the function ever gets called anyway */
for (i=0;i<nsf;i++)
diff --git a/apps/codecs/libspeex/cb_search.h b/apps/codecs/libspeex/cb_search.h
index 7687b45..50b530a 100644
--- a/apps/codecs/libspeex/cb_search.h
+++ b/apps/codecs/libspeex/cb_search.h
@@ -35,7 +35,7 @@
#ifndef CB_SEARCH_H
#define CB_SEARCH_H
-#include <speex/speex_bits.h>
+#include "speex/speex_bits.h"
#include "arch.h"
/** Split codebook parameters. */
diff --git a/apps/codecs/libspeex/config-speex.h b/apps/codecs/libspeex/config-speex.h
index 5241b4e..f3b397f 100644
--- a/apps/codecs/libspeex/config-speex.h
+++ b/apps/codecs/libspeex/config-speex.h
@@ -1,5 +1,5 @@
#ifndef ROCKBOX_VOICE_ENCODER
-#include "../codec.h"
+#include "codeclib.h"
#include "autoconf.h"
#else
#define ICODE_ATTR
diff --git a/apps/codecs/libspeex/filters.c b/apps/codecs/libspeex/filters.c
index 44addc2..09f93c2 100644
--- a/apps/codecs/libspeex/filters.c
+++ b/apps/codecs/libspeex/filters.c
@@ -353,6 +353,7 @@
#ifndef OVERRIDE_IIR_MEM16
void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
{
+ (void)stack;
int i,j;
spx_word16_t yi,nyi;
@@ -497,6 +498,7 @@
all odd x[i] are zero -- well, actually they are left out of the array now
N and M are multiples of 4 */
{
+ (void)stack;
int i, j;
int M2, N2;
VARDECL(spx_word16_t *xx1);
@@ -681,6 +683,9 @@
char *stack
)
{
+ (void)ak;
+ (void)p;
+ (void)stack;
int i;
VARDECL(spx_word16_t *iexc);
spx_word16_t old_ener, new_ener;
diff --git a/apps/codecs/libspeex/jitter.c b/apps/codecs/libspeex/jitter.c
index 61bca75..d9f6c67 100644
--- a/apps/codecs/libspeex/jitter.c
+++ b/apps/codecs/libspeex/jitter.c
@@ -55,9 +55,9 @@
#include "arch.h"
-#include <speex/speex.h>
-#include <speex/speex_bits.h>
-#include <speex/speex_jitter.h>
+#include "speex/speex.h"
+#include "speex/speex_bits.h"
+#include "speex/speex_jitter.h"
#include "os_support.h"
#ifndef NULL
diff --git a/apps/codecs/libspeex/libspeex.make b/apps/codecs/libspeex/libspeex.make
new file mode 100644
index 0000000..a27d559
--- /dev/null
+++ b/apps/codecs/libspeex/libspeex.make
@@ -0,0 +1,60 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# we need to build two different speex libraries
+# (one for codec, one for core voice)
+# so a little trickery is necessary
+
+SPEEXFLAGS = $(filter-out -O%,$(CODECFLAGS)) \
+ -DHAVE_CONFIG_H -DSPEEX_DISABLE_ENCODER \
+ -I$(APPSDIR)/codecs/libspeex
+
+# libspeex is faster on ARM-targets with -O1 instead of -O2
+ifeq ($(CPU),arm)
+ SPEEXFLAGS += -O1
+else
+ SPEEXFLAGS += -O2
+endif
+
+VOICESPEEXFLAGS = $(filter-out -ffunction-sections, $(filter-out -DCODEC,$(SPEEXFLAGS))) -DROCKBOX_VOICE_CODEC
+
+# libspeex
+SPEEXLIB := $(CODECDIR)/libspeex.a
+SPEEXLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libspeex/SOURCES)
+SPEEXLIB_OBJ := $(call c2obj, $(SPEEXLIB_SRC))
+OTHER_SRC += $(SPEEXLIB_SRC)
+
+$(SPEEXLIB): $(SPEEXLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+# libspeex-voice
+VOICESPEEXLIB := $(CODECDIR)/libspeex-voice.a
+VOICESPEEXLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libspeex/SOURCES)
+VOICESPEEXLIB_OBJ := $(subst .c,.o,$(subst .S,.o,$(subst $(ROOTDIR)/apps/codecs/libspeex,$(BUILDDIR)/apps/codecs/libspeex-voice,$(VOICESPEEXLIB_SRC))))
+
+$(VOICESPEEXLIB): $(VOICESPEEXLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+# pattern rules
+
+$(CODECDIR)/libspeex-voice/%.o : $(ROOTDIR)/apps/codecs/libspeex/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(VOICESPEEXFLAGS) -c $< -o $@
+
+$(CODECDIR)/libspeex-voice/%.o : $(ROOTDIR)/apps/codecs/libspeex/%.S
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(VOICESPEEXFLAGS) -c $< -o $@
+
+$(CODECDIR)/libspeex/%.o: $(ROOTDIR)/apps/codecs/libspeex/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SPEEXFLAGS) -c $< -o $@
+
+$(CODECDIR)/libspeex/%.o: $(ROOTDIR)/apps/codecs/libspeex/%.S
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SPEEXFLAGS) -c $< -o $@
diff --git a/apps/codecs/libspeex/lsp.c b/apps/codecs/libspeex/lsp.c
index 3973554..edf480e 100644
--- a/apps/codecs/libspeex/lsp.c
+++ b/apps/codecs/libspeex/lsp.c
@@ -409,6 +409,7 @@
/* float *ak array of LPC coefficients */
/* int lpcrdr order of LPC coefficients */
{
+ (void)stack;
int i,j;
spx_word32_t xout1,xout2,xin;
spx_word32_t mult, a;
diff --git a/apps/codecs/libspeex/ltp.c b/apps/codecs/libspeex/ltp.c
index 04c1115..9f10bc0 100644
--- a/apps/codecs/libspeex/ltp.c
+++ b/apps/codecs/libspeex/ltp.c
@@ -38,7 +38,7 @@
#include "ltp.h"
#include "stack_alloc.h"
#include "filters.h"
-#include <speex/speex_bits.h>
+#include "speex/speex_bits.h"
#include "math_approx.h"
#include "os_support.h"
@@ -674,6 +674,9 @@
int cdbk_offset
)
{
+ (void)end;
+ (void)pitch_coef;
+ (void)stack;
int i;
int pitch;
int gain_index;
@@ -826,6 +829,14 @@
int cdbk_offset
)
{
+ (void)end;
+ (void)par;
+ (void)bits;
+ (void)stack;
+ (void)count_lost;
+ (void)subframe_offset;
+ (void)last_pitch_gain;
+ (void)cdbk_offset;
int i;
#ifdef FIXED_POINT
if (pitch_coef>63)
diff --git a/apps/codecs/libspeex/ltp.h b/apps/codecs/libspeex/ltp.h
index 1e435bc..872f072 100644
--- a/apps/codecs/libspeex/ltp.h
+++ b/apps/codecs/libspeex/ltp.h
@@ -32,7 +32,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <speex/speex_bits.h>
+#include "speex/speex_bits.h"
#include "arch.h"
/** LTP parameters. */
diff --git a/apps/codecs/libspeex/ltp_arm4.h b/apps/codecs/libspeex/ltp_arm4.h
index cdb94e6..e1c60ad 100644
--- a/apps/codecs/libspeex/ltp_arm4.h
+++ b/apps/codecs/libspeex/ltp_arm4.h
@@ -87,6 +87,7 @@
#define OVERRIDE_PITCH_XCORR
void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
{
+ (void)stack;
int i,j;
for (i=0;i<nb_pitch;i+=4)
{
diff --git a/apps/codecs/libspeex/modes.h b/apps/codecs/libspeex/modes.h
index 26e2d86..0fa1c34 100644
--- a/apps/codecs/libspeex/modes.h
+++ b/apps/codecs/libspeex/modes.h
@@ -36,8 +36,8 @@
#ifndef MODES_H
#define MODES_H
-#include <speex/speex.h>
-#include <speex/speex_bits.h>
+#include "speex/speex.h"
+#include "speex/speex_bits.h"
#include "arch.h"
#define NB_SUBMODES 16
diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c
index d29b9ae..31eaa06 100644
--- a/apps/codecs/libspeex/nb_celp.c
+++ b/apps/codecs/libspeex/nb_celp.c
@@ -43,12 +43,12 @@
#include "filters.h"
#include "stack_alloc.h"
#include "vq.h"
-#include <speex/speex_bits.h>
+#include "speex/speex_bits.h"
#include "vbr.h"
#include "arch.h"
#include "math_approx.h"
#include "os_support.h"
-#include <speex/speex_callbacks.h>
+#include "speex/speex_callbacks.h"
#ifdef VORBIS_PSYCHO
#include "vorbis_psy.h"
diff --git a/apps/codecs/libspeex/nb_celp.h b/apps/codecs/libspeex/nb_celp.h
index 30abdee..30edbef 100644
--- a/apps/codecs/libspeex/nb_celp.h
+++ b/apps/codecs/libspeex/nb_celp.h
@@ -37,8 +37,8 @@
#define NB_CELP_H
#include "modes.h"
-#include <speex/speex_bits.h>
-#include <speex/speex_callbacks.h>
+#include "speex/speex_bits.h"
+#include "speex/speex_callbacks.h"
#include "vbr.h"
#include "filters.h"
diff --git a/apps/codecs/libspeex/quant_lsp.h b/apps/codecs/libspeex/quant_lsp.h
index 3bf4d40..0fc206b 100644
--- a/apps/codecs/libspeex/quant_lsp.h
+++ b/apps/codecs/libspeex/quant_lsp.h
@@ -35,7 +35,7 @@
#ifndef QUANT_LSP_H
#define QUANT_LSP_H
-#include <speex/speex_bits.h>
+#include "speex/speex_bits.h"
#include "arch.h"
#define MAX_LSP_SIZE 20
diff --git a/apps/codecs/libspeex/rockbox.h b/apps/codecs/libspeex/rockbox.h
index 073bad5..459c8b5 100644
--- a/apps/codecs/libspeex/rockbox.h
+++ b/apps/codecs/libspeex/rockbox.h
@@ -24,8 +24,7 @@
/* We don't want all this stuff if we're building encoder */
#ifndef ROCKBOX_VOICE_ENCODER
-#include "../codec.h"
-#include "../lib/codeclib.h"
+#include "codeclib.h"
#include "debug.h"
#if !defined(ROCKBOX_VOICE_CODEC)
@@ -35,6 +34,7 @@
#define DEBUGF ci->debugf
#endif
+
#ifdef ROCKBOX_HAS_LOGF
#undef LOGF
#define LOGF ci->logf
@@ -75,6 +75,9 @@
#define OVERRIDE_SPEEX_FATAL 1
static inline void _speex_fatal(const char *str, const char *file, int line)
{
+ (void)str;
+ (void)file;
+ (void)line;
DEBUGF("Fatal error: %s\n", str);
//exit(1);
}
@@ -82,24 +85,30 @@
#define OVERRIDE_SPEEX_WARNING 1
static inline void speex_warning(const char *str)
{
+ (void)str;
DEBUGF("warning: %s\n", str);
}
#define OVERRIDE_SPEEX_WARNING_INT 1
static inline void speex_warning_int(const char *str, int val)
{
+ (void)str;
+ (void)val;
DEBUGF("warning: %s %d\n", str, val);
}
#define OVERRIDE_SPEEX_NOTIFY 1
static inline void speex_notify(const char *str)
{
+ (void)str;
DEBUGF("notice: %s\n", str);
}
#define OVERRIDE_SPEEX_PUTC 1
static inline void _speex_putc(int ch, void *file)
{
+ (void)ch;
+ (void)file;
//FILE *f = (FILE *)file;
//printf("%c", ch);
}
diff --git a/apps/codecs/libspeex/sb_celp.h b/apps/codecs/libspeex/sb_celp.h
index 51aa3d0..86078ea 100644
--- a/apps/codecs/libspeex/sb_celp.h
+++ b/apps/codecs/libspeex/sb_celp.h
@@ -37,7 +37,7 @@
#define SB_CELP_H
#include "modes.h"
-#include <speex/speex_bits.h>
+#include "speex/speex_bits.h"
#include "nb_celp.h"
/**Structure representing the full state of the sub-band encoder*/
diff --git a/apps/codecs/libspeex/speex/ogg.h b/apps/codecs/libspeex/speex/ogg.h
index dce8f96..d42851f 100644
--- a/apps/codecs/libspeex/speex/ogg.h
+++ b/apps/codecs/libspeex/speex/ogg.h
@@ -21,7 +21,7 @@
extern "C" {
#endif
-#include "../../codec.h"
+#include "codeclib.h"
typedef short spx_ogg_int16_t;
typedef unsigned short spx_ogg_uint16_t;
diff --git a/apps/codecs/libspeex/speex_callbacks.c b/apps/codecs/libspeex/speex_callbacks.c
index 58d7b7b..9ffe524 100644
--- a/apps/codecs/libspeex/speex_callbacks.c
+++ b/apps/codecs/libspeex/speex_callbacks.c
@@ -36,7 +36,7 @@
#include "config-speex.h"
#endif
-#include <speex/speex_callbacks.h>
+#include "speex/speex_callbacks.h"
#include "arch.h"
#include "os_support.h"
@@ -74,6 +74,7 @@
int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
spx_int32_t m;
m = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_MODE, &m);
@@ -82,6 +83,7 @@
int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
spx_int32_t m;
m = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_LOW_MODE, &m);
@@ -90,6 +92,7 @@
int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
spx_int32_t m;
m = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_HIGH_MODE, &m);
@@ -99,6 +102,7 @@
#ifndef DISABLE_VBR
int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
spx_int32_t vbr;
vbr = speex_bits_unpack_unsigned(bits, 1);
speex_encoder_ctl(data, SPEEX_SET_VBR, &vbr);
@@ -108,6 +112,7 @@
int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
spx_int32_t enh;
enh = speex_bits_unpack_unsigned(bits, 1);
speex_decoder_ctl(data, SPEEX_SET_ENH, &enh);
@@ -117,6 +122,7 @@
#ifndef DISABLE_VBR
int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
float qual;
qual = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual);
@@ -126,6 +132,7 @@
int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
unsigned char ch;
ch = speex_bits_unpack_unsigned(bits, 8);
_speex_putc(ch, data);
@@ -133,11 +140,11 @@
return 0;
}
-
-
/* Default handler for user callbacks: skip it */
int speex_default_user_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
+ (void)data;
int req_size = speex_bits_unpack_unsigned(bits, 4);
speex_bits_advance(bits, 5+8*req_size);
return 0;
diff --git a/apps/codecs/libspeex/speex_header.c b/apps/codecs/libspeex/speex_header.c
index 1d1d077..b0e98b7 100644
--- a/apps/codecs/libspeex/speex_header.c
+++ b/apps/codecs/libspeex/speex_header.c
@@ -36,8 +36,8 @@
#endif
#include "arch.h"
-#include <speex/speex_header.h>
-#include <speex/speex.h>
+#include "speex/speex_header.h"
+#include "speex/speex.h"
#include "os_support.h"
#ifndef NULL
diff --git a/apps/codecs/libspeex/stereo.c b/apps/codecs/libspeex/stereo.c
index 2dce283..652d2a6 100644
--- a/apps/codecs/libspeex/stereo.c
+++ b/apps/codecs/libspeex/stereo.c
@@ -33,8 +33,8 @@
#include "config-speex.h"
#endif
-#include <speex/speex_stereo.h>
-#include <speex/speex_callbacks.h>
+#include "speex/speex_stereo.h"
+#include "speex/speex_callbacks.h"
#include "math_approx.h"
#include "vq.h"
#include <math.h>
@@ -278,6 +278,7 @@
int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
{
+ (void)state;
RealSpeexStereoState *stereo;
spx_word16_t sign=1, dexp;
int tmp;
diff --git a/apps/codecs/libtremor/Makefile b/apps/codecs/libtremor/Makefile
deleted file mode 100644
index 674d2ae..0000000
--- a/apps/codecs/libtremor/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-# Tremor is slightly faster on coldfire with -O3
-ifeq ($(CPU),coldfire)
- TREMOROPTS = -O3
-else
- TREMOROPTS = -O2
-endif
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(TREMOROPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} ${PROFILE_OPTS}
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libtremor
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libtremor)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libtremor/config-tremor.h b/apps/codecs/libtremor/config-tremor.h
index e1ade70..7cfcb7e 100644
--- a/apps/codecs/libtremor/config-tremor.h
+++ b/apps/codecs/libtremor/config-tremor.h
@@ -1,4 +1,4 @@
-#include "../codec.h"
+#include "codeclib.h"
#ifdef CPU_ARM
#define _ARM_ASSEM_
#endif
diff --git a/apps/codecs/libtremor/ctype.c b/apps/codecs/libtremor/ctype.c
index 9eb6eef..10468bc 100644
--- a/apps/codecs/libtremor/ctype.c
+++ b/apps/codecs/libtremor/ctype.c
@@ -1 +1 @@
-#include "../../../firmware/common/ctype.c"
+#include "common/ctype.c"
diff --git a/apps/codecs/libtremor/libtremor.make b/apps/codecs/libtremor/libtremor.make
new file mode 100644
index 0000000..6f500ea
--- /dev/null
+++ b/apps/codecs/libtremor/libtremor.make
@@ -0,0 +1,36 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libtremor
+TREMORLIB := $(CODECDIR)/libtremor.a
+TREMORLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libtremor/SOURCES)
+TREMORLIB_OBJ := $(call c2obj, $(TREMORLIB_SRC))
+OTHER_SRC += $(TREMORLIB_SRC)
+
+$(TREMORLIB): $(TREMORLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+$(CODECDIR)/libtremor/%.o: $(ROOTDIR)/apps/codecs/libtremor/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
+ -I$(APPSDIR)/codecs/libtremor \
+ $(CODECFLAGS) $(CFLAGS) -c $< -o $@
+
+TREMORFLAGS = -I$(APPSDIR)/codecs/libtremor $(filter-out -O%,$(CODECFLAGS))
+
+# Tremor is slightly faster on coldfire with -O3
+ifeq ($(CPU),coldfire)
+ TREMORFLAGS += -O3
+else
+ TREMORFLAGS += -O2
+endif
+
+$(CODECDIR)/libtremor/%.o: $(ROOTDIR)/apps/codecs/libtremor/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(TREMORFLAGS) -c $< -o $@
diff --git a/apps/codecs/libtremor/mapping0.c b/apps/codecs/libtremor/mapping0.c
index 6bcc717..2bb7a46 100644
--- a/apps/codecs/libtremor/mapping0.c
+++ b/apps/codecs/libtremor/mapping0.c
@@ -21,7 +21,7 @@
#include <math.h>
#include "ogg.h"
#include "ivorbiscodec.h"
-#include <codecs/lib/codeclib.h>
+#include "codeclib.h"
#include "codec_internal.h"
#include "codebook.h"
#include "window.h"
diff --git a/apps/codecs/libtremor/oggmalloc.c b/apps/codecs/libtremor/oggmalloc.c
index b11eaa5..ca917ff 100644
--- a/apps/codecs/libtremor/oggmalloc.c
+++ b/apps/codecs/libtremor/oggmalloc.c
@@ -1,7 +1,6 @@
-#include <os_types.h>
+#include "os_types.h"
-static unsigned char *mallocbuf;
-static size_t bufsize, tmp_ptr, mem_ptr;
+static size_t tmp_ptr;
void ogg_malloc_init(void)
{
diff --git a/apps/codecs/libwavpack/Makefile b/apps/codecs/libwavpack/Makefile
deleted file mode 100644
index 20daeb3..0000000
--- a/apps/codecs/libwavpack/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-WAVPACKOPTS = -O2
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(WAVPACKOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libwavpack
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libwavpack)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libwavpack/libwavpack.make b/apps/codecs/libwavpack/libwavpack.make
new file mode 100644
index 0000000..0237d39
--- /dev/null
+++ b/apps/codecs/libwavpack/libwavpack.make
@@ -0,0 +1,17 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libwavpack
+WAVPACKLIB := $(CODECDIR)/libwavpack.a
+WAVPACKLIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libwavpack/SOURCES)
+WAVPACKLIB_OBJ := $(call c2obj, $(WAVPACKLIB_SRC))
+OTHER_SRC += $(WAVPACKLIB_SRC)
+
+$(WAVPACKLIB): $(WAVPACKLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
diff --git a/apps/codecs/libwavpack/wavpack.h b/apps/codecs/libwavpack/wavpack.h
index e295211..5b5385a 100644
--- a/apps/codecs/libwavpack/wavpack.h
+++ b/apps/codecs/libwavpack/wavpack.h
@@ -7,9 +7,9 @@
////////////////////////////////////////////////////////////////////////////
// wavpack.h
-
-#include "../codec.h"
-
+#ifdef CODEC
+#include "codeclib.h"
+#endif
#include <inttypes.h>
// This header file contains all the definitions required by WavPack.
diff --git a/apps/codecs/libwma/Makefile b/apps/codecs/libwma/Makefile
deleted file mode 100644
index 91ea49b..0000000
--- a/apps/codecs/libwma/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-WMAOPTS = -O2 -DROCKBOX
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(WMAOPTS) $(TARGET) \
-$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} $(PROFILE_OPTS) -DCODEC=1
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-libwma
-DIRS =
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning libwma)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
-ifneq ($(MAKECMDGOALS),clean)
--include $(DEPFILE)
-endif
diff --git a/apps/codecs/libwma/libwma.make b/apps/codecs/libwma/libwma.make
new file mode 100644
index 0000000..d40d62e
--- /dev/null
+++ b/apps/codecs/libwma/libwma.make
@@ -0,0 +1,17 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# libwma
+WMALIB := $(CODECDIR)/libwma.a
+WMALIB_SRC := $(call preprocess, $(APPSDIR)/codecs/libwma/SOURCES)
+WMALIB_OBJ := $(call c2obj, $(WMALIB_SRC))
+OTHER_SRC += $(WMALIB_SRC)
+
+$(WMALIB): $(WMALIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
diff --git a/apps/codecs/wma.c b/apps/codecs/wma.c
index a7548ce..93f4e27 100644
--- a/apps/codecs/wma.c
+++ b/apps/codecs/wma.c
@@ -464,7 +464,7 @@
int wmares, res;
uint8_t* audiobuf;
int audiobufsize;
- int packetlength;
+ int packetlength = 0;
int errcount = 0;
/* Generic codec initialisation */
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index ca5b37d..0db0e5a 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -114,7 +114,7 @@
#include "usb_core.h"
#endif
#ifdef USB_STORAGE
-#include "../firmware/usbstack/usb_storage.h"
+#include "usbstack/usb_storage.h"
#endif
/*---------------------------------------------------*/
diff --git a/apps/lang/Makefile b/apps/lang/Makefile
deleted file mode 100644
index 15e9f49..0000000
--- a/apps/lang/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
--I. -I$(BUILDDIR) -I$(OBJDIR)
-
-# the header we generate
-HEADER = $(BUILDDIR)/max_language_size.h
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-SOURCES=$(SRC)
-
-# OUTP is the list of files to depend upon
-OUTP = $(patsubst %.lang,$(OBJDIR)/%.lng, $(SOURCES))
-
-# the generated file with features specified genlang-style
-FEATS=$(BUILDDIR)/apps/genlang-features
-
-ifndef V
-SILENT=@
-endif
-PRINTS=$(SILENT)$(call info,$(1))
-
-all: $(HEADER)
-
-# generic rule for creating .lng from .lang
-$(OBJDIR)/%.lng : %.lang $(FEATS)
- $(call PRINTS,GENLANG $<)
- $(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/english.lang -t=$(MODELNAME)`cat $(FEATS)` -i=$(TARGET_ID) -b=$@ $<
-
-$(HEADER): $(OUTP)
- $(call PRINTS,Make $(HEADER))
- $(SILENT)echo "#define MAX_LANGUAGE_SIZE `ls -ln $(OBJDIR)/* | awk '{print $$5}' | sort -n | tail -1`" > $(HEADER)
diff --git a/apps/lang/lang.make b/apps/lang/lang.make
new file mode 100644
index 0000000..416b2b4
--- /dev/null
+++ b/apps/lang/lang.make
@@ -0,0 +1,34 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+LANGS := $(call preprocess, $(APPSDIR)/lang/SOURCES)
+LANGOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.lng)
+
+SRC += $(ROOTDIR)/lang.o # yes ROOTDIR. root.make will subst it to BUILDDIR.
+
+CLEANOBJS += $(BUILDDIR)/max_language_size.h $(BUILDDIR)/lang.*
+
+# $(BUILDDIR)/apps/lang must exist before we create dependencies on it,
+# otherwise make will simply ignore those dependencies.
+# Therefore we create it here.
+#DUMMY := $(shell mkdir -p $(BUILDDIR)/apps/lang)
+
+$(BUILDDIR)/max_language_size.h: $(LANGOBJ)
+ $(call PRINTS,Create $(notdir $@))
+ $(SILENT)echo "#define MAX_LANGUAGE_SIZE `ls -ln $(BUILDDIR)/apps/lang/* | awk '{print $$5}' | sort -n | tail -1`" > $@
+
+$(BUILDDIR)/lang.o: $(APPSDIR)/lang/$(LANGUAGE).lang $(BUILDDIR)/apps/features
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
+ perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $<
+ $(call PRINTS,CC lang.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang.c -o $@
+
+$(BUILDDIR)/%.lng : $(ROOTDIR)/%.lang $(BUILDDIR)/apps/genlang-features
+ $(call PRINTS,GENLANG $(subst $(ROOTDIR)/,,$<))
+ $(SILENT)mkdir -p $(dir $@)
+ $(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/english.lang -t=$(MODELNAME)`cat $(BUILDDIR)/apps/genlang-features` -i=$(TARGET_ID) -b=$@ $<
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile
deleted file mode 100644
index 19d0622..0000000
--- a/apps/plugins/Makefile
+++ /dev/null
@@ -1,180 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \
- -I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib -I$(BUILDDIR)
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-ifdef SOFTWARECODECS
- CODECLIBS = -lmad -la52 -lffmpegFLAC -ltremor -lwavpack -lmusepack
-endif
-
-# Set up the bitmap libraries
-BITMAPLIBS =
-LINKBITMAPS =
-ifneq ($(strip $(BMP2RB_MONO)),)
- BITMAPLIBS += pluginbitmapsmono
- LINKBITMAPS += -lpluginbitmapsmono
-endif
-ifneq ($(strip $(BMP2RB_NATIVE)),)
- BITMAPLIBS += pluginbitmapsnative
- LINKBITMAPS += -lpluginbitmapsnative
-endif
-ifneq ($(strip $(BMP2RB_REMOTEMONO)),)
- BITMAPLIBS += pluginbitmapsremotemono
- LINKBITMAPS += -lpluginbitmapsremotemono
-endif
-ifneq ($(strip $(BMP2RB_REMOTENATIVE)),)
- BITMAPLIBS += pluginbitmapsremotenative
- LINKBITMAPS += -lpluginbitmapsremotenative
-endif
-
-LDS := plugin.lds
-LINKFILE := $(OBJDIR)/pluginlink.lds
-DEPFILE = $(OBJDIR)/dep-plugins
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-# This sets up 'SUBDIRS' based on the directories mentioned in SUBDIRS
-include $(TOOLSDIR)/makesubdirs.inc
-
-ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock)
-SOURCES = $(SRC)
-ELFS := $(SRC:%.c=$(OBJDIR)/%.elf)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-# as created by the cross-compiler for win32:
-DEFS := $(SRC:%.c=$(OBJDIR)/%.def)
-DIRS = .
-
-.PHONY: $(SUBDIRS)
-all: build
-
-dep: $(DEPFILE)
-
-build: $(DEPFILE) $(BITMAPLIBS)
- $(call PRINTS,MAKE rocks)$(MAKE) rocks
- $(call PRINTS,MAKE subdirs)$(MAKE) subdirs
-
-rocks: $(ROCKS)
-
-subdirs: $(SUBDIRS)
-
-$(BUILDDIR)/credits.raw: $(DOCSDIR)/CREDITS
- $(call PRINTS,create credits.raw)perl credits.pl < $< > $@
-
-$(OBJDIR)/credits.o: credits.c $(BUILDDIR)/credits.raw
- $(SILENT)mkdir -p $(dir $@)
- $(call PRINTS,CC $(<F))$(CC) $(CFLAGS) -I$(OBJDIR) -c $< -o $@
-
-pluginbitmapsmono:
- $(call PRINTS,MAKE in plugins/bitmaps/mono)$(MAKE) -C bitmaps/mono OBJDIR=$(OBJDIR)/bitmaps/mono
-
-pluginbitmapsnative:
- $(call PRINTS,MAKE in plugins/bitmaps/native)$(MAKE) -C bitmaps/native OBJDIR=$(OBJDIR)/bitmaps/native
-
-pluginbitmapsremotemono:
- $(call PRINTS,MAKE in plugins/bitmaps/remote_mono)$(MAKE) -C bitmaps/remote_mono OBJDIR=$(OBJDIR)/bitmaps/remote_mono
-
-pluginbitmapsremotenative:
- $(call PRINTS,MAKE in plugins/bitmaps/remote_native)$(MAKE) -C bitmaps/remote_native OBJDIR=$(OBJDIR)/bitmaps/remote_native
-
-ifndef SIMVER
-$(OBJDIR)/%.rock: $(OBJDIR)/%.o $(LINKFILE)
- $(SILENT)$(CC) $(CFLAGS) -o $(OBJDIR)/$*.elf $< -L$(BUILDDIR) \
- $(CODECLIBS) -lplugin $(LINKBITMAPS) -lgcc \
- -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/$*.map
- $(call PRINTS,LINK $(@F))$(OC) -O binary $(OBJDIR)/$*.elf $(OBJDIR)/$*.rock
-
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OBJDIR)/%.rock : $(OBJDIR)/%.o
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< -L$(BUILDDIR) $(CODECLIBS) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- $(SILENT)chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OBJDIR)/%.rock : $(OBJDIR)/%.o
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $< -L$(BUILDDIR) $(CODECLIBS) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- $(SILENT)chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OBJDIR)/%.rock : $(OBJDIR)/%.o
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $<
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(BUILDDIR)/libplugin.a $(BITMAPLIBS) \
- $(patsubst -l%,$(BUILDDIR)/lib%.a,$(CODECLIBS)) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- $(SILENT)chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-
-endif # end of simulator section
-
-include $(TOOLSDIR)/make.inc
-
-pluginlib:
- $(SILENT)mkdir -p $(OBJDIR)/lib
- $(call PRINTS,MAKE in plugin/lib)$(MAKE) -C lib OBJDIR=$(OBJDIR)/lib
-
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P - >$@
-
-$(SUBDIRS):
- $(SILENT)mkdir -p $(OBJDIR)/$@
- $(call PRINTS,MAKE in $@)$(MAKE) -C $@ OUTDIR=$(OBJDIR) OBJDIR=$(OBJDIR)/$@ \
- LINKBITMAPS="$(LINKBITMAPS)"
-
-clean:
- $(call PRINTS,cleaning plugins)rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock $(DEPFILE) $(ELFS) \
- $(BUILDDIR)/credits.raw $(OBJS) $(DEFS)
- $(SILENT)$(MAKE) -C lib clean OBJDIR=$(OBJDIR)/lib
- $(SILENT)$(MAKE) -C bitmaps/mono clean OBJDIR=$(OBJDIR)/bitmaps/mono
- $(SILENT)$(MAKE) -C bitmaps/native clean OBJDIR=$(OBJDIR)/bitmaps/native
- $(SILENT)$(MAKE) -C bitmaps/remote_mono clean OBJDIR=$(OBJDIR)/bitmaps/remote_mono
- $(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native
- $(SILENT)$(MAKE) -C rockboy clean OBJDIR=$(OBJDIR)/rockboy
- $(SILENT)$(MAKE) -C searchengine clean OBJDIR=$(OBJDIR)/searchengine
- @rm -rf $(BUILDDIR)/pluginbitmaps
-
--include $(DEPFILE)
diff --git a/apps/plugins/beatbox/Makefile b/apps/plugins/beatbox/Makefile
deleted file mode 100644
index 9465c42..0000000
--- a/apps/plugins/beatbox/Makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id $
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN -O3
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-beatbox
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/beatbox.rock
-else ## simulators
- OUTPUT = $(OUTDIR)/beatbox.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/beatbox.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/beatbox.map
-
-$(OUTPUT): $(OBJDIR)/beatbox.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-endif # end of simulator section
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning beatbox)rm -rf $(OBJDIR)/beatbox
- $(SILENT)rm -f $(OBJDIR)/beatbox.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/bitmaps/mono/Makefile b/apps/plugins/bitmaps/mono/Makefile
deleted file mode 100644
index 03eb77a..0000000
--- a/apps/plugins/bitmaps/mono/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-mono
-
-BMP2RB = $(BMP2RB_MONO)
-OUTPUT = $(BUILDDIR)/libpluginbitmapsmono.a
-BMPINCDIR = $(BUILDDIR)/pluginbitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning plugins/bitmaps/mono)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- @rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/plugins/bitmaps/native/Makefile b/apps/plugins/bitmaps/native/Makefile
deleted file mode 100644
index 071f0d4..0000000
--- a/apps/plugins/bitmaps/native/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-native
-
-BMP2RB = $(BMP2RB_NATIVE)
-OUTPUT = $(BUILDDIR)/libpluginbitmapsnative.a
-BMPINCDIR = $(BUILDDIR)/pluginbitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning plugins/bitmaps/native)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- @rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index b95fd37..c248bcb 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -574,13 +574,13 @@
#endif
#elif LCD_DEPTH > 1 /* grey */
#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 98
-star_tiles.10x10.grey.bmp
+star_tiles.10x10x2.bmp
#elif LCD_WIDTH >= 128 && LCD_HEIGHT >= 80
-star_tiles.8x8.grey.bmp
+star_tiles.8x8x2.bmp
#endif
#else /* monochrome */
#if LCD_WIDTH >= 112 && LCD_HEIGHT >= 62
-star_tiles.6x7.mono.bmp
+star_tiles.6x7x1.bmp
#endif
#endif
@@ -669,14 +669,14 @@
/* pictureflow */
#if defined(HAVE_LCD_COLOR) && defined(HAVE_ALBUMART) && defined(HAVE_TAGCACHE)
#if (LCD_WIDTH < 200)
- pictureflow_logo.100x18x16.bmp
+pictureflow_logo.100x18x16.bmp
#else
- pictureflow_logo.193x34x16.bmp
+pictureflow_logo.193x34x16.bmp
#endif
#if (LCD_HEIGHT < 100 )
- pictureflow_emptyslide.50x50x16.bmp
+pictureflow_emptyslide.50x50x16.bmp
#else
- pictureflow_emptyslide.100x100x16.bmp
+pictureflow_emptyslide.100x100x16.bmp
#endif
#endif
@@ -689,53 +689,53 @@
#if defined HAVE_LCD_COLOR
#if SMALLER_DIMENSION <= 80
- sliding_puzzle.80x80x16.bmp
+sliding_puzzle.80x80x16.bmp
#elif SMALLER_DIMENSION <= 108
- sliding_puzzle.108x108x16.bmp
+sliding_puzzle.108x108x16.bmp
#elif SMALLER_DIMENSION <= 128
- sliding_puzzle.128x128x16.bmp
+sliding_puzzle.128x128x16.bmp
#elif SMALLER_DIMENSION <= 132
- sliding_puzzle.132x132x16.bmp
+sliding_puzzle.132x132x16.bmp
#elif SMALLER_DIMENSION <= 176
- sliding_puzzle.176x176x16.bmp
+sliding_puzzle.176x176x16.bmp
#elif SMALLER_DIMENSION <= 240
- sliding_puzzle.240x240x16.bmp
+sliding_puzzle.240x240x16.bmp
#endif
#elif (LCD_DEPTH > 1)
#if SMALLER_DIMENSION <= 96
- sliding_puzzle.96x96x2.bmp
+sliding_puzzle.96x96x2.bmp
#elif SMALLER_DIMENSION <= 110
- sliding_puzzle.108x108x2.bmp
+sliding_puzzle.108x108x2.bmp
#elif SMALLER_DIMENSION <= 128
- sliding_puzzle.128x128x2.bmp
+sliding_puzzle.128x128x2.bmp
#endif
#else /* mono targets, one size currently */
- sliding_puzzle.80x64x1.bmp
+sliding_puzzle.80x64x1.bmp
#endif
/* Logo */
#if LCD_DEPTH == 16
#if (LCD_WIDTH >= 320)
- rockboxlogo.220x68x16.bmp
+rockboxlogo.220x68x16.bmp
#elif (LCD_WIDTH > 160)
- rockboxlogo.128x40x16.bmp
+rockboxlogo.128x40x16.bmp
#else
- rockboxlogo.90x28x16.bmp
+rockboxlogo.90x28x16.bmp
#endif
#elif LCD_DEPTH == 2
#if (LCD_WIDTH > 138)
- rockboxlogo.138x46x2.bmp
+rockboxlogo.138x46x2.bmp
#else
- rockboxlogo.91x32x2.bmp
+rockboxlogo.91x32x2.bmp
#endif
#elif LCD_DEPTH == 1
#if (LCD_WIDTH > 112)
/* Such a screen isn't currently in any target */
- rockboxlogo.112x30x1.bmp
+rockboxlogo.112x30x1.bmp
#else
- rockboxlogo.91x32x1.bmp
+rockboxlogo.91x32x1.bmp
#endif
#endif
diff --git a/apps/plugins/bitmaps/native/star_tiles.10x10.grey.bmp b/apps/plugins/bitmaps/native/star_tiles.10x10x2.bmp
similarity index 100%
rename from apps/plugins/bitmaps/native/star_tiles.10x10.grey.bmp
rename to apps/plugins/bitmaps/native/star_tiles.10x10x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/star_tiles.6x7.mono.bmp b/apps/plugins/bitmaps/native/star_tiles.6x7x1.bmp
similarity index 100%
rename from apps/plugins/bitmaps/native/star_tiles.6x7.mono.bmp
rename to apps/plugins/bitmaps/native/star_tiles.6x7x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/native/star_tiles.8x8.grey.bmp b/apps/plugins/bitmaps/native/star_tiles.8x8x2.bmp
similarity index 100%
rename from apps/plugins/bitmaps/native/star_tiles.8x8.grey.bmp
rename to apps/plugins/bitmaps/native/star_tiles.8x8x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/pluginbitmaps.make b/apps/plugins/bitmaps/pluginbitmaps.make
new file mode 100644
index 0000000..7dbcc0b
--- /dev/null
+++ b/apps/plugins/bitmaps/pluginbitmaps.make
@@ -0,0 +1,59 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+PBMPINCDIR = $(BUILDDIR)/pluginbitmaps
+
+PFLAGS += -I$(PBMPINCDIR)
+
+ifneq ($(strip $(BMP2RB_MONO)),)
+PBMP = $(call preprocess, $(APPSDIR)/plugins/bitmaps/mono/SOURCES)
+endif
+ifneq ($(strip $(BMP2RB_NATIVE)),)
+PBMP += $(call preprocess, $(APPSDIR)/plugins/bitmaps/native/SOURCES)
+endif
+ifneq ($(strip $(BMP2RB_REMOTEMONO)),)
+PBMP += $(call preprocess, $(APPSDIR)/plugins/bitmaps/remote_mono/SOURCES)
+endif
+ifneq ($(strip $(BMP2RB_REMOTENATIVE)),)
+PBMP += $(call preprocess, $(APPSDIR)/plugins/bitmaps/remote_native/SOURCES)
+endif
+
+ifdef PBMP # does player use bitmaps?
+
+PLUGIN_BITMAPS := $(PBMP:$(ROOTDIR)/%.bmp=$(BUILDDIR)/%.o)
+
+PLUGINBITMAPLIB := $(BUILDDIR)/apps/plugins/bitmaps/libpluginbitmaps.a
+PLUGINBITMAPDIR := $(dir $(PLUGINBITMAPLIB))
+
+PBMPHFILES := $(subst $(ROOTDIR),$(BUILDDIR),$(PBMP))
+PBMPHFILES := $(shell echo $(PBMPHFILES) | sed -e 's/\.[0-9x]\+\.bmp/.h/g' -e 's/\.bmp/.h/g' -e 's/apps\/plugins\/bitmaps\/\(mono\|native\|remote_mono\|remote_native\)/pluginbitmaps/g')
+
+$(PBMPHFILES): $(PLUGIN_BITMAPS)
+
+$(PLUGINBITMAPLIB): $(PLUGIN_BITMAPS)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $+ >/dev/null 2>&1
+
+# pattern rules to create .c files from .bmp, one for each subdir:
+$(BUILDDIR)/apps/plugins/bitmaps/mono/%.c: $(ROOTDIR)/apps/plugins/bitmaps/mono/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(PBMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_MONO) -h $(PBMPINCDIR) $< > $@
+
+$(BUILDDIR)/apps/plugins/bitmaps/native/%.c: $(ROOTDIR)/apps/plugins/bitmaps/native/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(PBMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_NATIVE) -h $(PBMPINCDIR) $< > $@
+
+$(BUILDDIR)/apps/plugins/bitmaps/remote_mono/%.c: $(ROOTDIR)/apps/plugins/bitmaps/remote_mono/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(PBMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_REMOTEMONO) -h $(PBMPINCDIR) $< > $@
+
+$(BUILDDIR)/apps/plugins/bitmaps/remote_native/%.c: $(ROOTDIR)/apps/plugins/bitmaps/remote_native/%.bmp $(TOOLSDIR)/bmp2rb
+ $(SILENT)mkdir -p $(dir $@) $(PBMPINCDIR)
+ $(call PRINTS,BMP2RB $(<F))$(BMP2RB_REMOTENATIVE) -h $(PBMPINCDIR) $< > $@
+
+endif
diff --git a/apps/plugins/bitmaps/remote_mono/Makefile b/apps/plugins/bitmaps/remote_mono/Makefile
deleted file mode 100644
index d3858fa..0000000
--- a/apps/plugins/bitmaps/remote_mono/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-remotemono
-
-BMP2RB = $(BMP2RB_REMOTEMONO)
-OUTPUT = $(BUILDDIR)/libpluginbitmapsremotemono.a
-BMPINCDIR = $(BUILDDIR)/pluginbitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning plugins/bitmaps/remotemono)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- @rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/plugins/bitmaps/remote_native/Makefile b/apps/plugins/bitmaps/remote_native/Makefile
deleted file mode 100644
index 3802e75..0000000
--- a/apps/plugins/bitmaps/remote_native/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(BUILDDIR) \
- -I$(OBJDIR)
-CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES)
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-CSRC := $(SRC:%.bmp=$(OBJDIR)/%.c)
-OBJS := $(CSRC:%.c=%.o)
-DEPFILE = $(OBJDIR)/dep-bitmaps-remotenative
-
-BMP2RB = $(BMP2RB_REMOTENATIVE)
-OUTPUT = $(BUILDDIR)/libpluginbitmapsremotenative.a
-BMPINCDIR = $(BUILDDIR)/pluginbitmaps
-
-include $(TOOLSDIR)/makebmp.inc
-
-clean:
- $(call PRINTS,cleaning plugins/bitmaps/remote_native)rm -f $(CSRC) $(OBJS) $(OUTPUT) $(DEPFILE)
- @rmdir $(OBJDIR)
-
--include $(DEPFILE)
diff --git a/apps/plugins/bitmaps/remote_native/SOURCES b/apps/plugins/bitmaps/remote_native/SOURCES
index 3633f23..2bc3d59 100644
--- a/apps/plugins/bitmaps/remote_native/SOURCES
+++ b/apps/plugins/bitmaps/remote_native/SOURCES
@@ -18,7 +18,7 @@
/* Logo */
#if (LCD_REMOTE_DEPTH == 1)
- remote_rockboxlogo.91x32x1.bmp
+remote_rockboxlogo.91x32x1.bmp
#elif (LCD_REMOTE_DEPTH == 2)
- remote_rockboxlogo.91x32x2.bmp
+remote_rockboxlogo.91x32x2.bmp
#endif
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index 65aaa3e..5d92ed1 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -20,7 +20,7 @@
**************************************************************************/
#include "plugin.h"
#include "time.h"
-#include "fixedpoint.h"
+#include "lib/fixedpoint.h"
PLUGIN_HEADER
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c
index 159e1ec..6d84d2b 100644
--- a/apps/plugins/brickmania.c
+++ b/apps/plugins/brickmania.c
@@ -20,8 +20,8 @@
****************************************************************************/
#include "plugin.h"
-#include "configfile.h" /* Part of libplugin */
-#include "helper.h"
+#include "lib/configfile.h" /* Part of libplugin */
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c
index 17bfeca..5415f3b 100644
--- a/apps/plugins/bubbles.c
+++ b/apps/plugins/bubbles.c
@@ -25,9 +25,9 @@
#ifdef HAVE_LCD_BITMAP
-#include "xlcd.h"
-#include "pluginlib_actions.h"
-#include "fixedpoint.h"
+#include "lib/xlcd.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/fixedpoint.h"
PLUGIN_HEADER
diff --git a/apps/plugins/chessbox.c b/apps/plugins/chessbox.c
index 51ff184..9e86c39 100644
--- a/apps/plugins/chessbox.c
+++ b/apps/plugins/chessbox.c
@@ -24,7 +24,7 @@
#if MEM <= 8 && !defined(SIMULATOR)
-#include "overlay.h"
+#include "lib/overlay.h"
PLUGIN_HEADER
diff --git a/apps/plugins/chessbox/Makefile b/apps/plugins/chessbox/Makefile
deleted file mode 100644
index 4efb40d..0000000
--- a/apps/plugins/chessbox/Makefile
+++ /dev/null
@@ -1,114 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(BUILDDIR)/pluginbitmaps -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) \
- -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-chessbox
-SRC = chessbox.c gnuchess.c opening.c chessbox_pgn.c
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
-ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
- LDS := archos.lds
- OUTPUT = $(OUTDIR)/chessbox.ovl
-else ## iRiver target
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/chessbox.rock
-endif
-else ## simulators
- OUTPUT = $(OUTDIR)/chessbox.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/chessbox.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/chessbox.map
-
-$(OUTPUT): $(OBJDIR)/chessbox.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
- $(BUILDDIR)/libplugin.a $(BITMAPLIBS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning chessbox)rm -rf $(OBJDIR)/chessbox
- $(SILENT)rm -f $(OBJDIR)/chessbox.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/chessbox/SOURCES b/apps/plugins/chessbox/SOURCES
new file mode 100644
index 0000000..067e3f0
--- /dev/null
+++ b/apps/plugins/chessbox/SOURCES
@@ -0,0 +1,4 @@
+chessbox.c
+gnuchess.c
+opening.c
+chessbox_pgn.c
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index f34bdbf..f8db7d9 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -43,7 +43,7 @@
PLUGIN_HEADER
/* Tile size defined by the assigned bitmap */
-#include "chessbox_pieces.h"
+#include "pluginbitmaps/chessbox_pieces.h"
#define TILE_WIDTH BMPWIDTH_chessbox_pieces
#define TILE_HEIGHT (BMPHEIGHT_chessbox_pieces/26)
diff --git a/apps/plugins/chessbox/chessbox.make b/apps/plugins/chessbox/chessbox.make
new file mode 100644
index 0000000..d42984c
--- /dev/null
+++ b/apps/plugins/chessbox/chessbox.make
@@ -0,0 +1,58 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+CHESSBOX_SRCDIR = $(APPSDIR)/plugins/chessbox
+CHESSBOX_OBJDIR = $(BUILDDIR)/apps/plugins/chessbox
+
+CHESSBOX_SRC := $(call preprocess, $(CHESSBOX_SRCDIR)/SOURCES)
+CHESSBOX_OBJ := $(call c2obj, $(CHESSBOX_SRC))
+
+OTHER_SRC += $(CHESSBOX_SRC)
+
+ifndef SIMVER
+ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
+ ## archos recorder targets
+ CHESSBOX_INLDS := $(CHESSBOX_SRCDIR)/archos.lds
+ ROCKS += $(CHESSBOX_OBJDIR)/chessbox.ovl
+else
+ ### all other targets
+ CHESSBOX_INLDS := $(APPSDIR)/plugins/plugin.lds
+ ROCKS += $(CHESSBOX_OBJDIR)/chessbox.rock
+endif
+ CHESSBOX_OVLFLAGS = -T$(CHESSBOX_OUTLDS) -Wl,--gc-sections -Wl,-Map,$*.map
+ CHESSBOX_OUTLDS = $(CHESSBOX_OBJDIR)/chessbox.lds
+else
+ ### simulator
+ ROCKS += $(CHESSBOX_OBJDIR)/chessbox.rock
+ CHESSBOX_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile
+endif
+
+ifeq ($(CPU),sh)
+# sh need to retain its' -Os
+CHESSBOXFLAGS = $(PLUGINFLAGS)
+else
+CHESSBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O2
+endif
+
+$(CHESSBOX_OUTLDS): $(CHESSBOX_INLDS) $(CHESSBOX_OBJ)
+ $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
+
+$(CHESSBOX_OBJDIR)/chessbox.rock: $(CHESSBOX_OBJ) $(CHESSBOX_OUTLDS) $(PLUGINBITMAPLIB)
+
+$(CHESSBOX_OBJDIR)/chessbox.ovl: $(CHESSBOX_OBJ) $(CHESSBOX_OUTLDS) $(PLUGINBITMAPLIB)
+ $(SILENT)$(CC) $(PLUGINFLAGS) -o $(CHESSBOX_OBJDIR)/$*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(CHESSBOX_OVLFLAGS)
+ $(call PRINTS,LD $(@F))$(OC) -O binary $(CHESSBOX_OBJDIR)/$*.elf $@
+
+# special pattern rule for compiling chessbox with extra flags
+$(CHESSBOX_OBJDIR)/%.o: $(CHESSBOX_SRCDIR)/%.c $(PLUGINBITMAPLIB) $(CHESSBOX_SRCDIR)/chessbox.make
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(CHESSBOXFLAGS) -c $< -o $@
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index 1329777..b497b16 100644
--- a/apps/plugins/chopper.c
+++ b/apps/plugins/chopper.c
@@ -21,9 +21,9 @@
****************************************************************************/
#include "plugin.h"
-#include "xlcd.h"
-#include "configfile.h"
-#include "helper.h"
+#include "lib/xlcd.h"
+#include "lib/configfile.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/clock/Makefile b/apps/plugins/clock/Makefile
deleted file mode 100644
index abf932a..0000000
--- a/apps/plugins/clock/Makefile
+++ /dev/null
@@ -1,112 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $$Id: $$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. -I$(APPSDIR)/plugins/lib \
- $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) \
- -I$(BUILDDIR)/pluginbitmaps
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-clock
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/clock.rock
-else ## simulators
- OUTPUT = $(OUTDIR)/clock.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/clock.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/clock.map
-
-$(OUTPUT): $(OBJDIR)/clock.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
- $(BUILDDIR)/libplugin.a $(BITMAPLIBS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning clock)rm -rf $(OBJDIR)/clock
- $(SILENT)rm -f $(OBJDIR)/clock.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c
index 1d257fd..9279a18 100644
--- a/apps/plugins/clock/clock.c
+++ b/apps/plugins/clock/clock.c
@@ -21,8 +21,8 @@
#include "plugin.h"
#include "time.h"
-#include "pluginlib_actions.h"
-#include "xlcd.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/xlcd.h"
#include "clock.h"
#include "clock_counter.h"
diff --git a/apps/plugins/clock/clock.make b/apps/plugins/clock/clock.make
new file mode 100644
index 0000000..c864d67
--- /dev/null
+++ b/apps/plugins/clock/clock.make
@@ -0,0 +1,21 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+CLOCKSRCDIR := $(APPSDIR)/plugins/clock
+CLOCKBUILDDIR := $(BUILDDIR)/apps/plugins/clock
+
+ROCKS += $(CLOCKBUILDDIR)/clock.rock
+
+CLOCK_SRC := $(call preprocess, $(CLOCKSRCDIR)/SOURCES)
+CLOCK_OBJ := $(call c2obj, $(CLOCK_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(CLOCK_SRC)
+
+$(CLOCKBUILDDIR)/clock.rock: $(CLOCK_OBJ)
diff --git a/apps/plugins/clock/clock_bitmap_strings.h b/apps/plugins/clock/clock_bitmap_strings.h
index 549a4a9..3f5a09d 100644
--- a/apps/plugins/clock/clock_bitmap_strings.h
+++ b/apps/plugins/clock/clock_bitmap_strings.h
@@ -23,7 +23,7 @@
#ifndef _CLOCK_BITMAP_STRINGS_
#define _CLOCK_BITMAP_STRINGS_
#include "plugin.h"
-#include "picture.h"
+#include "lib/picture.h"
void draw_string(struct screen* display, const struct picture* bitmaps,
char* str, int x, int y);
diff --git a/apps/plugins/clock/clock_bitmaps.c b/apps/plugins/clock/clock_bitmaps.c
index 2a05900..c237a29 100644
--- a/apps/plugins/clock/clock_bitmaps.c
+++ b/apps/plugins/clock/clock_bitmaps.c
@@ -23,24 +23,24 @@
#include "clock_bitmaps.h"
/* bitmaps */
-#include "clock_binary.h"
-#include "clock_digits.h"
-#include "clock_smalldigits.h"
-#include "clock_segments.h"
-#include "clock_smallsegments.h"
+#include "pluginbitmaps/clock_binary.h"
+#include "pluginbitmaps/clock_digits.h"
+#include "pluginbitmaps/clock_smalldigits.h"
+#include "pluginbitmaps/clock_segments.h"
+#include "pluginbitmaps/clock_smallsegments.h"
-#include "clock_logo.h"
-#include "clock_messages.h"
+#include "pluginbitmaps/clock_logo.h"
+#include "pluginbitmaps/clock_messages.h"
#if NB_SCREENS==2
-#include "clock_binary_remote.h"
-#include "clock_digits_remote.h"
-#include "clock_smalldigits_remote.h"
-#include "clock_segments_remote.h"
-#include "clock_smallsegments_remote.h"
+#include "pluginbitmaps/clock_binary_remote.h"
+#include "pluginbitmaps/clock_digits_remote.h"
+#include "pluginbitmaps/clock_smalldigits_remote.h"
+#include "pluginbitmaps/clock_segments_remote.h"
+#include "pluginbitmaps/clock_smallsegments_remote.h"
-#include "clock_logo_remote.h"
-#include "clock_messages_remote.h"
+#include "pluginbitmaps/clock_logo_remote.h"
+#include "pluginbitmaps/clock_messages_remote.h"
#endif
diff --git a/apps/plugins/clock/clock_bitmaps.h b/apps/plugins/clock/clock_bitmaps.h
index e6e0965..750c4d3 100644
--- a/apps/plugins/clock/clock_bitmaps.h
+++ b/apps/plugins/clock/clock_bitmaps.h
@@ -21,7 +21,7 @@
#ifndef _CLOCK_BITMAPS_
#define _CLOCK_BITMAPS_
-#include "picture.h"
+#include "lib/picture.h"
extern const struct picture logos[];
extern const struct picture messages[];
diff --git a/apps/plugins/clock/clock_counter.h b/apps/plugins/clock/clock_counter.h
index 25523d4..46563e9 100644
--- a/apps/plugins/clock/clock_counter.h
+++ b/apps/plugins/clock/clock_counter.h
@@ -2,7 +2,7 @@
#define _CLOCK_MESSAGE_
#include "clock.h"
#include "plugin.h"
-#include "picture.h"
+#include "lib/picture.h"
struct counter{
int ticks_at_last_unpause;/* to count the time from last pause to now */
diff --git a/apps/plugins/clock/clock_draw_analog.c b/apps/plugins/clock/clock_draw_analog.c
index 391bd73..c41ec3b 100644
--- a/apps/plugins/clock/clock_draw_analog.c
+++ b/apps/plugins/clock/clock_draw_analog.c
@@ -20,8 +20,8 @@
****************************************************************************/
#include "clock_draw_analog.h"
-#include "xlcd.h"
-#include "fixedpoint.h"
+#include "lib/xlcd.h"
+#include "lib/fixedpoint.h"
#include "clock_bitmaps.h"
#include "clock_bitmap_strings.h"
diff --git a/apps/plugins/clock/clock_draw_binary.c b/apps/plugins/clock/clock_draw_binary.c
index b6c7a9a..99f9093 100644
--- a/apps/plugins/clock/clock_draw_binary.c
+++ b/apps/plugins/clock/clock_draw_binary.c
@@ -21,7 +21,7 @@
#include "clock_draw_binary.h"
#include "clock_bitmap_strings.h"
#include "clock_bitmaps.h"
-#include "picture.h"
+#include "lib/picture.h"
const struct picture* binary_skin[]={binary,digits,segments};
diff --git a/apps/plugins/clock/clock_draw_digital.c b/apps/plugins/clock/clock_draw_digital.c
index 7c5925d..de5f427 100644
--- a/apps/plugins/clock/clock_draw_digital.c
+++ b/apps/plugins/clock/clock_draw_digital.c
@@ -23,7 +23,7 @@
#include "clock_draw_digital.h"
#include "clock_bitmap_strings.h"
#include "clock_bitmaps.h"
-#include "picture.h"
+#include "lib/picture.h"
const struct picture* digits_skin[]={digits,segments};
const struct picture* smalldigits_skin[]={smalldigits,smallsegments};
diff --git a/apps/plugins/clock/clock_settings.c b/apps/plugins/clock/clock_settings.c
index 1147055..1d78c47 100644
--- a/apps/plugins/clock/clock_settings.c
+++ b/apps/plugins/clock/clock_settings.c
@@ -23,7 +23,7 @@
#include "clock_bitmaps.h"
#include "clock_draw.h"
#include "clock_settings.h"
-#include "picture.h"
+#include "lib/picture.h"
static int max_skin[]={
[ANALOG]=2,
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index 11a5d2f..e3e659b 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 8be304e..ec1930f 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -21,10 +21,10 @@
*
***************************************************************************/
#include "plugin.h"
-#include "grey.h"
-#include "playergfx.h"
-#include "xlcd.h"
-#include "fixedpoint.h"
+#include "lib/grey.h"
+#include "lib/playergfx.h"
+#include "lib/xlcd.h"
+#include "lib/fixedpoint.h"
PLUGIN_HEADER
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c
index 96cb5a4..145c3ce 100644
--- a/apps/plugins/demystify.c
+++ b/apps/plugins/demystify.c
@@ -24,8 +24,8 @@
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
-#include "pluginlib_actions.h"
-#include "helper.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/helper.h"
PLUGIN_HEADER
#define DEFAULT_WAIT_TIME 3
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c
index 086309a..77bbda3 100644
--- a/apps/plugins/dice.c
+++ b/apps/plugins/dice.c
@@ -20,8 +20,8 @@
****************************************************************************/
#include "plugin.h"
-#include "pluginlib_actions.h"
-#include "configfile.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/configfile.h"
#define MAX_DICES 12
#define INITIAL_NB_DICES 1
diff --git a/apps/plugins/doom/Makefile b/apps/plugins/doom/Makefile
deleted file mode 100644
index df6baf7..0000000
--- a/apps/plugins/doom/Makefile
+++ /dev/null
@@ -1,173 +0,0 @@
-################################################################
-#
-# $Id$
-#
-# $Log: Makefile,v $
-# Revision 1.13 2006-12-13 06:52:09 kkurbjun
-# Free more plugin memory
-#
-# Revision 1.12 2006-12-13 05:46:51 kkurbjun
-# Will it fit?
-#
-# Revision 1.11 2006-12-13 04:44:17 kkurbjun
-# Dehacked and BEX support for Doom - currently only supports a DEHACKED file in a WAD (not as a standalone file yet).
-#
-# Revision 1.10 2006-10-27 21:47:55 amiconn
-# Next step of Makefile tuning: * Use 'make' internal commands for printing messages. Saves build time especially on cygwin. * SILENT variable used in more places. * Bitmap build system uses one Makefille less.
-#
-# Revision 1.9 2006-10-23 22:33:36 amiconn
-# Consistent style of 'make' messages. Always use ranlib after ar.
-#
-# Revision 1.8 2006-10-23 14:09:28 markun
-# rearrange compiler options to avoid conflicts with header files on FreeBSD
-#
-# Revision 1.7 2006-10-22 00:21:56 amiconn
-# Speed up build process in general by using internal functions of make instead of spawning sub-shells where possible.
-#
-# Revision 1.6 2006-09-29 20:04:35 barrywardell
-# Cleaner implementation of the recent OSX simulator build fix. No need to define SHARED_FLAG in each Makefile. Just have configure create it in the root Makefile instead.
-#
-# Revision 1.5 2006-09-29 16:15:08 barrywardell
-# Allow UI simulator to be build on OS (Slightly updated version of FS5767)
-#
-# Revision 1.4 2006-07-27 13:27:19 linus
-# Moved the X5 button driver to the target tree
-#
-# Revision 1.3 2006-04-14 21:07:56 kkurbjun
-# Start of profiling support for doom.
-#
-# Revision 1.2 2006-03-29 21:16:45 kkurbjun
-# Use rockbox endian defines
-#
-# Revision 1.1 2006-03-28 15:44:01 dave
-# Patch #2969 - Doom! Currently only working on the H300.
-#
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN \
- -Wno-strict-prototypes $(PROFILE_OPTS)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-# The arm code compiles too large for the plugin buffer when set to optimize for speed
-ifeq ($(CPU), arm)
- CFLAGS += -Os
-ifndef SIMVER
-ifeq ($(TARGET), IRIVER_H100)
- CFLAGS += -mstructure-size-boundary=8
-endif
-endif
-else
- CFLAGS += -O2
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-doom
-SRC = info.c doomdef.c doomstat.c dstrings.c tables.c \
- f_finale.c f_wipe.c d_net.c d_items.c g_game.c m_menu.c m_argv.c \
- m_cheat.c m_random.c am_map.c p_ceilng.c p_doors.c p_genlin.c \
- p_enemy.c p_floor.c p_inter.c p_lights.c p_map.c p_maputl.c p_plats.c \
- p_pspr.c p_setup.c p_sight.c p_spec.c p_switch.c p_mobj.c p_telept.c \
- p_tick.c p_saveg.c p_user.c r_bsp.c r_data.c r_draw.c r_main.c \
- r_plane.c r_segs.c r_sky.c r_things.c wi_stuff.c v_video.c st_lib.c \
- st_stuff.c hu_stuff.c hu_lib.c s_sound.c z_zone.c z_bmalloc.c sounds.c \
- d_main.c m_misc.c m_bbox.c i_system.c i_sound.c i_video.c \
- w_wad.c rockdoom.c d_deh.c ../../../firmware/common/sscanf.c
-
-# sscanf isn't built into the core right now - should remove from here if that
-# changes
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-#OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-#OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DIRS = .
-
-
-ifndef SIMVER
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/doom.rock
-else ## simulators
- OUTPUT = $(OUTDIR)/doom.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/doom.elf: $(OBJS) $(LINKFILE)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc\
- -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/doom.map
-
-$(OUTPUT): $(OBJDIR)/doom.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the sdl simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
- $(BUILDDIR)/libplugin.a -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) \
- -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning doom)rm -rf $(OBJDIR)/doom
- $(SILENT)rm -f $(OBJDIR)/doom.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/doom/SOURCES b/apps/plugins/doom/SOURCES
new file mode 100644
index 0000000..6cd69fa
--- /dev/null
+++ b/apps/plugins/doom/SOURCES
@@ -0,0 +1,62 @@
+info.c
+doomdef.c
+doomstat.c
+dstrings.c
+tables.c
+f_finale.c
+f_wipe.c
+d_net.c
+d_items.c
+g_game.c
+m_menu.c
+m_argv.c
+m_cheat.c
+m_random.c
+am_map.c
+p_ceilng.c
+p_doors.c
+p_genlin.c
+p_enemy.c
+p_floor.c
+p_inter.c
+p_lights.c
+p_map.c
+p_maputl.c
+p_plats.c
+p_pspr.c
+p_setup.c
+p_sight.c
+p_spec.c
+p_switch.c
+p_mobj.c
+p_telept.c
+p_tick.c
+p_saveg.c
+p_user.c
+r_bsp.c
+r_data.c
+r_draw.c
+r_main.c
+r_plane.c
+r_segs.c
+r_sky.c
+r_things.c
+wi_stuff.c
+v_video.c
+st_lib.c
+st_stuff.c
+hu_stuff.c
+hu_lib.c
+s_sound.c
+z_zone.c
+z_bmalloc.c
+sounds.c
+d_main.c
+m_misc.c
+m_bbox.c
+i_system.c
+i_sound.c
+i_video.c
+w_wad.c
+rockdoom.c
+d_deh.c
diff --git a/apps/plugins/doom/doom.make b/apps/plugins/doom/doom.make
new file mode 100644
index 0000000..d566f53
--- /dev/null
+++ b/apps/plugins/doom/doom.make
@@ -0,0 +1,54 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+DOOMSRCDIR := $(APPSDIR)/plugins/doom
+DOOMBUILDDIR := $(BUILDDIR)/apps/plugins/doom
+
+ROCKS += $(DOOMBUILDDIR)/doom.rock
+
+DOOM_SRC := $(call preprocess, $(DOOMSRCDIR)/SOURCES)
+DOOM_OBJ := $(call c2obj, $(DOOM_SRC))
+DOOM_OBJ += $(DOOMBUILDDIR)/sscanf.o
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(DOOM_SRC)
+
+DOOMCFLAGS = $(PLUGINFLAGS) -Wno-strict-prototypes
+
+# The arm code compiles too large for the plugin buffer when set to optimize for speed
+ifeq ($(CPU), arm)
+ DOOMCFLAGS += -Os
+ifndef SIMVER
+ifeq ($(TARGET), IRIVER_H100)
+ DOOMCCFLAGS += -mstructure-size-boundary=8
+endif
+endif
+else
+ DOOMCFLAGS += -O2
+endif
+
+$(DOOMBUILDDIR)/sscanf.c: $(FIRMDIR)/common/sscanf.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CP $<)cp $< $@
+
+$(DOOMBUILDDIR)/sscanf.o: $(DOOMBUILDDIR)/sscanf.c
+
+$(DOOMBUILDDIR)/doom.rock: $(DOOM_OBJ)
+# for some reason, this doesn't match the implicit rule in plugins.make,
+# so we have to duplicate the link command here
+ $(SILENT)$(CC) $(PLUGINFLAGS) -o $*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(PLUGINLDFLAGS)
+ $(call PRINTS,LD $(@F))$(OC) -O binary $*.elf $@
+
+# new rule needed to use extra compile flags
+$(DOOMBUILDDIR)/%.o: $(DOOMSRCDIR)/%.c $(DOOMSRCDIR)/doom.make
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(DOOMCFLAGS) -c $< -o $@
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index 15d0166..7713fe1 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -117,7 +117,7 @@
#include "rockmacros.h"
#ifndef HAVE_LCD_COLOR
-#include "../lib/grey.h"
+#include "lib/grey.h"
GREY_INFO_STRUCT_IRAM
static unsigned char greybuffer[LCD_WIDTH] IBSS_ATTR; /* off screen buffer */
static unsigned char *gbuf;
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c
index e982af9..02617ab 100644
--- a/apps/plugins/euroconverter.c
+++ b/apps/plugins/euroconverter.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "configfile.h"
+#include "lib/configfile.h"
#ifdef HAVE_LCD_CHARCELLS
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c
index 5987e9c..f1b62f5 100644
--- a/apps/plugins/fire.c
+++ b/apps/plugins/fire.c
@@ -22,14 +22,14 @@
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
#ifdef HAVE_LCD_BITMAP
-#include "pluginlib_actions.h"
-#include "fixedpoint.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/fixedpoint.h"
#ifndef HAVE_LCD_COLOR
-#include "grey.h"
+#include "lib/grey.h"
#endif
#if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c
index e79f0ff..5134d01 100644
--- a/apps/plugins/fireworks.c
+++ b/apps/plugins/fireworks.c
@@ -19,8 +19,8 @@
*
****************************************************************************/
#include "plugin.h"
-#include "oldmenuapi.h"
-#include "helper.h"
+#include "lib/oldmenuapi.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c
index b5fabe0..cd8db5b 100644
--- a/apps/plugins/greyscale.c
+++ b/apps/plugins/greyscale.c
@@ -22,10 +22,10 @@
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
-#include "grey.h"
+#include "lib/grey.h"
PLUGIN_HEADER
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index 0f8b92d..8b73221 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -26,8 +26,8 @@
*/
#include "plugin.h"
-#include "highscore.h"
-#include "helper.h"
+#include "lib/highscore.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c
index a4865b4..2380dad 100644
--- a/apps/plugins/jackpot.c
+++ b/apps/plugins/jackpot.c
@@ -20,8 +20,8 @@
****************************************************************************/
#include "plugin.h"
-#include "pluginlib_actions.h"
-#include "picture.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/picture.h"
PLUGIN_HEADER
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c
index 075edfd..239827c 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -22,7 +22,7 @@
****************************************************************************/
#include "plugin.h"
-#include "playback_control.h"
+#include "lib/playback_control.h"
#ifdef HAVE_LCD_BITMAP
diff --git a/apps/plugins/jpeg/Makefile b/apps/plugins/jpeg/Makefile
deleted file mode 100644
index 8320725..0000000
--- a/apps/plugins/jpeg/Makefile
+++ /dev/null
@@ -1,75 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) \
- -I$(BUILDDIR)/pluginbitmaps -I$(APPSDIR)/plugins/lib
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-jpeg
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/jpeg.rock
-else ## simulators
- OUTPUT = $(OUTDIR)/jpeg.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/jpeg.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/jpeg.map
-
-$(OUTPUT): $(OBJDIR)/jpeg.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning jpeg)rm -rf $(OBJDIR)/jpeg
- $(SILENT)rm -f $(OBJDIR)/jpeg.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/jpeg/jpeg.make b/apps/plugins/jpeg/jpeg.make
new file mode 100644
index 0000000..9413ef2
--- /dev/null
+++ b/apps/plugins/jpeg/jpeg.make
@@ -0,0 +1,21 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+JPEGSRCDIR := $(APPSDIR)/plugins/jpeg
+JPEGBUILDDIR := $(BUILDDIR)/apps/plugins/jpeg
+
+ROCKS += $(JPEGBUILDDIR)/jpeg.rock
+
+JPEG_SRC := $(call preprocess, $(JPEGSRCDIR)/SOURCES)
+JPEG_OBJ := $(call c2obj, $(JPEG_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(JPEG_SRC)
+
+$(JPEGBUILDDIR)/jpeg.rock: $(JPEG_OBJ)
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index fef3d4f..dae413c 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "md5.h"
+#include "lib/md5.h"
PLUGIN_HEADER
#define KEYBOX_FILE PLUGIN_DIR "/apps/keybox.dat"
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c
index 94f48ea..bad757c 100644
--- a/apps/plugins/lamp.c
+++ b/apps/plugins/lamp.c
@@ -23,7 +23,7 @@
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/lib/Makefile b/apps/plugins/lib/Makefile
deleted file mode 100644
index c75cca1..0000000
--- a/apps/plugins/lib/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-# ../.. for the plugin.h in the apps dir
-# .. for stuff in the plugins dir
-# . for stuff in the pluginlib dir
-INCLUDES=-I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-# Sectioned compilation for target
-ifndef SIMVER
- CFLAGS += -ffunction-sections -fdata-sections
-endif
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DEPFILE = $(OBJDIR)/dep-pluginlib
-DIRS = .
-
-OUTPUT = $(BUILDDIR)/libplugin.a
-
-all: $(OUTPUT)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning lib)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c
index be4a39c..b2e6401 100644
--- a/apps/plugins/logo.c
+++ b/apps/plugins/logo.c
@@ -19,7 +19,7 @@
*
**************************************************************************/
#include "plugin.h"
-#include "playergfx.h"
+#include "lib/playergfx.h"
PLUGIN_HEADER
diff --git a/apps/plugins/mandelbrot.c b/apps/plugins/mandelbrot.c
index ca7f708..56483bd 100644
--- a/apps/plugins/mandelbrot.c
+++ b/apps/plugins/mandelbrot.c
@@ -23,8 +23,8 @@
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
-#include "grey.h"
-#include "xlcd.h"
+#include "lib/grey.h"
+#include "lib/xlcd.h"
PLUGIN_HEADER
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c
index f7751ce..67c0623 100644
--- a/apps/plugins/maze.c
+++ b/apps/plugins/maze.c
@@ -31,7 +31,7 @@
*/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
PLUGIN_HEADER
@@ -54,7 +54,7 @@
# define MAZE_RDOWN (BUTTON_PLAY | BUTTON_REPEAT)
#else
-# include "pluginlib_actions.h"
+# include "lib/pluginlib_actions.h"
# define MAZE_NEW PLA_START
# define MAZE_QUIT PLA_QUIT
# define MAZE_SOLVE PLA_FIRE
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c
index c1726a5..fac12de 100644
--- a/apps/plugins/mazezam.c
+++ b/apps/plugins/mazezam.c
@@ -20,10 +20,10 @@
*
****************************************************************************/
#include "plugin.h"
-#include "configfile.h"
-#include "helper.h"
-#include "pluginlib_actions.h"
-#include "playback_control.h"
+#include "lib/configfile.h"
+#include "lib/helper.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/playback_control.h"
/* Include standard plugin macro */
PLUGIN_HEADER
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 1841860..58abbca 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "pluginlib_actions.h"
+#include "lib/pluginlib_actions.h"
PLUGIN_HEADER
diff --git a/apps/plugins/midi/Makefile b/apps/plugins/midi/Makefile
deleted file mode 100644
index 03d6bc6..0000000
--- a/apps/plugins/midi/Makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id $
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
-
- MIDIOPTS = -O2
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) $(MIDIOPTS) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-midiplay
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/midiplay.rock
-else ## simulators
- OUTPUT = $(OUTDIR)/midiplay.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/midiplay.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/midiplay.map
-
-$(OUTPUT): $(OBJDIR)/midiplay.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-endif # end of simulator section
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning midiplay)rm -rf $(OBJDIR)/midiplay
- $(SILENT)rm -f $(OBJDIR)/midiplay.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/midi/midi.make b/apps/plugins/midi/midi.make
new file mode 100644
index 0000000..9100764
--- /dev/null
+++ b/apps/plugins/midi/midi.make
@@ -0,0 +1,28 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+MIDISRCDIR := $(APPSDIR)/plugins/midi
+MIDIBUILDDIR := $(BUILDDIR)/apps/plugins/midi
+
+ROCKS += $(MIDIBUILDDIR)/midi.rock
+
+MIDI_SRC := $(call preprocess, $(MIDISRCDIR)/SOURCES)
+MIDI_OBJ := $(call c2obj, $(MIDI_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(MIDI_SRC)
+
+$(MIDIBUILDDIR)/midi.rock: $(MIDI_OBJ)
+# for some reason, this doesn't match the implicit rule in plugins.make,
+# so we have to duplicate the link command here
+ $(SILENT)$(CC) $(PLUGINFLAGS) -o $*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(PLUGINLDFLAGS)
+ $(call PRINTS,LD $(@F))$(OC) -O binary $*.elf $@
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index 90ffa37..4c8139c 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -19,7 +19,7 @@
*
**************************************************************************/
#include "plugin.h"
-#include "playergfx.h"
+#include "lib/playergfx.h"
PLUGIN_HEADER
diff --git a/apps/plugins/mpegplayer/Makefile b/apps/plugins/mpegplayer/Makefile
deleted file mode 100644
index 7f90cbc..0000000
--- a/apps/plugins/mpegplayer/Makefile
+++ /dev/null
@@ -1,78 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(APPSDIR)/plugins/lib -I$(OUTDIR) -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN -DMPEGPLAYER
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-mpegplayer
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DIRS = .
-
-LDS := ../plugin.lds
-OUTPUT = $(OUTDIR)/mpegplayer.rock
-
-all: $(OUTPUT)
-
-.PHONY: libmad-mpegplayer
-
-$(BUILDDIR)/libmad-mpegplayer.a: libmad-mpegplayer
-
-libmad-mpegplayer:
- $(SILENT)mkdir -p $(OBJDIR)/libmad-mpegplayer
- $(call PRINTS,MAKE in libmad for mpegplayer)$(MAKE) -C $(APPSDIR)/codecs/libmad MPEGPLAYER=1 OBJDIR=$(OBJDIR)/libmad-mpegplayer OUTPUT=$(BUILDDIR)/libmad-mpegplayer.a
-
-ifndef SIMVER
-$(OBJDIR)/mpegplayer.elf: $(OBJS) $(LINKFILE) $(BUILDDIR)/libmad-mpegplayer.a
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lmad-mpegplayer -lgcc\
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/mpegplayer.map
-
-$(OUTPUT): $(OBJDIR)/mpegplayer.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS) $(BUILDDIR)/libmad-mpegplayer.a
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -lmad-mpegplayer -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-endif # end of sdl-simulator
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning mpegplayer)rm -rf $(OBJDIR)/mpegplayer
- $(SILENT)rm -f $(OBJDIR)/mpegplayer.* $(DEPFILE)
-
--include $(DEPFILE)
-
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c
index 3515815..4522657 100644
--- a/apps/plugins/mpegplayer/audio_thread.c
+++ b/apps/plugins/mpegplayer/audio_thread.c
@@ -22,8 +22,8 @@
****************************************************************************/
#include "plugin.h"
#include "mpegplayer.h"
-#include "../../codecs/libmad/bit.h"
-#include "../../codecs/libmad/mad.h"
+#include "codecs/libmad/bit.h"
+#include "codecs/libmad/mad.h"
/** Audio stream and thread **/
struct pts_queue_slot;
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index 14863c9..0c66f3f 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -1,5 +1,5 @@
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
#include "lib/configfile.h"
#include "lib/oldmenuapi.h"
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 5e34c2b..dc2dc0d 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -101,7 +101,7 @@
*****************************************************************************/
#include "plugin.h"
#include "mpegplayer.h"
-#include "helper.h"
+#include "lib/helper.h"
#include "mpeg_settings.h"
#include "mpeg2.h"
#include "video_out.h"
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h
index 4ee30b7..323f8f3 100644
--- a/apps/plugins/mpegplayer/mpegplayer.h
+++ b/apps/plugins/mpegplayer/mpegplayer.h
@@ -85,7 +85,7 @@
#else
-#include "grey.h"
+#include "lib/grey.h"
#define DRAW_BLACK GREY_BLACK
#define DRAW_DARKGRAY GREY_DARKGRAY
#define DRAW_LIGHTGRAY GREY_LIGHTGRAY
diff --git a/apps/plugins/mpegplayer/mpegplayer.make b/apps/plugins/mpegplayer/mpegplayer.make
new file mode 100644
index 0000000..7242be3
--- /dev/null
+++ b/apps/plugins/mpegplayer/mpegplayer.make
@@ -0,0 +1,21 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+MPEGSRCDIR := $(APPSDIR)/plugins/mpegplayer
+MPEGBUILDDIR := $(BUILDDIR)/apps/plugins/mpegplayer
+
+ROCKS += $(MPEGBUILDDIR)/mpegplayer.rock
+
+MPEG_SRC := $(call preprocess, $(MPEGSRCDIR)/SOURCES)
+MPEG_OBJ := $(call c2obj, $(MPEG_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(MPEG_SRC)
+
+$(MPEGBUILDDIR)/mpegplayer.rock: $(MPEG_OBJ) $(CODECDIR)/libmad-mpeg.a
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c
index ae1ff51..424d2fe 100644
--- a/apps/plugins/mpegplayer/stream_mgr.c
+++ b/apps/plugins/mpegplayer/stream_mgr.c
@@ -22,7 +22,7 @@
****************************************************************************/
#include "plugin.h"
#include "mpegplayer.h"
-#include "grey.h"
+#include "lib/grey.h"
#include "mpeg_settings.h"
#ifndef HAVE_LCD_COLOR
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 91f08a5..100904b 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -23,7 +23,7 @@
#include "plugin.h"
#include "mpegplayer.h"
#include "mpeg2dec_config.h"
-#include "grey.h"
+#include "lib/grey.h"
#include "video_out.h"
#include "mpeg_settings.h"
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index 9cb59a8..68b4530 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -22,11 +22,11 @@
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
#ifdef HAVE_LCD_BITMAP
-#include "xlcd.h"
-#include "configfile.h"
+#include "lib/xlcd.h"
+#include "lib/configfile.h"
PLUGIN_HEADER
diff --git a/apps/plugins/pacbox/Makefile b/apps/plugins/pacbox/Makefile
deleted file mode 100644
index e1b998a..0000000
--- a/apps/plugins/pacbox/Makefile
+++ /dev/null
@@ -1,108 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-pacbox
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DIRS = .
-
-LDS := ../plugin.lds
-OUTPUT = $(OUTDIR)/pacbox.rock
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/pacbox.elf: $(OBJS) $(LINKFILE)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/pacbox.map
-
-$(OUTPUT): $(OBJDIR)/pacbox.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
- $(BUILDDIR)/libplugin.a -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning pacbox)rm -rf $(OBJDIR)/pacbox
- $(SILENT)rm -f $(OBJDIR)/pacbox.* $(DEPFILE)
-
--include $(DEPFILE)
-
diff --git a/apps/plugins/pacbox/pacbox.make b/apps/plugins/pacbox/pacbox.make
new file mode 100644
index 0000000..75a599d
--- /dev/null
+++ b/apps/plugins/pacbox/pacbox.make
@@ -0,0 +1,27 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+PACBOXSRCDIR := $(APPSDIR)/plugins/pacbox
+PACBOXBUILDDIR := $(BUILDDIR)/apps/plugins/pacbox
+
+ROCKS += $(PACBOXBUILDDIR)/pacbox.rock
+
+PACBOX_SRC := $(call preprocess, $(PACBOXSRCDIR)/SOURCES)
+PACBOX_OBJ := $(call c2obj, $(PACBOX_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(PACBOX_SRC)
+
+PACBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O2
+
+$(PACBOXBUILDDIR)/pacbox.rock: $(PACBOX_OBJ)
+
+$(PACBOXBUILDDIR)/%.o: $(PACBOXSRCDIR)/%.c $(PLUGINBITMAPLIB) $(PACBOXSRCDIR)/pacbox.make
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PACBOXFLAGS) -c $< -o $@
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index 4dde74a..29e8a74 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -24,10 +24,10 @@
****************************************************************************/
#include "plugin.h"
-#include "pluginlib_actions.h"
-#include "helper.h"
-#include "bmp.h"
-#include "picture.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/helper.h"
+#include "lib/bmp.h"
+#include "lib/picture.h"
#include "pluginbitmaps/pictureflow_logo.h"
#include "pluginbitmaps/pictureflow_emptyslide.h"
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c
index 22d67b6..5d12818 100644
--- a/apps/plugins/plasma.c
+++ b/apps/plugins/plasma.c
@@ -25,14 +25,14 @@
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
#ifdef HAVE_LCD_BITMAP
#ifndef HAVE_LCD_COLOR
-#include "grey.h"
+#include "lib/grey.h"
#endif
-#include "fixedpoint.h"
+#include "lib/fixedpoint.h"
PLUGIN_HEADER
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make
new file mode 100644
index 0000000..2e266cb
--- /dev/null
+++ b/apps/plugins/plugins.make
@@ -0,0 +1,76 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# single-file plugins:
+PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
+OTHER_SRC += $(PLUGINS_SRC)
+ROCKS := $(PLUGINS_SRC:.c=.rock)
+ROCKS := $(subst $(ROOTDIR),$(BUILDDIR),$(ROCKS))
+
+# libplugin.a
+PLUGINLIB := $(BUILDDIR)/apps/plugins/libplugin.a
+PLUGINLIB_SRC = $(call preprocess, $(APPSDIR)/plugins/lib/SOURCES)
+OTHER_SRC += $(PLUGINLIB_SRC)
+
+PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
+PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
+PLUGINLIB_OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(PLUGINLIB_OBJ))
+
+# multifile plugins (subdirs):
+PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
+
+# include <dir>.make from each subdir (yay!)
+$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
+
+### build data / rules
+PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
+PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
+
+OTHER_INC += -I$(APPSDIR)/plugins
+
+# special compile flags for plugins:
+PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
+
+$(ROCKS): $(PLUGINLIB) $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINBITMAPLIB)
+
+$(PLUGINLIB): $(PLUGINLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+$(PLUGINLINK_LDS): $(PLUGIN_LDS)
+ $(call PRINTS,PP $(@F))
+ $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
+
+$(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS
+ $(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
+
+# special dependencies
+$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a
+
+# special pattern rule for compiling plugin lib (with -ffunction-sections)
+$(BUILDDIR)/apps/plugins/lib/%.o: $(ROOTDIR)/apps/plugins/lib/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -ffunction-sections -c $< -o $@
+
+# special pattern rule for compiling plugins with extra flags
+$(BUILDDIR)/apps/plugins/%.o: $(ROOTDIR)/apps/plugins/%.c $(PLUGINBITMAPLIB)
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -c $< -o $@
+
+ifdef SIMVER
+ PLUGINLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
+else
+ PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
+endif
+
+$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o $(PLUGINLINK_LDS)
+ $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(PLUGINLDFLAGS)
+ $(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@
diff --git a/apps/plugins/ppmviewer.c b/apps/plugins/ppmviewer.c
index 01513c4..97f085a 100644
--- a/apps/plugins/ppmviewer.c
+++ b/apps/plugins/ppmviewer.c
@@ -20,7 +20,7 @@
****************************************************************************/
#include "plugin.h"
-#include "bmp.h"
+#include "lib/bmp.h"
#if defined(HAVE_LCD_COLOR)
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c
index 3df3808..9c568df 100644
--- a/apps/plugins/random_folder_advance_config.c
+++ b/apps/plugins/random_folder_advance_config.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "oldmenuapi.h"
+#include "lib/oldmenuapi.h"
PLUGIN_HEADER
diff --git a/apps/plugins/reversi/Makefile b/apps/plugins/reversi/Makefile
deleted file mode 100644
index 97a042e..0000000
--- a/apps/plugins/reversi/Makefile
+++ /dev/null
@@ -1,111 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $$Id: $$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) \
- -I$(BUILDDIR)/pluginbitmaps
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-reversi
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/reversi.rock
-else ## simulators
- OUTPUT = $(OUTDIR)/reversi.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/reversi.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/reversi.map
-
-$(OUTPUT): $(OBJDIR)/reversi.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
- $(BUILDDIR)/libplugin.a $(BITMAPLIBS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning reversi)rm -rf $(OBJDIR)/reversi
- $(SILENT)rm -f $(OBJDIR)/reversi.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/reversi/reversi-gui.c b/apps/plugins/reversi/reversi-gui.c
index d91f24b..1c1cf56 100644
--- a/apps/plugins/reversi/reversi-gui.c
+++ b/apps/plugins/reversi/reversi-gui.c
@@ -47,7 +47,7 @@
#include "reversi-strategy.h"
#include "reversi-gui.h"
-#include "../lib/oldmenuapi.h"
+#include "lib/oldmenuapi.h"
PLUGIN_HEADER
diff --git a/apps/plugins/reversi/reversi.make b/apps/plugins/reversi/reversi.make
new file mode 100644
index 0000000..be73694
--- /dev/null
+++ b/apps/plugins/reversi/reversi.make
@@ -0,0 +1,28 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+REVERSISRCDIR := $(APPSDIR)/plugins/reversi
+REVERSIBUILDDIR := $(BUILDDIR)/apps/plugins/reversi
+
+ROCKS += $(REVERSIBUILDDIR)/reversi.rock
+
+REVERSI_SRC := $(call preprocess, $(REVERSISRCDIR)/SOURCES)
+REVERSI_OBJ := $(call c2obj, $(REVERSI_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(REVERSI_SRC)
+
+$(REVERSIBUILDDIR)/reversi.rock: $(REVERSI_OBJ)
+# for some reason, this doesn't match the implicit rule in plugins.make,
+# so we have to duplicate the link command here
+ $(SILENT)$(CC) $(PLUGINFLAGS) -o $*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(PLUGINLDFLAGS)
+ $(call PRINTS,LD $(@F))$(OC) -O binary $*.elf $@
diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c
index 4b33513..747689d 100644
--- a/apps/plugins/robotfindskitten.c
+++ b/apps/plugins/robotfindskitten.c
@@ -29,7 +29,7 @@
*/
#include "plugin.h"
-#include "pluginlib_actions.h"
+#include "lib/pluginlib_actions.h"
/* This macros must always be included. Should be placed at the top by
convention, although the actual position doesn't matter */
@@ -489,6 +489,14 @@
#define ROBOT 0
#define KITTEN 1
+/* if SYSFONT_WIDTH is 0 (which it is during dependency generation) gcc
+ will abort (div by 0) and this plugin won't get any dependencies
+*/
+#if SYSFONT_WIDTH < 1
+#define SYSFONT_WIDTH 10
+#define SYSFONT_HEIGHT 10
+#endif
+
/*Screen dimensions.*/
#define X_MIN 0
#define X_MAX ((LCD_WIDTH/SYSFONT_WIDTH) - 1)
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 5ff220f..d9b1c0a 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -21,9 +21,9 @@
*
****************************************************************************/
#include "plugin.h"
-#include "highscore.h"
-#include "playergfx.h"
-#include "helper.h"
+#include "lib/highscore.h"
+#include "lib/playergfx.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/rockboy.c b/apps/plugins/rockboy.c
index af38771..f3d25e2 100644
--- a/apps/plugins/rockboy.c
+++ b/apps/plugins/rockboy.c
@@ -24,7 +24,7 @@
#if MEM <= 8 && !defined(SIMULATOR)
-#include "overlay.h"
+#include "lib/overlay.h"
PLUGIN_HEADER
diff --git a/apps/plugins/rockboy/Makefile b/apps/plugins/rockboy/Makefile
deleted file mode 100644
index 4aa8526..0000000
--- a/apps/plugins/rockboy/Makefile
+++ /dev/null
@@ -1,119 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN -finline-functions
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-rockboy
-SRC = cpu.c emu.c events.c fastmem.c hw.c lcd.c lcdc.c loader.c \
- mem.c menu.c rbsound.c rockboy.c rtc.c save.c sound.c sys_rockbox.c \
- ../../../firmware/common/sscanf.c
-
-#CFLAGS += -DDYNAREC
-#SRC += dynarec.c
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
-ifneq (,$(findstring RECORDER,$(TARGET))) ## Archos recorder targets
- LDS := archos.lds
- OUTPUT = $(OUTDIR)/rockboy.ovl
-else ## iRiver target
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/rockboy.rock
-endif
-else ## simulators
- OUTPUT = $(OUTDIR)/rockboy.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/rockboy.elf: $(OBJS) $(LINKFILE)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -fast -lgcc \
- -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/rockboy.map
-
-$(OUTPUT): $(OBJDIR)/rockboy.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the sdl simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
- $(BUILDDIR)/libplugin.a -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) \
- -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning rockboy)rm -rf $(OBJDIR)/rockboy
- $(SILENT)rm -f $(OBJDIR)/rockboy.* $(DEPFILE)
-
--include $(DEPFILE)
-
diff --git a/apps/plugins/rockboy/SOURCES b/apps/plugins/rockboy/SOURCES
new file mode 100644
index 0000000..8806b58
--- /dev/null
+++ b/apps/plugins/rockboy/SOURCES
@@ -0,0 +1,16 @@
+cpu.c
+emu.c
+events.c
+fastmem.c
+hw.c
+lcd.c
+lcdc.c
+loader.c
+mem.c
+menu.c
+rbsound.c
+rockboy.c
+rtc.c
+save.c
+sound.c
+sys_rockbox.c
diff --git a/apps/plugins/rockboy/rockboy.make b/apps/plugins/rockboy/rockboy.make
new file mode 100644
index 0000000..62196cf
--- /dev/null
+++ b/apps/plugins/rockboy/rockboy.make
@@ -0,0 +1,53 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+ROCKBOY_SRCDIR = $(APPSDIR)/plugins/rockboy
+ROCKBOY_OBJDIR = $(BUILDDIR)/apps/plugins/rockboy
+
+ROCKBOY_SRC := $(call preprocess, $(ROCKBOY_SRCDIR)/SOURCES)
+ROCKBOY_OBJ := $(call c2obj, $(ROCKBOY_SRC))
+ROCKBOY_OBJ += $(ROCKBOY_OBJDIR)/sscanf.o
+
+OTHER_SRC += $(ROCKBOY_SRC)
+
+ifndef SIMVER
+ifneq (,$(findstring RECORDER,$(TARGET)))
+ ## archos recorder targets
+ ROCKBOY_INLDS := $(ROCKBOY_SRCDIR)/archos.lds
+ ROCKS += $(ROCKBOY_OBJDIR)/rockboy.ovl
+else
+ ### all other targets
+ ROCKBOY_INLDS := $(APPSDIR)/plugins/plugin.lds
+ ROCKS += $(ROCKBOY_OBJDIR)/rockboy.rock
+endif
+ ROCKBOY_OVLFLAGS = -T$(ROCKBOY_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(ROCKBOY_OBJDIR)/$*.map
+ ROCKBOY_OUTLDS = $(ROCKBOY_OBJDIR)/rockboy.lds
+else
+ ### simulator
+ ROCKS += $(ROCKBOY_OBJDIR)/rockboy.rock
+ ROCKBOY_OVLFLAGS = $(SHARED_FLAG) # <-- from Makefile
+endif
+
+$(ROCKBOY_OBJDIR)/sscanf.c: $(FIRMDIR)/common/sscanf.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CP $<)cp $< $@
+
+$(ROCKBOY_OBJDIR)/sscanf.o: $(ROCKBOY_OBJDIR)/sscanf.c
+
+$(ROCKBOY_OUTLDS): $(ROCKBOY_INLDS) $(ROCKBOY_OBJ)
+ $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
+
+$(ROCKBOY_OBJDIR)/rockboy.rock: $(ROCKBOY_OBJ) $(ROCKBOY_OUTLDS) $(PLUGINBITMAPLIB)
+
+$(ROCKBOY_OBJDIR)/rockboy.ovl: $(ROCKBOY_OBJ) $(ROCKBOY_OUTLDS) $(PLUGINBITMAPLIB)
+ $(SILENT)$(CC) $(PLUGINFLAGS) -o $(ROCKBOY_OBJDIR)/$*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(ROCKBOY_OVLFLAGS)
+ $(call PRINTS,LD $(@F))$(OC) -O binary $(ROCKBOY_OBJDIR)/$*.elf $@
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c
index 5587525..e22cb33 100644
--- a/apps/plugins/rocklife.c
+++ b/apps/plugins/rocklife.c
@@ -61,8 +61,8 @@
*/
#include "plugin.h"
-#include "pluginlib_actions.h"
-#include "helper.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index 32c746c..c9a0c6a 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -29,7 +29,6 @@
*/
#include "plugin.h"
-#include "errno.h"
#include "lib/bmp.h"
#include "lib/rgb_hsv.h"
diff --git a/apps/plugins/searchengine/Makefile b/apps/plugins/searchengine/Makefile
deleted file mode 100644
index 7e3cca4..0000000
--- a/apps/plugins/searchengine/Makefile
+++ /dev/null
@@ -1,105 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
-CFLAGS = $(INCLUDES) $(GCCOPTS) -O3 $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-searchengine
-SRC = searchengine.c parser.c token.c dbinterface.c
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-LDS := ../plugin.lds
-OUTPUT = $(OUTDIR)/searchengine.rock
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/searchengine.elf: $(OBJS) $(LINKFILE)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/searchengine.map
-
-$(OUTPUT): $(OBJDIR)/searchengine.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), x11)
-###################################################
-# This is the X11 simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of x11-simulator
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-else # end of sdl-simulator
-###################################################
-# This is the win32 simulator version
-DLLTOOLFLAGS = --export-all
-DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS)
- $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \
- $(BUILDDIR)/libplugin.a -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-endif # end of win32-simulator
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning searchengine)rm -rf $(OBJDIR)/searchengine
- $(SILENT)rm -f $(OBJDIR)/searchengine.* $(DEPFILE)
-
--include $(DEPFILE)
-
diff --git a/apps/plugins/shortcuts/Makefile b/apps/plugins/shortcuts/Makefile
deleted file mode 100644
index 2958af8..0000000
--- a/apps/plugins/shortcuts/Makefile
+++ /dev/null
@@ -1,90 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $$Id: $$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) \
- -I$(BUILDDIR)/pluginbitmaps
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-shortcuts
-
-SOURCES := shortcuts_common.c shortcuts_view.c shortcuts_append.c
-VIEW_OBJS := $(OBJDIR)/shortcuts_common.o $(OBJDIR)/shortcuts_view.o
-APPEND_OBJS := $(OBJDIR)/shortcuts_common.o $(OBJDIR)/shortcuts_append.o
-DIRS = .
-
-ifndef SIMVER
- LDS := ../plugin.lds
-endif
-
-OUTPUT = $(OUTDIR)/shortcuts_view.rock $(OUTDIR)/shortcuts_append.rock
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/shortcuts_view.elf: $(VIEW_OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(VIEW_OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -Wl,--gc-sections -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/shortcuts_view.map
-
-$(OUTDIR)/shortcuts_view.rock: $(OBJDIR)/shortcuts_view.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-
-$(OBJDIR)/shortcuts_append.elf: $(APPEND_OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(APPEND_OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -Wl,--gc-sections -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/shortcuts_append.map
-
-$(OUTDIR)/shortcuts_append.rock: $(OBJDIR)/shortcuts_append.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-###################################################
-# This is the SDL simulator version
-
-$(OUTDIR)/shortcuts_view.rock: $(VIEW_OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(VIEW_OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-$(OUTDIR)/shortcuts_append.rock: $(APPEND_OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(APPEND_OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning shortcuts)rm -rf $(OBJDIR)/shortcuts
- $(SILENT)rm -f $(OBJDIR)/shortcuts* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/shortcuts/shortcuts.make b/apps/plugins/shortcuts/shortcuts.make
new file mode 100644
index 0000000..fc2a77a
--- /dev/null
+++ b/apps/plugins/shortcuts/shortcuts.make
@@ -0,0 +1,25 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+SHCUTSRCDIR := $(APPSDIR)/plugins/shortcuts
+SHCUTBUILDDIR := $(BUILDDIR)/apps/plugins/shortcuts
+
+ROCKS += $(SHCUTBUILDDIR)/shortcuts_view.rock
+ROCKS += $(SHCUTBUILDDIR)/shortcuts_append.rock
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(SHCUTSRCDIR)/shortcuts_common.c \
+ $(SHCUTSRCDIR)/shortcuts_view.c \
+ $(SHCUTSRCDIR)/shortcuts_append.c
+
+$(SHCUTBUILDDIR)/shortcuts_view.rock: \
+ $(SHCUTBUILDDIR)/shortcuts_common.o $(SHCUTBUILDDIR)/shortcuts_view.o
+
+$(SHCUTBUILDDIR)/shortcuts_append.rock: \
+ $(SHCUTBUILDDIR)/shortcuts_common.o $(SHCUTBUILDDIR)/shortcuts_append.o
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index ef33a4f..0d12556 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "bmp.h"
+#include "lib/bmp.h"
#ifdef HAVE_LCD_BITMAP
PLUGIN_HEADER
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index 056ab78..28315cc 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -19,7 +19,7 @@
*
**************************************************************************/
#include "plugin.h"
-#include "playergfx.h"
+#include "lib/playergfx.h"
PLUGIN_HEADER
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 9b9cd29..0a032f6 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -34,6 +34,14 @@
#include "pluginbitmaps/sokoban_tiles.h"
#define SOKOBAN_TILESIZE BMPWIDTH_sokoban_tiles
+
+/* If tilesize is 0 (which it is during dependency generation) gcc will abort
+ (div by 0) and this plugin won't get any dependencies
+*/
+#if SOKOBAN_TILESIZE < 1
+#define SOKOBAN_TILESIZE 10
+#endif
+
/* SOKOBAN_TILESIZE is the number of pixels for each block.
* Set dynamically so all targets can support levels
* that fill their entire screen, less the stat box.
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index d487334..f95777e 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -20,11 +20,11 @@
****************************************************************************/
#include "plugin.h"
-#include "playback_control.h"
-#include "configfile.h"
+#include "lib/playback_control.h"
+#include "lib/configfile.h"
#include "button.h"
#include "lcd.h"
-#include "oldmenuapi.h"
+#include "lib/oldmenuapi.h"
#ifdef HAVE_LCD_BITMAP
diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c
index 21cfb1e..b8cf043 100644
--- a/apps/plugins/spacerocks.c
+++ b/apps/plugins/spacerocks.c
@@ -20,9 +20,7 @@
****************************************************************************/
#include "plugin.h"
-#include "math.h"
-#include "stdio.h"
-#include "helper.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c
index f8f24b9..5362136 100644
--- a/apps/plugins/starfield.c
+++ b/apps/plugins/starfield.c
@@ -18,7 +18,7 @@
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
diff --git a/apps/plugins/sudoku/Makefile b/apps/plugins/sudoku/Makefile
deleted file mode 100644
index 948b315..0000000
--- a/apps/plugins/sudoku/Makefile
+++ /dev/null
@@ -1,75 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) \
- -I$(BUILDDIR)/pluginbitmaps
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-sudoku
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
-DIRS = .
-
-ifndef SIMVER
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/sudoku.rock
-else ## simulators
- OUTPUT = $(OUTDIR)/sudoku.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/sudoku.elf: $(OBJS) $(LINKFILE) $(BITMAPLIBS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- $(LINKBITMAPS) -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/sudoku.map
-
-$(OUTPUT): $(OBJDIR)/sudoku.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin $(LINKBITMAPS) -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning sudoku)rm -rf $(OBJDIR)/sudoku
- $(SILENT)rm -f $(OBJDIR)/sudoku.* $(DEPFILE)
-
--include $(DEPFILE)
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c
index 150edab..4430778 100644
--- a/apps/plugins/sudoku/sudoku.c
+++ b/apps/plugins/sudoku/sudoku.c
@@ -69,9 +69,9 @@
#include "generator.h"
/* The bitmaps */
-#include "sudoku_normal.h"
-#include "sudoku_inverse.h"
-#include "sudoku_start.h"
+#include "pluginbitmaps/sudoku_normal.h"
+#include "pluginbitmaps/sudoku_inverse.h"
+#include "pluginbitmaps/sudoku_start.h"
#define BITMAP_HEIGHT (BMPHEIGHT_sudoku_normal/10)
#define BITMAP_STRIDE BMPWIDTH_sudoku_normal
diff --git a/apps/plugins/sudoku/sudoku.make b/apps/plugins/sudoku/sudoku.make
new file mode 100644
index 0000000..e1f397c
--- /dev/null
+++ b/apps/plugins/sudoku/sudoku.make
@@ -0,0 +1,21 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+SUDOKUSRCDIR := $(APPSDIR)/plugins/sudoku
+SUDOKUBUILDDIR := $(BUILDDIR)/apps/plugins/sudoku
+
+ROCKS += $(SUDOKUBUILDDIR)/sudoku.rock
+
+SUDOKU_SRC := $(call preprocess, $(SUDOKUSRCDIR)/SOURCES)
+SUDOKU_OBJ := $(call c2obj, $(SUDOKU_SRC))
+
+# add source files to OTHER_SRC to get automatic dependencies
+OTHER_SRC += $(SUDOKU_SRC)
+
+$(SUDOKUBUILDDIR)/sudoku.rock: $(SUDOKU_OBJ)
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index 2e421e1..085435e 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -20,8 +20,8 @@
****************************************************************************/
#include "plugin.h"
-#include "oldmenuapi.h"
-#include "helper.h"
+#include "lib/oldmenuapi.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index 7148cfc..6d34773 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -19,8 +19,8 @@
*
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
-#include "grey.h"
+#include "lib/helper.h"
+#include "lib/grey.h"
#ifdef HAVE_LCD_BITMAP
diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c
index 108360b..b0ef787 100644
--- a/apps/plugins/test_resize.c
+++ b/apps/plugins/test_resize.c
@@ -25,8 +25,8 @@
*/
#include "plugin.h"
-#include "pluginlib_actions.h"
-#include "bmp.h"
+#include "lib/pluginlib_actions.h"
+#include "lib/bmp.h"
PLUGIN_HEADER
diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c
index 7073494..01f24b5 100644
--- a/apps/plugins/test_sampr.c
+++ b/apps/plugins/test_sampr.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "oldmenuapi.h"
+#include "lib/oldmenuapi.h"
PLUGIN_HEADER
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 6910c6c..c9d973f 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "playback_control.h"
+#include "lib/playback_control.h"
#if PLUGIN_BUFFER_SIZE > 0x45000
#define MAX_CHARS 0x40000 /* 128 kiB */
diff --git a/apps/plugins/video.c b/apps/plugins/video.c
index 69c6f4e..a31b7c5 100644
--- a/apps/plugins/video.c
+++ b/apps/plugins/video.c
@@ -29,7 +29,7 @@
#include "plugin.h"
#include "sh7034.h"
#include "system.h"
-#include "helper.h"
+#include "lib/helper.h"
#ifndef SIMULATOR /* not for simulator by now */
#ifdef HAVE_LCD_BITMAP /* and definitely not for the Player, haha */
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index 51fb791..e85a979 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -21,8 +21,8 @@
****************************************************************************/
#include "plugin.h"
#include <ctype.h>
-#include "playback_control.h"
-#include "oldmenuapi.h"
+#include "lib/playback_control.h"
+#include "lib/oldmenuapi.h"
PLUGIN_HEADER
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index 405f6df..f07eb09 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -18,7 +18,7 @@
*
**************************************************************************/
#include "plugin.h"
-#include "fixedpoint.h"
+#include "lib/fixedpoint.h"
#if defined(HAVE_LCD_BITMAP)
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c
index d4b8bf1..c26e2c4 100644
--- a/apps/plugins/wavrecord.c
+++ b/apps/plugins/wavrecord.c
@@ -19,7 +19,7 @@
*
****************************************************************************/
#include "plugin.h"
-#include "configfile.h"
+#include "lib/configfile.h"
PLUGIN_HEADER
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c
index 6586e78..5411d0c 100644
--- a/apps/plugins/wormlet.c
+++ b/apps/plugins/wormlet.c
@@ -19,8 +19,8 @@
*
****************************************************************************/
#include "plugin.h"
-#include "configfile.h"
-#include "helper.h"
+#include "lib/configfile.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index 59e080d..d345c44 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -21,7 +21,7 @@
****************************************************************************/
#include "plugin.h"
-#include "helper.h"
+#include "lib/helper.h"
PLUGIN_HEADER
diff --git a/apps/plugins/zxbox.c b/apps/plugins/zxbox.c
index 10e43c4..3c1c78f 100644
--- a/apps/plugins/zxbox.c
+++ b/apps/plugins/zxbox.c
@@ -21,7 +21,7 @@
#if MEM <= 8 && !defined(SIMULATOR)
-#include "overlay.h"
+#include "lib/overlay.h"
PLUGIN_HEADER
diff --git a/apps/plugins/zxbox/Makefile b/apps/plugins/zxbox/Makefile
deleted file mode 100644
index d7862c5..0000000
--- a/apps/plugins/zxbox/Makefile
+++ /dev/null
@@ -1,84 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-#
-OPT_FLAGS=-O3 -funroll-loops
-
-INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) -I. $(TARGET_INC)
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(EXTRA_DEFINES) \
- -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN $(OPT_FLAGS) $(PROFILE_OPTS)
-
-ifdef APPEXTRA
- INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
-endif
-
-LINKFILE := $(OBJDIR)/link.lds
-DEPFILE = $(OBJDIR)/dep-zxbox
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DIRS = .
-
-ifndef SIMVER
-ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
- LDS := archos.lds
- OUTPUT = $(OUTDIR)/zxbox.ovl
-else ## iRiver/iPod/... targets
- LDS := ../plugin.lds
- OUTPUT = $(OUTDIR)/zxbox.rock
-endif
-else ## simulators
- OUTPUT = $(OUTDIR)/zxbox.rock
-endif
-
-all: $(OUTPUT)
-
-ifndef SIMVER
-$(OBJDIR)/zxbox.elf: $(OBJS) $(LINKFILE)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \
- -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/zxbox.map
-
-$(OUTPUT): $(OBJDIR)/zxbox.elf
- $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
-else
-
-ifeq ($(SIMVER), sdl)
-###################################################
-# This is the SDL simulator version
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
-ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
-# 'x' must be kept or you'll have "Win32 error 5"
-# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
-# #define ERROR_ACCESS_DENIED 5L
-else
- @chmod -x $@
-endif
-
-endif
-endif # end of simulator section
-
-
-include $(TOOLSDIR)/make.inc
-
-# MEMORYSIZE should be passed on to this makefile with the chosen memory size
-# given in number of MB
-$(LINKFILE): $(LDS)
- $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \
- $(DEFINES) -E -P - >$@
-
-clean:
- $(call PRINTS,cleaning zxbox)rm -rf $(OBJDIR)/zxbox
- $(SILENT)rm -f $(OBJDIR)/zxbox.* $(DEPFILE)
-
--include $(DEPFILE)
-
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c
index 6c58656..bc5df48 100644
--- a/apps/plugins/zxbox/spmain.c
+++ b/apps/plugins/zxbox/spmain.c
@@ -43,7 +43,7 @@
#include <stdlib.h>
#include <errno.h>
#ifdef USE_GREY
-#include "../lib/grey.h"
+#include "lib/grey.h"
#endif
#include "zxbox_keyb.h"
diff --git a/apps/plugins/zxbox/zxbox.make b/apps/plugins/zxbox/zxbox.make
new file mode 100644
index 0000000..e617ba3
--- /dev/null
+++ b/apps/plugins/zxbox/zxbox.make
@@ -0,0 +1,57 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+ZXBOX_SRCDIR = $(APPSDIR)/plugins/zxbox
+ZXBOX_OBJDIR = $(BUILDDIR)/apps/plugins/zxbox
+
+ZXBOX_SRC := $(call preprocess, $(ZXBOX_SRCDIR)/SOURCES)
+ZXBOX_OBJ := $(call c2obj, $(ZXBOX_SRC))
+
+OTHER_SRC += $(ZXBOX_SRC)
+
+ifndef SIMVER
+ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET)))))
+ ## archos recorder targets
+ ZXBOX_INLDS := $(ZXBOX_SRCDIR)/archos.lds
+ ROCKS += $(ZXBOX_OBJDIR)/zxbox.ovl
+else
+ ### all other targets
+ ZXBOX_INLDS := $(APPSDIR)/plugins/plugin.lds
+ ROCKS += $(ZXBOX_OBJDIR)/zxbox.rock
+endif
+else
+ ### simulator
+ ROCKS += $(ZXBOX_OBJDIR)/zxbox.rock
+endif
+
+ZXBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O3 -funroll-loops
+
+ifdef SIMVER
+ ZXBOX_LDFLAGS = $(SHARED_FLAG) # <-- from Makefile
+else
+ ZXBOX_OUTLDS = $(ZXBOX_OBJDIR)/zxbox.lds
+ ZXBOX_LDFLAGS = -T$(ZXBOX_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/$*.map
+endif
+
+$(ZXBOX_OUTLDS): $(ZXBOX_INLDS) $(ZXBOX_OBJ)
+ $(call PRINTS,PP $(<F))$(call preprocess2file,$<,$@)
+
+$(ZXBOX_OBJDIR)/zxbox.rock: $(ZXBOX_OBJ) $(ZXBOX_OUTLDS) $(PLUGINBITMAPLIB)
+
+$(ZXBOX_OBJDIR)/zxbox.ovl: $(ZXBOX_OBJ) $(ZXBOX_OUTLDS) $(PLUGINBITMAPLIB) $(PLUGINLIB)
+ $(SILENT)$(CC) $(PLUGINFLAGS) -o $(ZXBOX_OBJDIR)/$*.elf \
+ $(filter %.o, $^) \
+ $(filter %.a, $^) \
+ -lgcc $(ZXBOX_LDFLAGS)
+ $(call PRINTS,LD $(@F))$(OC) -O binary $(ZXBOX_OBJDIR)/$*.elf $@
+
+# special pattern rule for compiling zxbox with extra flags
+$(ZXBOX_OBJDIR)/%.o: $(ZXBOX_SRCDIR)/%.c $(PLUGINBITMAPLIB) $(ZXBOX_SRCDIR)/zxbox.make
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(ZXBOXFLAGS) -c $< -o $@
diff --git a/apps/plugins/zxbox/zxvid_com.h b/apps/plugins/zxbox/zxvid_com.h
index 2ef67c6..1e23ca0 100644
--- a/apps/plugins/zxbox/zxvid_com.h
+++ b/apps/plugins/zxbox/zxvid_com.h
@@ -3,7 +3,7 @@
#include "zxconfig.h"
#ifdef USE_GREY
-#include "../lib/grey.h"
+#include "lib/grey.h"
#endif
#include "spscr_p.h"
diff --git a/bootloader/bootloader.make b/bootloader/bootloader.make
new file mode 100644
index 0000000..736425e
--- /dev/null
+++ b/bootloader/bootloader.make
@@ -0,0 +1,37 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+INCLUDES += -I$(APPSDIR)
+SRC += $(call preprocess, $(APPSDIR)/SOURCES)
+
+BOOTLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds
+BOOTLINK := $(BUILDDIR)/boot.link
+
+CLEANOBJS += $(BUILDDIR)/bootloader.*
+
+.SECONDEXPANSION:
+
+$(BOOTLINK): $(BOOTLDS)
+ $(call PRINTS,PP $(@F))
+ $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
+
+$(BUILDDIR)/bootloader.elf: $$(OBJ) $$(FIRMLIB) $$(BOOTLINK)
+ $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
+ $(FIRMLIB) -lgcc -L$(BUILDDIR)/firmware -T$(BOOTLINK) \
+ -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map
+
+$(BUILDDIR)/bootloader.bin : $(BUILDDIR)/bootloader.elf
+ $(call PRINTS,OBJCOPY $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
+
+$(BUILDDIR)/bootloader.asm: $(BUILDDIR)/bootloader.bin
+ $(TOOLSDIR)/sh2d -sh1 $< > $@
+
+$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/bootloader.bin
+ $(call PRINTS,Build bootloader file)$(MKFIRMWARE) $< $@
+
diff --git a/bootloader/show_logo.c b/bootloader/show_logo.c
index 0dc2b5b..c0627aa4 100644
--- a/bootloader/show_logo.c
+++ b/bootloader/show_logo.c
@@ -24,7 +24,7 @@
#include <stdio.h>
#include <string.h>
-#include "rockboxlogo.h"
+#include "bitmaps/rockboxlogo.h"
#if LCD_WIDTH <= 128
#define BOOT_VERSION ("Boot " APPSVERSION)
diff --git a/firmware/Makefile b/firmware/Makefile
deleted file mode 100644
index 0b80cf2..0000000
--- a/firmware/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-# __________ __ ___.
-# Open \______ \ ____ ____ | | _\_ |__ _______ ___
-# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-# \/ \/ \/ \/ \/
-# $Id$
-#
-
-INCLUDES=$(TARGET_INC) -Iinclude -I$(FIRMDIR) -Iexport -Icommon -Idrivers -I$(BUILDDIR)
-
-CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET) $(BUILDDATE) $(EXTRA_DEFINES) \
- -DMEM=${MEMORYSIZE}
-
-# Limits for the built-in sysfont: ASCII for bootloaders, ISO8859-1 for normal builds
-ifneq (,$(findstring -DBOOTLOADER,$(EXTRA_DEFINES)))
- MAXCHAR = 127
-else
- MAXCHAR = 255
-endif
-
-# This sets up 'SRC' based on the files mentioned in SOURCES
-include $(TOOLSDIR)/makesrc.inc
-
-SOURCES = $(SRC)
-OBJS2 := $(patsubst %.c, $(OBJDIR)/%.o, $(SRC)) $(OBJDIR)/sysfont.o
-OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
-DIRS:=. drivers common
-OUTPUT = $(BUILDDIR)/librockbox.a
-DEPFILE = $(OBJDIR)/dep-firmware
-
-all: $(OUTPUT) $(EXTRA_TARGETS)
-
-dep: $(DEPFILE)
-
-$(OUTPUT): $(BUILDDIR)/sysfont.h $(OBJS) $(DEPFILE)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $(OBJS) >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
-
-include $(TOOLSDIR)/make.inc
-
-clean:
- $(call PRINTS,cleaning firmware)rm -f $(OBJS) $(OUTPUT) $(OBJDIR)/sysfont.c $(DEPFILE)
- $(SILENT)rm -rf $(OBJDIR)/drivers $(OBJDIR)/common
-
-# Special targets
-$(OBJDIR)/thread.o: thread.c export/thread.h
- $(call PRINTS,CC thread.c)$(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< -o $@
-
-$(BUILDDIR)/sysfont.h: ../fonts/08-Schumacher-Clean.bdf
- $(call PRINTS,Create sysfont.h)$(TOOLSDIR)/convbdf -l $(MAXCHAR) -h -o $@ $<
-
-$(OBJDIR)/sysfont.o: ../fonts/08-Schumacher-Clean.bdf
- $(call PRINTS,CONVBDF)$(TOOLSDIR)/convbdf -l $(MAXCHAR) -c -o $(OBJDIR)/sysfont.c $<
- $(call PRINTS,CC sysfont.c)$(CC) $(CFLAGS) -c $(OBJDIR)/sysfont.c -o $@
-
--include $(DEPFILE)
diff --git a/firmware/decompressor/Makefile b/firmware/decompressor/Makefile
index 33b6aff..30bb04e 100644
--- a/firmware/decompressor/Makefile
+++ b/firmware/decompressor/Makefile
@@ -27,6 +27,7 @@
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/compressed.map
$(LINKFILE): $(LDS)
+ $(SILENT)mkdir -p $(dir $@)
$(call PRINTS,Build LDS file)cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
$(OBJDIR)/decompressor.o : decompressor.c $(OBJDIR)/uclimage.c
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h
index 572d018..5f89a96 100644
--- a/firmware/export/config-mrobe500.h
+++ b/firmware/export/config-mrobe500.h
@@ -147,8 +147,7 @@
/* Define this if you have a Motorola SCF5249 */
#define CONFIG_CPU DM320
-/* Define this if you want to use coldfire's i2c interface */
-//#define CONFIG_I2C I2C_S3C2440
+#define CONFIG_I2C I2C_DM320
/* define this if the hardware can be powered off while charging */
#define HAVE_POWEROFF_WHILE_CHARGING
diff --git a/firmware/export/debug.h b/firmware/export/debug.h
index dd65c3d..f9f93fd 100644
--- a/firmware/export/debug.h
+++ b/firmware/export/debug.h
@@ -28,6 +28,7 @@
extern void ldebugf(const char* file, int line, const char *fmt, ...)
ATTRIBUTE_PRINTF(3, 4);
+#ifndef CODEC
#ifdef __GNUC__
/* */
@@ -57,5 +58,5 @@
#endif /* GCC */
-
+#endif /* CODEC */
#endif
diff --git a/firmware/firmware.make b/firmware/firmware.make
new file mode 100644
index 0000000..992df26
--- /dev/null
+++ b/firmware/firmware.make
@@ -0,0 +1,39 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+INCLUDES += -I$(FIRMDIR) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers
+
+FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES)
+FIRMLIB_SRC += $(ROOTDIR)/sysfont.o
+FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC))
+OTHER_SRC += $(FIRMLIB_SRC)
+
+FIRMLIB = $(BUILDDIR)/firmware/libfirmware.a
+
+SYSFONT = $(ROOTDIR)/fonts/08-Schumacher-Clean.bdf
+
+CLEANOBJS += $(BUILDDIR)/sysfont.*
+
+# Limits for the built-in sysfont: ASCII for bootloaders, ISO8859-1 for normal builds
+ifneq (,$(findstring -DBOOTLOADER,$(EXTRA_DEFINES)))
+ MAXCHAR = 127
+else
+ MAXCHAR = 255
+endif
+
+$(FIRMLIB): $(FIRMLIB_OBJ)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+$(BUILDDIR)/sysfont.h: $(SYSFONT) $(TOOLS)
+ $(call PRINTS,CONVBDF $(subst $(ROOTDIR)/,,$<))$(TOOLSDIR)/convbdf -l $(MAXCHAR) -h -o $@ $<
+
+$(BUILDDIR)/sysfont.o: $(SYSFONT) $(BUILDDIR)/sysfont.h
+ $(call PRINTS,CONVBDF $(subst $(ROOTDIR)/,,$<))$(TOOLSDIR)/convbdf -l $(MAXCHAR) -c -o $(BUILDDIR)/sysfont.c $<
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$(BUILDDIR)/sysfont.c))$(CC) $(CFLAGS) -c $(BUILDDIR)/sysfont.c -o $@
+
diff --git a/flash/bootbox/bootbox.make b/flash/bootbox/bootbox.make
new file mode 100644
index 0000000..d3e6a1c
--- /dev/null
+++ b/flash/bootbox/bootbox.make
@@ -0,0 +1,13 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+SRC += $(call preprocess,$(APPSDIR)/SOURCES)
+
+# don't build rombox.ucl
+ARCHOSROM=
diff --git a/tools/Makefile b/tools/Makefile
index 0bd0209..569a727 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -15,8 +15,8 @@
generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat database \
lngdump telechips gigabeats creative hmac-sha1 mktccboot mknkboot rbspeexenc mkzenboot
-all:
- @echo "Run make in your build directory!"
+all: scramble descramble sh2d rdf2binary mkboot mktccboot mknkboot mkzenboot \
+ convbdf codepages uclpack rbspeexenc voicefont
scramble: scramble.o iriver.o mi4.o gigabeat.o gigabeats.o telechips.o iaudio_bl_flash.o creative.o hmac-sha1.o
descramble: descramble.o iriver.o gigabeat.o
diff --git a/tools/configure b/tools/configure
index 433dc66..0f6c3bb 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1325,8 +1325,6 @@
boottool="$rootdir/tools/scramble -tcc=crc"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
output="rockbox.d2"
appextra="recorder:gui"
plugins="yes"
@@ -1414,8 +1412,6 @@
tool="cp "
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
output="rockbox.mrobe500"
appextra="recorder:gui"
plugins="yes"
@@ -1438,8 +1434,6 @@
tool="$rootdir/tools/scramble -mi4v2 -model=m100 -type=RBOS"
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
output="rockbox.mi4"
appextra="recorder:gui"
plugins="yes"
@@ -1487,8 +1481,6 @@
arm926ejscc
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
tool="$rootdir/tools/scramble -creative=zvm"
USE_ELF="yes"
output="rockbox.zvm"
@@ -1512,8 +1504,6 @@
arm926ejscc
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
tool="$rootdir/tools/scramble -creative=zvm60 -no-ciff"
USE_ELF="yes"
output="rockbox.zvm60"
@@ -1537,8 +1527,6 @@
arm926ejscc
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
- bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
- bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
tool="$rootdir/tools/scramble -creative=zenvision -no-ciff"
USE_ELF="yes"
output="rockbox.zv"
@@ -2074,6 +2062,8 @@
debug="-DDEBUG"
simulator="yes"
extradefines="-DSIMULATOR"
+ archosrom=""
+ flash=""
echo "Simulator build selected"
;;
[Aa])
@@ -2397,18 +2387,6 @@
<<EOF
## Automatically generated. http://www.rockbox.org/
-ifndef V
-SILENT=@
-else
-VERBOSEOPT=-v
-endif
-
-# old 'make' versions don't have the built-in 'info' function
-info=old\$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
-ifeq (\$(call info),old)
-export info=echo "\$\$(1)";
-endif
-
export ROOTDIR=@ROOTDIR@
export FIRMDIR=@FIRMDIR@
export APPSDIR=@APPSDIR@
@@ -2428,8 +2406,8 @@
export LANGUAGE=@LANGUAGE@
export VOICELANGUAGE=@VOICELANGUAGE@
export MEMORYSIZE=@MEMORY@
-export VERSION=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
-export BUILDDATE=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
+export VERSION:=\$(shell \$(ROOTDIR)/tools/svnversion.sh \$(ROOTDIR))
+export BUILDDATE:=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
export MKFIRMWARE=@TOOL@
export BMP2RB_MONO=@BMP2RB_MONO@
export BMP2RB_NATIVE=@BMP2RB_NATIVE@
@@ -2469,159 +2447,8 @@
export ENCODER=@ENCODER@
export USE_ELF=@USE_ELF@
-# Do not print "Entering directory ..."
-MAKEFLAGS += --no-print-directory
-
-.PHONY: all clean tags zip tools manual bin build info langs
-
-all: info
-
-info: build
- \$(SILENT)\$(TOOLSDIR)/mkinfo.pl \$(BUILDDIR)/rockbox-info.txt
-
-build: tools @LANGS@
- @SIMUL1@
- @SIMUL2@
- \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
- \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@
-
-bin: tools @LANGS@
- @SIMUL1@
- @SIMUL2@
- \$(SILENT)\$(MAKE) -C \$(FIRMDIR) OBJDIR=\$(BUILDDIR)/firmware
- \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ \$(BUILDDIR)/\$(BINARY)
-
-rocks: tools
- \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ rocks
-
-veryclean: clean toolsclean
-
-toolsclean:
- \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) clean
-
-clean:
- \$(SILENT)echo Cleaning build directory
- \$(SILENT)rm -rf rockbox.zip rockbox.7z rockbox.tar rockbox.tar.gz \
- rockbox.tar.bz2 TAGS @APPS@ firmware comsim sim lang.[ch] \
- manual *.pdf *.a credits.raw @OUTPUT@ bitmaps pluginbitmaps \
- @ARCHOSROM@ @FLASHFILE@ UI256.bmp rockbox-full.zip \
- html txt rockbox-manual*.zip sysfont.h rockbox-info.txt \
- voicefontids *.wav *.mp3 *.voice max_language_size.h
-
-tools:
- \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) AR=\$(HOSTAR) @TOOLSET@
-
-voicetools:
- \$(SILENT)\$(MAKE) -C \$(TOOLSDIR) CC=\$(HOSTCC) AR=\$(HOSTAR) @VOICETOOLSET@
-
-tags:
- \$(SILENT)rm -f TAGS
- \$(SILENT)\$(MAKE) -C \$(FIRMDIR) tags
- \$(SILENT)\$(MAKE) -C \$(APPSDIR) tags
- \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins tags
- \$(SILENT)\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
-
-fontzip:
- \$(SILENT)\$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\" -r "\$(ROOTDIR)" -f 1 -o rockbox-fonts.zip \$(TARGET) \$(BINARY)
-
-zip: info
- \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
- \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
-
-mapzip: info
- \$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
-
-fullzip: info
- \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
- \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -r "\$(ROOTDIR)" -f 2 -o rockbox-full.zip \$(TARGET) \$(BINARY)
-
-7zip: info
- \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
- \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.7z" -z "7za a -mx=9" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
-
-tar: info
- \$(SILENT)rm -f rockbox.tar
- \$(SILENT)for f in \`cat \$(BUILDDIR)/@APPS@/features\`; do feat="\$\$feat:\$\$f" ; done; \\
- \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -o "rockbox.tar" -z "tar -cf" -r "\$(ROOTDIR)" \$(TARGET) \$(BINARY)
-
-bzip2: tar
- \$(SILENT)bzip2 -f9 rockbox.tar
-
-gzip: tar
- \$(SILENT)gzip -f9 rockbox.tar
-
-langs: features
- \$(SILENT)mkdir -p \$(BUILDDIR)/apps/lang
- \$(SILENT)\$(MAKE) -C \$(APPSDIR)/lang OBJDIR=\$(BUILDDIR)/apps/lang
-
-manual: manual-pdf
-manual-pdf:
- \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-pdf
-manual-html:
- \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-html
-manual-zhtml: manual-zip
-manual-txt:
- \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt
-manual-ztxt:
- \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-txt-zip
-manual-zip:
- \$(SILENT)\$(MAKE) -C \$(MANUALDIR) OBJDIR=\$(BUILDDIR)/manual manual-zip
-
-features: tools
- \$(SILENT)\$(MAKE) -C \$(APPSDIR) OBJDIR=\$(BUILDDIR)/@APPS@ features
-
-help:
- @echo "A few helpful make targets"
- @echo ""
- @echo "all - builds a full Rockbox (default), including tools"
- @echo "bin - builds only the Rockbox.<target name> file"
- @echo "rocks - builds only plugins and codecs"
- @echo "clean - cleans a build directory (not tools)"
- @echo "veryclean - cleans the build and tools directories"
- @echo "manual - builds a manual"
- @echo "manual-html - HTML manual"
- @echo "manual-zip - HTML manual (zipped)"
- @echo "manual-txt - txt manual"
- @echo "fullzip - creates a rockbox.zip of your build with fonts"
- @echo "zip - creates a rockbox.zip of your build (no fonts)"
- @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
- @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
- @echo "7zip - creates a rockbox.7z of your build (no fonts)"
- @echo "fontzip - creates rockbox-fonts.zip"
- @echo "mapzip - creates rockbox-maps.zip with all .map files"
- @echo "tools - builds the tools only"
- @echo "voicetools - builds the voice tools only"
- @echo "install - installs your build (for simulator builds only, no fonts)"
- @echo "fullinstall - installs your build (for simulator builds only, with fonts)"
+include \$(TOOLSDIR)/root.make
EOF
-if [ "yes" = "$simulator" ]; then
-
- cat >> Makefile <<EOF
-
-install:
- @echo "installing your build in your archos dir"
- \$(SILENT)for f in \`cat \$(BUILDDIR)/apps/features\`; do feat="\$\$feat:\$\$f" ; done; \\
- \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -s -r "\$(ROOTDIR)" -f 0 \$(TARGET) \$(BINARY)
-
-fullinstall:
- @echo "installing a full setup in your archos dir"
- \$(SILENT)for f in \`cat \$(BUILDDIR)/apps/features\`; do feat="\$\$feat:\$\$f" ; done; \\
- \$(TOOLSDIR)/buildzip.pl \$(VERBOSEOPT) -t \"\$(MODELNAME)\$\$feat\" -i \"\$(TARGET_ID)\" -s -r "\$(ROOTDIR)" -f 2 \$(TARGET) \$(BINARY)
-EOF
-
-fi
-
-if [ "yes" = "$voice" ]; then
-
- cat >> Makefile <<EOF
-
-voice: voicetools features
- \$(SILENT)for f in \`cat \$(BUILDDIR)/${apps}/features\`; do feat="\$\$feat:\$\$f" ; done ; \\
- for lang in \`echo \$(VOICELANGUAGE) |sed "s/,/ /g"\`; do \$(TOOLSDIR)/voice.pl -V -l=\$\$lang -t=\$(MODELNAME)\$\$feat -i=\$(TARGET_ID) -e="\$(ENCODER)" -E="\$(ENC_OPTS)" -s=\$(TTS_ENGINE) -S="\$(TTS_OPTS)"; done \\
-EOF
-
-fi
-
echo "Created Makefile"
diff --git a/tools/functions.make b/tools/functions.make
new file mode 100644
index 0000000..bab8a8d
--- /dev/null
+++ b/tools/functions.make
@@ -0,0 +1,68 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+# preprocess - run preprocessor on a file and return the result as a string
+#
+# This uses the native 'gcc' compiler and not $(CC) since we use the -imacros
+# option and older gcc compiler doesn't have that. We use one such older
+# compiler for the win32 cross-compiles on Linux.
+#
+# The weird grep -v thing in here is due to Apple's stupidities and is needed
+# to make this do right when used on Mac OS X.
+#
+# The sed line is to prepend the directory to all source files
+
+preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) | \
+ grep -v '^\#' | \
+ sed -e 's:^.\+:$(dir $(1))&:')
+
+preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \
+ grep -v '^\#' | grep -v "^$$" > $(2))
+
+c2obj = $(subst .c,.o,$(subst .S,.o,$(subst $(ROOTDIR),$(BUILDDIR),$(1))))
+
+# calculate dependencies for a list of source files $(2) and output them
+# to a file $(1)
+
+mkdepfile = $(shell \
+ for each in $(2); do \
+ obj=`echo $$each | sed -e 's/\.[cS]/.o/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
+ $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -MT "$$obj" $$each 2>/dev/null; \
+ done | sed -e "s: lang.h: $(BUILDDIR)/lang.o:" \
+ -e "s: sysfont.h: $(BUILDDIR)/sysfont.h:" \
+ -e "s: max_language_size.h: $(BUILDDIR)/max_language_size.h:" \
+ -e "s: bitmaps/: $(BUILDDIR)/bitmaps/:g" \
+ -e "s: pluginbitmaps/: $(BUILDDIR)/pluginbitmaps/:g" \
+ -e "s: lib/: $(APPSDIR)/plugins/lib/:g" \
+ -e "s: codeclib.h: $(APPSDIR)/codecs/lib/codeclib.h:g" \
+ > $(1); )
+
+# function to create .bmp dependencies
+bmpdepfile = $(shell \
+ for each in $(2); do \
+ obj=`echo $$each | sed -e 's/\.bmp/.o/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
+ src=`echo $$each | sed -e 's/\.bmp/.c/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \
+ echo $$obj: $$src; \
+ echo $$src: $$each; \
+ done \
+ >> $(1); )
+
+ifndef V
+SILENT:=@
+else
+VERBOSEOPT:=-v
+endif
+PRINTS=$(SILENT)$(call info,$(1))
+
+# old 'make' versions don't have the built-in 'info' function
+info=old$(shell echo >&2 "Consider upgrading to GNU make 3.81+ for optimum build performance.")
+ifeq ($(call info),old)
+export info=echo "$$(1)";
+endif
+
diff --git a/tools/makebmp.inc b/tools/makebmp.inc
deleted file mode 100644
index 987a214..0000000
--- a/tools/makebmp.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-all: $(OUTPUT)
-
-dep: $(DEPFILE)
-
-ifndef V
-SILENT=@
-endif
-PRINTS=$(SILENT)$(call info,$(1))
-
-$(OBJDIR)/%.c: %.bmp
- $(SILENT)mkdir -p $(dir $@)
- $(SILENT)mkdir -p $(BMPINCDIR)
- $(call PRINTS,BMP2RB $<)$(BMP2RB) -h $(BMPINCDIR) $< > $@
-
-$(OBJDIR)/%.o: $(OBJDIR)/%.c
- $(SILENT)mkdir -p $(dir $@)
- $(call PRINTS,CC $(<F))$(CC) $(CFLAGS) -c $< -o $@
-
-$(DEPFILE): SOURCES
- $(SILENT)mkdir -p $(dir $(DEPFILE))
- $(SILENT)rm -f $(DEPFILE)
- $(SILENT)(for each in $(SOURCES) x; do \
- if test "x" != "$$each"; then \
- src=`echo $$each | sed -e 's/\.bmp/.c/'`; \
- echo $(OBJDIR)/$$src: $$each >> $(DEPFILE) ; \
- obj=`echo $$each | sed -e 's/\.bmp/.o/'`; \
- echo $(OBJDIR)/$$obj: $(OBJDIR)/$$src >> $(DEPFILE) ; \
- fi; \
- done)
-
-$(OUTPUT): $(OBJS)
- $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
- $(SILENT)$(RANLIB) $@
diff --git a/tools/makesubdirs.inc b/tools/makesubdirs.inc
deleted file mode 100644
index b233430..0000000
--- a/tools/makesubdirs.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- Makefile -*-
-
-# return the list of extra sub-directories to build in the SUBDIRS variable
-
-# This uses the native 'gcc' compiler and not $(CC) since we use the -include
-# option and older gcc compiler doesn't have that. We use one such older
-# compiler for the win32 cross-compiles on Linux.
-#
-# The weird grep -v thing in here is due to Apple's stupidities and is needed
-# to make this do right when used on Mac OS X.
-
-SUBDIRS := $(shell cat SUBDIRS | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
-$(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - | \
-grep -v "^\#")
diff --git a/tools/root.make b/tools/root.make
new file mode 100644
index 0000000..87937d9
--- /dev/null
+++ b/tools/root.make
@@ -0,0 +1,294 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+include $(TOOLSDIR)/functions.make
+
+DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) -DMEM=$(MEMORYSIZE) $(TARGET) \
+ -DTARGET_ID=$(TARGET_ID) -DTARGET_NAME=\"$(MODELNAME)\" \
+ -DAPPSVERSION=\"$(VERSION)\" $(BUILDDATE) \
+ $(EXTRA_DEFINES) # <-- -DSIMULATOR or not
+INCLUDES = -I$(BUILDDIR) $(TARGET_INC)
+
+CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
+PPCFLAGS = $(filter-out -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix
+
+TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
+ $(TOOLSDIR)/codepages $(TOOLSDIR)/scramble $(TOOLSDIR)/bmp2rb \
+ $(TOOLSDIR)/uclpack $(TOOLSDIR)/mktccboot $(TOOLSDIR)/mkboot
+
+# list suffixes to be understood by $*
+.SUFFIXES: .rock .codec .map .elf .c .S .o .bmp .a
+
+.PHONY: all clean tags zip tools manual bin build info langs
+
+DEPFILE = $(BUILDDIR)/make.dep
+
+all: $(DEPFILE) build
+
+# Subdir makefiles. their primary purpose is to populate SRC & OTHER_SRC
+# but they also define special dependencies and compile rules
+include $(TOOLSDIR)/tools.make
+include $(FIRMDIR)/firmware.make
+include $(ROOTDIR)/apps/bitmaps/bitmaps.make
+
+ifneq (,$(findstring bootloader,$(APPSDIR)))
+ include $(APPSDIR)/bootloader.make
+else ifneq (,$(findstring bootbox,$(APPSDIR)))
+ include $(APPSDIR)/bootbox.make
+else
+ include $(APPSDIR)/apps.make
+ include $(APPSDIR)/lang/lang.make
+
+ ifdef SOFTWARECODECS
+ include $(APPSDIR)/codecs/codecs.make
+ endif
+
+ ifdef ENABLEDPLUGINS
+ include $(APPSDIR)/plugins/bitmaps/pluginbitmaps.make
+ include $(APPSDIR)/plugins/plugins.make
+ endif
+
+ ifdef SIMVER
+ include $(ROOTDIR)/uisimulator/uisimulator.make
+ endif
+endif # bootloader
+
+OBJ := $(SRC:.c=.o)
+OBJ := $(OBJ:.S=.o)
+OBJ += $(BMP:.bmp=.o)
+OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(OBJ))
+
+build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM)
+ $(SILENT)$(TOOLSDIR)/mkinfo.pl $(BUILDDIR)/rockbox-info.txt
+
+ifneq (clean,$(findstring clean,$(MAKECMDGOALS))) # don't build deps before cleaning
+$(DEPFILE) dep:
+ $(call PRINTS,Generating dependencies)
+ @echo foo > /dev/null # there must be a "real" command in the rule
+ $(call mkdepfile,$(DEPFILE),$(SRC) $(OTHER_SRC))
+ $(call bmpdepfile,$(DEPFILE),$(BMP) $(PBMP))
+endif
+
+bin: $(DEPFILE) $(TOOLS) $(BUILDDIR)/$(BINARY)
+rocks: $(DEPFILE) $(TOOLS) $(ROCKS)
+codecs: $(DEPFILE) $(TOOLS) $(CODECS)
+
+-include $(DEPFILE)
+
+veryclean: clean
+ $(SILENT)rm -rf $(TOOLS)
+
+clean:
+ $(SILENT)echo Cleaning build directory
+ $(SILENT)rm -rf rockbox.zip rockbox.7z rockbox.tar rockbox.tar.gz rockbox.tar.bz2 TAGS apps firmware comsim sim lang.[ch] manual *.pdf *.a credits.raw rockbox.ipod bitmaps pluginbitmaps UI256.bmp rockbox-full.zip html txt rockbox-manual*.zip sysfont.h rockbox-info.txt voicefontids *.wav *.mp3 *.voice max_language_size.h $(CLEANOBJS) $(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin $(DEPFILE) rombox.elf rombox.map rombox.bin $(BINARY) $(FLASHFILE) uisimulator bootloader flash
+
+#### linking the binaries: ####
+
+.SECONDEXPANSION:
+
+ifndef SIMVER
+
+ifeq (,$(findstring bootloader,$(APPSDIR)))
+# not bootloader
+
+## target build
+RAMLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/app.lds
+LINKRAM := $(BUILDDIR)/ram.link
+ROMLDS := $(FIRMDIR)/rom.lds
+LINKROM := $(BUILDDIR)/rom.link
+
+$(LINKRAM): $(RAMLDS)
+ $(call PRINTS,PP $(@F))
+ $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
+
+$(LINKROM): $(ROMLDS)
+ $(call PRINTS,PP $(@F))
+ $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
+
+$(BUILDDIR)/rockbox.elf : $$(OBJ) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(LINKRAM)
+ $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Wl,--gc-sections -Os -nostdlib -o $@ $(OBJ) \
+ -L$(BUILDDIR)/firmware -lfirmware\
+ -L$(BUILDDIR)/apps/codecs $(VOICESPEEXLIB:lib%.a=-l%) \
+ -lgcc \
+ -T$(LINKRAM) -Wl,-Map,$(BUILDDIR)/rockbox.map
+
+$(BUILDDIR)/rombox.elf : $$(OBJ) $$(FIRMLIB) $$(VOICESPEEXLIB) $$(LINKROM)
+ $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \
+ $(VOICESPEEXLIB) $(FIRMLIB) -lgcc -L$(BUILDDIR)/firmware \
+ -T$(LINKROM) -Wl,-Map,$(BUILDDIR)/rockbox.map
+
+$(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
+ $(call PRINTS,OC $(@F))$(OC) $(if $(filter yes, $(USE_ELF)), -S -x, -O binary) $< $@
+
+$(BUILDDIR)/rombox.bin : $(BUILDDIR)/rombox.elf
+ $(call PRINTS,OC $(@F))$(OC) -O binary $< $@
+
+#
+# If there's a flashfile defined for this target (rockbox.ucl for Archos
+# models) Then check if the mkfirmware script fails, as then it is (likely)
+# because the image is too big and we need to create a compressed image
+# instead.
+#
+$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/rockbox.bin $(FLASHFILE)
+ $(call PRINTS,SCRAMBLE $(notdir $@))($(MKFIRMWARE) $< $@; \
+ stat=$$?; \
+ if test -n "$(FLASHFILE)"; then \
+ if test "$$stat" -ne 0; then \
+ echo "Image too big, making a compressed version!"; \
+ $(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \
+ $(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \
+ fi \
+ fi )
+
+# archos
+$(BUILDDIR)/rockbox.ucl: $(BUILDDIR)/rockbox.bin
+ $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --best --2e -b1048576 $< $@ >/dev/null 2>&1
+
+MAXINFILE = $(BUILDDIR)/temp.txt
+MAXOUTFILE = $(BUILDDIR)/romstart.txt
+
+$(BUILDDIR)/rombox.ucl: $(BUILDDIR)/rombox.bin $(MAXOUTFILE)
+ $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --none $< $@ >/dev/null; \
+ perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
+ if test $$? -ne 0; then \
+ echo "removing UCL file again, making it a fake one"; \
+ echo "fake" > $@; \
+ fi
+
+$(MAXOUTFILE):
+ $(call PRINTS,Creating $(@F))
+ $(SILENT)$(shell echo '#include "config.h"' > $(MAXINFILE))
+ $(SILENT)$(shell echo "ROM_START" >> $(MAXINFILE))
+ $(call preprocess2file,$(MAXINFILE),$(MAXOUTFILE))
+ $(SILENT)rm $(MAXINFILE)
+
+# iriver
+$(BUILDDIR)/rombox.iriver: $(BUILDDIR)/rombox.bin
+ $(call PRINTS,Build ROM file)$(MKFIRMWARE) $< $@
+
+endif # !bootloader
+endif # !SIMVER
+
+
+voicetools:
+ $(SILENT)$(MAKE) -C $(TOOLSDIR) CC=$(HOSTCC) AR=$(HOSTAR) rbspeexenc voicefont wavtrim
+
+tags:
+ $(SILENT)rm -f TAGS
+ $(SILENT)etags -o $(BUILDDIR)/TAGS $(filter-out %.o,$(SRC) $(OTHER_SRC))
+
+fontzip:
+ $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)\" -r "$(ROOTDIR)" -f 1 -o rockbox-fonts.zip $(TARGET) $(BINARY)
+
+zip:
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
+
+mapzip:
+ $(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
+
+fullzip:
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" -f 2 -o rockbox-full.zip $(TARGET) $(BINARY)
+
+7zip:
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.7z" -z "7za a -mx=9" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
+
+tar:
+ $(SILENT)rm -f rockbox.tar
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.tar" -z "tar -cf" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
+
+bzip2: tar
+ $(SILENT)bzip2 -f9 rockbox.tar
+
+gzip: tar
+ $(SILENT)gzip -f9 rockbox.tar
+
+manual manual-pdf:
+ $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-pdf
+manual-html:
+ $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-html
+manual-zhtml: manual-zip
+manual-txt:
+ $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt
+manual-ztxt:
+ $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-txt-zip
+manual-zip:
+ $(SILENT)$(MAKE) -C $(MANUALDIR) OBJDIR=$(BUILDDIR)/manual manual-zip
+
+ifdef TTS_ENGINE
+
+voice: voicetools features
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \
+ for lang in `echo $(VOICELANGUAGE) |sed "s/,/ /g"`; do $(TOOLSDIR)/voice.pl -V -l=$$lang -t=$(MODELNAME)$$feat -i=$(TARGET_ID) -e="$(ENCODER)" -E="$(ENC_OPTS)" -s=$(TTS_ENGINE) -S="$(TTS_OPTS)"; done \
+
+endif
+
+ifdef SIMVER
+
+install:
+ @echo "Installing your build in your archos dir"
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" -f 0 $(TARGET) $(BINARY)
+
+fullinstall:
+ @echo "Installing a full setup in your archos dir"
+ $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" -f 2 $(TARGET) $(BINARY)
+
+endif
+
+help:
+ @echo "A few helpful make targets"
+ @echo ""
+ @echo "all - builds a full Rockbox (default), including tools"
+ @echo "bin - builds only the Rockbox.<target name> file"
+ @echo "rocks - builds only plugins"
+ @echo "codecs - builds only codecs"
+ @echo "dep - regenerates make dependency database"
+ @echo "clean - cleans a build directory (not tools)"
+ @echo "veryclean - cleans the build and tools directories"
+ @echo "manual - builds a manual (pdf)"
+ @echo "manual-html - HTML manual"
+ @echo "manual-zip - HTML manual (zipped)"
+ @echo "manual-txt - txt manual"
+ @echo "fullzip - creates a rockbox.zip of your build with fonts"
+ @echo "zip - creates a rockbox.zip of your build (no fonts)"
+ @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
+ @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
+ @echo "7zip - creates a rockbox.7z of your build (no fonts)"
+ @echo "fontzip - creates rockbox-fonts.zip"
+ @echo "mapzip - creates rockbox-maps.zip with all .map files"
+ @echo "tools - builds the tools only"
+ @echo "voice - creates the voice clips (voice builds only)"
+ @echo "voicetools - builds the voice tools only"
+ @echo "install - installs your build (for simulator builds only, no fonts)"
+ @echo "fullinstall - installs your build (for simulator builds only, with fonts)"
+
+### general compile rules:
+
+# when source and object are in different locations (normal):
+$(BUILDDIR)/%.o: $(ROOTDIR)/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
+
+$(BUILDDIR)/%.o: $(ROOTDIR)/%.S
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
+
+# when source and object are both in BUILDDIR (generated code):
+%.o: %.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
+
+%.o: %.S
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
diff --git a/tools/tools.make b/tools/tools.make
new file mode 100644
index 0000000..48717c1
--- /dev/null
+++ b/tools/tools.make
@@ -0,0 +1,40 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+TOOLSCFLAGS := -O -g -W -Wall -Wshadow -pedantic -I$(ROOTDIR)/tools
+
+$(TOOLSDIR)/scramble: $(TOOLSDIR)/scramble.c $(TOOLSDIR)/iriver.c \
+ $(TOOLSDIR)/mi4.c $(TOOLSDIR)/gigabeat.c \
+ $(TOOLSDIR)/gigabeats.c $(TOOLSDIR)/telechips.c \
+ $(TOOLSDIR)/iaudio_bl_flash.c \
+ $(TOOLSDIR)/creative.c $(TOOLSDIR)/hmac-sha1.c
+$(TOOLSDIR)/rdf2binary: $(TOOLSDIR)/rdf2binary.c
+$(TOOLSDIR)/convbdf: $(TOOLSDIR)/convbdf.c
+$(TOOLSDIR)/codepages: $(TOOLSDIR)/codepages.c $(TOOLSDIR)/codepage_tables.c
+$(TOOLSDIR)/mkboot: $(TOOLSDIR)/mkboot.c
+$(TOOLSDIR)/mktccboot: $(TOOLSDIR)/mktccboot.c $(TOOLSDIR)/telechips.c
+$(TOOLSDIR)/wavtrim: $(TOOLSDIR)/wavtrim.c
+$(TOOLSDIR)/voicefont: $(TOOLSDIR)/voicefont.c
+
+$(TOOLSDIR)/iaudio_bl_flash.c $(TOOLSDIR)/iaudio_bl_flash.h: $(TOOLSDIR)/iaudio_bl_flash.bmp $(TOOLSDIR)/bmp2rb
+ $(call PRINTS,BMP2RB $(@F))
+ $(SILENT)$(TOOLSDIR)/bmp2rb -f 7 -h $(TOOLSDIR) $< >$(TOOLSDIR)/iaudio_bl_flash.c
+
+$(TOOLSDIR)/bmp2rb: $(TOOLSDIR)/bmp2rb.c
+ $(call PRINTS,CC $(@F))
+ $(SILENT)$(HOSTCC) -DAPPLICATION_NAME=\"$@\" $(TOOLSCFLAGS) $+ -o $@
+
+$(TOOLSDIR)/uclpack: $(TOOLSDIR)/ucl/uclpack.c $(wildcard $(TOOLSDIR)/ucl/src/*.c)
+ $(call PRINTS,CC $(@F))$(HOSTCC) $(TOOLSCFLAGS) -I$(TOOLSDIR)/ucl \
+ -I$(TOOLSDIR)/ucl/include -o $@ $^
+
+# implicit rule for simple tools
+$(TOOLSDIR)/%: $(TOOLSDIR)/%.c
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$@))
+ $(SILENT)$(HOSTCC) $(TOOLSCFLAGS) -o $@ $^
diff --git a/uisimulator/sdl/uisdl.h b/uisimulator/sdl/uisdl.h
index 5b0f944..0a97df5 100644
--- a/uisimulator/sdl/uisdl.h
+++ b/uisimulator/sdl/uisdl.h
@@ -23,7 +23,7 @@
#define __UISDL_H__
#include <stdbool.h>
-#include "SDL.h"
+#include <SDL.h>
/* colour definitions are R, G, B */
diff --git a/uisimulator/uisimulator.make b/uisimulator/uisimulator.make
new file mode 100644
index 0000000..a5707bd
--- /dev/null
+++ b/uisimulator/uisimulator.make
@@ -0,0 +1,38 @@
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
+#
+
+INCLUDES += -I$(ROOTDIR)/uisimulator/sdl -I$(ROOTDIR)/uisimulator/common \
+
+SIMINCLUDES += -I$(ROOTDIR)/uisimulator/sdl -I$(ROOTDIR)/uisimulator/common \
+ -I$(FIRMDIR)/export $(TARGET_INC) -I$(BUILDDIR) -I$(APPSDIR)
+
+SIMFLAGS += $(SIMINCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS)
+
+SIMSRC += $(call preprocess, $(ROOTDIR)/uisimulator/sdl/SOURCES)
+SIMSRC += $(call preprocess, $(ROOTDIR)/uisimulator/common/SOURCES)
+SIMOBJ = $(call c2obj,$(SIMSRC))
+OTHER_SRC += $(SIMSRC)
+
+SIMLIB = $(BUILDDIR)/uisimulator/libuisimulator.a
+UIBMP = $(BUILDDIR)/UI256.bmp
+
+.SECONDEXPANSION: # $$(OBJ) is not populated until after this
+
+$(SIMLIB): $$(SIMOBJ) $(UIBMP)
+ $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
+
+$(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB)
+ $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(LDOPTS)
+
+$(BUILDDIR)/uisimulator/%.o: $(ROOTDIR)/uisimulator/%.c
+ $(SILENT)mkdir -p $(dir $@)
+ $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(SIMFLAGS) -c $< -o $@
+
+$(UIBMP): $(ROOTDIR)/uisimulator/sdl/UI-$(MODELNAME).bmp
+ $(call PRINTS,CP $(@F))cp $< $@