summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2008-11-20 11:27:31 +0000
committerBjörn Stenberg <bjorn@haxx.se>2008-11-20 11:27:31 +0000
commitc6b3d38a156dd624760a8eb1bb374affd43b4f2a (patch)
tree493eba929e2396d86cf4f077709aa09fe172cd35 /apps
parentf66c30346783a400a029bedcd60ab67c81c34a07 (diff)
downloadrockbox-c6b3d38a156dd624760a8eb1bb374affd43b4f2a.tar.gz
rockbox-c6b3d38a156dd624760a8eb1bb374affd43b4f2a.tar.bz2
rockbox-c6b3d38a156dd624760a8eb1bb374affd43b4f2a.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/Makefile268
-rw-r--r--apps/apps.make25
-rw-r--r--apps/bitmaps/bitmaps.make51
-rw-r--r--apps/bitmaps/mono/Makefile32
-rw-r--r--apps/bitmaps/native/Makefile32
-rw-r--r--apps/bitmaps/remote_mono/Makefile32
-rw-r--r--apps/bitmaps/remote_native/Makefile32
-rw-r--r--apps/codecs/Makefile256
-rw-r--r--apps/codecs/ape.c1
-rw-r--r--apps/codecs/codec.h49
-rw-r--r--apps/codecs/codecs.make103
-rw-r--r--apps/codecs/demac/libdemac.make24
-rw-r--r--apps/codecs/demac/libdemac/demac_config.h2
-rw-r--r--apps/codecs/lib/Makefile50
-rw-r--r--apps/codecs/lib/codeclib.c4
-rw-r--r--apps/codecs/lib/codeclib.h13
-rw-r--r--apps/codecs/lib/libcodec.make23
-rw-r--r--apps/codecs/liba52/Makefile43
-rw-r--r--apps/codecs/liba52/config-a52.h2
-rw-r--r--apps/codecs/liba52/liba52.make17
-rw-r--r--apps/codecs/libalac/Makefile43
-rw-r--r--apps/codecs/libalac/alac.c2
-rw-r--r--apps/codecs/libalac/libalac.make24
-rw-r--r--apps/codecs/libasap/Makefile44
-rw-r--r--apps/codecs/libasap/libasap.make24
-rw-r--r--apps/codecs/libfaad/Makefile43
-rw-r--r--apps/codecs/libfaad/common.h3
-rw-r--r--apps/codecs/libfaad/libfaad.make18
-rw-r--r--apps/codecs/libffmpegFLAC/Makefile43
-rw-r--r--apps/codecs/libffmpegFLAC/decoder.c2
-rw-r--r--apps/codecs/libffmpegFLAC/libffmpegFLAC.make17
-rw-r--r--apps/codecs/libffmpegFLAC/tables.c2
-rw-r--r--apps/codecs/libm4a/Makefile43
-rw-r--r--apps/codecs/libm4a/demux.c5
-rw-r--r--apps/codecs/libm4a/libm4a.make24
-rw-r--r--apps/codecs/libm4a/m4a.c7
-rw-r--r--apps/codecs/libmad/Makefile50
-rw-r--r--apps/codecs/libmad/frame.c2
-rw-r--r--apps/codecs/libmad/global.h2
-rw-r--r--apps/codecs/libmad/libmad.make54
-rw-r--r--apps/codecs/libmusepack/Makefile49
-rw-r--r--apps/codecs/libmusepack/huffsv46.c6
-rw-r--r--apps/codecs/libmusepack/huffsv7.c6
-rw-r--r--apps/codecs/libmusepack/libmusepack.make29
-rw-r--r--apps/codecs/libmusepack/musepack.h4
-rw-r--r--apps/codecs/libspc/Makefile44
-rw-r--r--apps/codecs/libspc/libspc.make24
-rw-r--r--apps/codecs/libspc/spc_codec.h2
-rw-r--r--apps/codecs/libspc/spc_cpu.c3
-rw-r--r--apps/codecs/libspc/spc_dsp.c3
-rw-r--r--apps/codecs/libspc/spc_emu.c3
-rw-r--r--apps/codecs/libspc/spc_profiler.c2
-rw-r--r--apps/codecs/libspeex/Makefile57
-rw-r--r--apps/codecs/libspeex/bits.c2
-rw-r--r--apps/codecs/libspeex/cb_search.c6
-rw-r--r--apps/codecs/libspeex/cb_search.h2
-rw-r--r--apps/codecs/libspeex/config-speex.h2
-rw-r--r--apps/codecs/libspeex/filters.c5
-rw-r--r--apps/codecs/libspeex/jitter.c6
-rw-r--r--apps/codecs/libspeex/libspeex.make60
-rw-r--r--apps/codecs/libspeex/lsp.c1
-rw-r--r--apps/codecs/libspeex/ltp.c13
-rw-r--r--apps/codecs/libspeex/ltp.h2
-rw-r--r--apps/codecs/libspeex/ltp_arm4.h1
-rw-r--r--apps/codecs/libspeex/modes.h4
-rw-r--r--apps/codecs/libspeex/nb_celp.c4
-rw-r--r--apps/codecs/libspeex/nb_celp.h4
-rw-r--r--apps/codecs/libspeex/quant_lsp.h2
-rw-r--r--apps/codecs/libspeex/rockbox.h13
-rw-r--r--apps/codecs/libspeex/sb_celp.h2
-rw-r--r--apps/codecs/libspeex/speex/ogg.h2
-rw-r--r--apps/codecs/libspeex/speex_callbacks.c13
-rw-r--r--apps/codecs/libspeex/speex_header.c4
-rw-r--r--apps/codecs/libspeex/stereo.c5
-rw-r--r--apps/codecs/libtremor/Makefile49
-rw-r--r--apps/codecs/libtremor/config-tremor.h2
-rw-r--r--apps/codecs/libtremor/ctype.c2
-rw-r--r--apps/codecs/libtremor/libtremor.make36
-rw-r--r--apps/codecs/libtremor/mapping0.c2
-rw-r--r--apps/codecs/libtremor/oggmalloc.c5
-rw-r--r--apps/codecs/libwavpack/Makefile43
-rw-r--r--apps/codecs/libwavpack/libwavpack.make17
-rw-r--r--apps/codecs/libwavpack/wavpack.h6
-rw-r--r--apps/codecs/libwma/Makefile43
-rw-r--r--apps/codecs/libwma/libwma.make17
-rw-r--r--apps/codecs/wma.c2
-rw-r--r--apps/debug_menu.c2
-rw-r--r--apps/lang/Makefile40
-rw-r--r--apps/lang/lang.make34
-rw-r--r--apps/plugins/Makefile180
-rw-r--r--apps/plugins/beatbox/Makefile74
-rw-r--r--apps/plugins/bitmaps/mono/Makefile32
-rw-r--r--apps/plugins/bitmaps/native/Makefile32
-rw-r--r--apps/plugins/bitmaps/native/SOURCES48
-rw-r--r--apps/plugins/bitmaps/native/star_tiles.10x10x2.bmp (renamed from apps/plugins/bitmaps/native/star_tiles.10x10.grey.bmp)bin1678 -> 1678 bytes
-rw-r--r--apps/plugins/bitmaps/native/star_tiles.6x7x1.bmp (renamed from apps/plugins/bitmaps/native/star_tiles.6x7.mono.bmp)bin184 -> 184 bytes
-rw-r--r--apps/plugins/bitmaps/native/star_tiles.8x8x2.bmp (renamed from apps/plugins/bitmaps/native/star_tiles.8x8.grey.bmp)bin390 -> 390 bytes
-rw-r--r--apps/plugins/bitmaps/pluginbitmaps.make59
-rw-r--r--apps/plugins/bitmaps/remote_mono/Makefile32
-rw-r--r--apps/plugins/bitmaps/remote_native/Makefile32
-rw-r--r--apps/plugins/bitmaps/remote_native/SOURCES4
-rw-r--r--apps/plugins/bounce.c2
-rw-r--r--apps/plugins/brickmania.c4
-rw-r--r--apps/plugins/bubbles.c6
-rw-r--r--apps/plugins/chessbox.c2
-rw-r--r--apps/plugins/chessbox/Makefile114
-rw-r--r--apps/plugins/chessbox/SOURCES4
-rw-r--r--apps/plugins/chessbox/chessbox.c2
-rw-r--r--apps/plugins/chessbox/chessbox.make58
-rw-r--r--apps/plugins/chopper.c6
-rw-r--r--apps/plugins/clock/Makefile112
-rw-r--r--apps/plugins/clock/clock.c4
-rw-r--r--apps/plugins/clock/clock.make21
-rw-r--r--apps/plugins/clock/clock_bitmap_strings.h2
-rw-r--r--apps/plugins/clock/clock_bitmaps.c28
-rw-r--r--apps/plugins/clock/clock_bitmaps.h2
-rw-r--r--apps/plugins/clock/clock_counter.h2
-rw-r--r--apps/plugins/clock/clock_draw_analog.c4
-rw-r--r--apps/plugins/clock/clock_draw_binary.c2
-rw-r--r--apps/plugins/clock/clock_draw_digital.c2
-rw-r--r--apps/plugins/clock/clock_settings.c2
-rw-r--r--apps/plugins/credits.c2
-rw-r--r--apps/plugins/cube.c8
-rw-r--r--apps/plugins/demystify.c4
-rw-r--r--apps/plugins/dice.c4
-rw-r--r--apps/plugins/doom/Makefile173
-rw-r--r--apps/plugins/doom/SOURCES62
-rw-r--r--apps/plugins/doom/doom.make54
-rw-r--r--apps/plugins/doom/i_video.c2
-rw-r--r--apps/plugins/euroconverter.c2
-rw-r--r--apps/plugins/fire.c8
-rw-r--r--apps/plugins/fireworks.c4
-rw-r--r--apps/plugins/greyscale.c4
-rw-r--r--apps/plugins/invadrox.c4
-rw-r--r--apps/plugins/jackpot.c4
-rw-r--r--apps/plugins/jewels.c2
-rw-r--r--apps/plugins/jpeg/Makefile75
-rw-r--r--apps/plugins/jpeg/jpeg.make21
-rw-r--r--apps/plugins/keybox.c2
-rw-r--r--apps/plugins/lamp.c2
-rw-r--r--apps/plugins/lib/Makefile50
-rw-r--r--apps/plugins/logo.c2
-rw-r--r--apps/plugins/mandelbrot.c4
-rw-r--r--apps/plugins/maze.c4
-rw-r--r--apps/plugins/mazezam.c8
-rw-r--r--apps/plugins/metronome.c2
-rw-r--r--apps/plugins/midi/Makefile77
-rw-r--r--apps/plugins/midi/midi.make28
-rw-r--r--apps/plugins/mosaique.c2
-rw-r--r--apps/plugins/mpegplayer/Makefile78
-rw-r--r--apps/plugins/mpegplayer/audio_thread.c4
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.h2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.make21
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.c2
-rw-r--r--apps/plugins/mpegplayer/video_thread.c2
-rw-r--r--apps/plugins/oscilloscope.c6
-rw-r--r--apps/plugins/pacbox/Makefile108
-rw-r--r--apps/plugins/pacbox/pacbox.make27
-rw-r--r--apps/plugins/pictureflow.c8
-rw-r--r--apps/plugins/plasma.c6
-rw-r--r--apps/plugins/plugins.make76
-rw-r--r--apps/plugins/ppmviewer.c2
-rw-r--r--apps/plugins/random_folder_advance_config.c2
-rw-r--r--apps/plugins/reversi/Makefile111
-rw-r--r--apps/plugins/reversi/reversi-gui.c2
-rw-r--r--apps/plugins/reversi/reversi.make28
-rw-r--r--apps/plugins/robotfindskitten.c10
-rw-r--r--apps/plugins/rockblox.c6
-rw-r--r--apps/plugins/rockboy.c2
-rw-r--r--apps/plugins/rockboy/Makefile119
-rw-r--r--apps/plugins/rockboy/SOURCES16
-rw-r--r--apps/plugins/rockboy/rockboy.make53
-rw-r--r--apps/plugins/rocklife.c4
-rw-r--r--apps/plugins/rockpaint.c1
-rw-r--r--apps/plugins/searchengine/Makefile105
-rw-r--r--apps/plugins/shortcuts/Makefile90
-rw-r--r--apps/plugins/shortcuts/shortcuts.make25
-rw-r--r--apps/plugins/sliding_puzzle.c2
-rw-r--r--apps/plugins/snow.c2
-rw-r--r--apps/plugins/sokoban.c8
-rw-r--r--apps/plugins/solitaire.c6
-rw-r--r--apps/plugins/spacerocks.c4
-rw-r--r--apps/plugins/starfield.c2
-rw-r--r--apps/plugins/sudoku/Makefile75
-rw-r--r--apps/plugins/sudoku/sudoku.c6
-rw-r--r--apps/plugins/sudoku/sudoku.make21
-rw-r--r--apps/plugins/test_disk.c4
-rw-r--r--apps/plugins/test_fps.c4
-rw-r--r--apps/plugins/test_resize.c4
-rw-r--r--apps/plugins/test_sampr.c2
-rw-r--r--apps/plugins/text_editor.c2
-rw-r--r--apps/plugins/video.c2
-rw-r--r--apps/plugins/viewer.c4
-rw-r--r--apps/plugins/vu_meter.c2
-rw-r--r--apps/plugins/wavrecord.c2
-rw-r--r--apps/plugins/wormlet.c4
-rw-r--r--apps/plugins/xobox.c2
-rw-r--r--apps/plugins/zxbox.c2
-rw-r--r--apps/plugins/zxbox/Makefile84
-rw-r--r--apps/plugins/zxbox/spmain.c2
-rw-r--r--apps/plugins/zxbox/zxbox.make57
-rw-r--r--apps/plugins/zxbox/zxvid_com.h2
204 files changed, 1539 insertions, 3368 deletions
diff --git a/apps/Makefile b/apps/Makefile
deleted file mode 100644
index 97d7c7716f..0000000000
--- 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 0000000000..1b0bf648f4
--- /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 0000000000..8d0054532e
--- /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 28893e914d..0000000000
--- 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 96f7e50a56..0000000000
--- 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 db707c7542..0000000000
--- 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 03eccfd5ce..0000000000
--- 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 6d3f1f683a..0000000000
--- 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 f0d15ee67b..97f9ee6639 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 2ee4e471b2..0000000000
--- 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 0000000000..a65dc4f67e
--- /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 0000000000..ba764f897e
--- /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 86c2d24919..dd3aaa3f9c 100644
--- a/apps/codecs/demac/libdemac/demac_config.h
+++ b/apps/codecs/demac/libdemac/demac_config.h
@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
#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 4a33a58f27..0000000000
--- 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 6e11eb1aa1..8cc40894e3 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 6e92e29417..1df85d6bee 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 0000000000..5e96f75794
--- /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 798ebc3434..0000000000
--- 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 9e38034783..ade7ecf9b8 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 0000000000..4e0353d56d
--- /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 1c526871f3..0000000000
--- 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 d5d9be17f7..d747caeea7 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 0000000000..b6b22d17e1
--- /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 d20f2393e4..0000000000
--- 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 0000000000..443dfbe7bc
--- /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 8288b4ce79..0000000000
--- 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 59d96252e5..a9c67a5459 100644
--- a/apps/codecs/libfaad/common.h
+++ b/apps/codecs/libfaad/common.h
@@ -33,8 +33,7 @@ extern "C" {
#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 0000000000..0af2cfb1f5
--- /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 02e91d673c..0000000000
--- 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 aa3ce30b62..ed175548f2 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 0000000000..41addbe2b8
--- /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 5dbb54e11e..58b1bb68d7 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 1bc71e50b7..0000000000
--- 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 912e7327e7..e9b5c2c482 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 0000000000..6c092bad5e
--- /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 da3e912b8a..f0666403ed 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 4d838db74f..0000000000
--- 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 2c7fdca199..3fb971d3e1 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 1dad4d5583..93dfd0a13f 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 0000000000..f0334956c1
--- /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 a70d33644a..0000000000
--- 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 833b64b454..20d754c7bb 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 ae2b902ea7..9ca77ceaa5 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 0000000000..736f58bc72
--- /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 b9aff48427..1c98de654b 100644
--- a/apps/codecs/libmusepack/musepack.h
+++ b/apps/codecs/libmusepack/musepack.h
@@ -45,7 +45,9 @@ extern "C" {
//#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 8929149ce2..0000000000
--- 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 0000000000..62f788be02
--- /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 33e566aea2..a6dcd0a8bc 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 6aa9499d1e..d308e6e27c 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 153950ca75..d1facf89a2 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 e646e08ae6..1bebc86d9a 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 5dc516258f..3184ad7b52 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 3bda53dca7..0000000000
--- 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 78b38db44e..9d6cad8886 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 d280757e59..8a190e535d 100644
--- a/apps/codecs/libspeex/cb_search.c
+++ b/apps/codecs/libspeex/cb_search.c
@@ -522,6 +522,9 @@ char *stack,
spx_int32_t *seed
)
{
+ (void)nsf;
+ (void)stack;
+ (void)seed;
int i,j;
VARDECL(int *ind);
VARDECL(int *signs);
@@ -609,6 +612,9 @@ char *stack,
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 7687b453fd..50b530a725 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 5241b4ecd8..f3b397f541 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 44addc2406..09f93c2a59 100644
--- a/apps/codecs/libspeex/filters.c
+++ b/apps/codecs/libspeex/filters.c
@@ -353,6 +353,7 @@ void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t
#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 @@ void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_
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 @@ spx_word16_t comb_gain, /*gain of comb filter*/
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 61bca75ce8..d9f6c67b86 100644
--- a/apps/codecs/libspeex/jitter.c
+++ b/apps/codecs/libspeex/jitter.c
@@ -55,9 +55,9 @@ TODO:
#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 0000000000..a27d559a06
--- /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 3973554cfb..edf480e8bc 100644
--- a/apps/codecs/libspeex/lsp.c
+++ b/apps/codecs/libspeex/lsp.c
@@ -409,6 +409,7 @@ void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
/* 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 04c1115b3f..9f10bc09d8 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 @@ spx_word16_t last_pitch_gain,
int cdbk_offset
)
{
+ (void)end;
+ (void)pitch_coef;
+ (void)stack;
int i;
int pitch;
int gain_index;
@@ -826,6 +829,14 @@ spx_word16_t last_pitch_gain,
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 1e435bc36e..872f072e4e 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 cdb94e603a..e1c60ad7d5 100644
--- a/apps/codecs/libspeex/ltp_arm4.h
+++ b/apps/codecs/libspeex/ltp_arm4.h
@@ -87,6 +87,7 @@ spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
#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 26e2d86180..0fa1c3460e 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 d29b9ae540..31eaa06b6b 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 30abdee842..30edbefaeb 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 3bf4d4021c..0fc206be6f 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 073bad5d98..459c8b532f 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 @@ static inline void speex_free_scratch (void *ptr)
#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 @@ static inline void _speex_fatal(const char *str, const char *file, int line)
#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 51aa3d0e13..86078ea33e 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 dce8f96b42..d42851f10c 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 58d7b7b92a..9ffe5245f1 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_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *st
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_mode_request_handler(SpeexBits *bits, void *state, void *data)
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_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
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 @@ int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data
#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_vbr_request_handler(SpeexBits *bits, void *state, void *data)
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 @@ int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
#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_vbr_quality_request_handler(SpeexBits *bits, void *state, void *da
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 @@ int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
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 1d1d07731c..b0e98b7c9c 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 2dce283ac3..652d2a6e90 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 @@ void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState
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 674d2ae64c..0000000000
--- 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 e1ade700e5..7cfcb7e35d 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 9eb6eef80a..10468bc27d 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 0000000000..6f500ea7ac
--- /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 6bcc717d86..2bb7a46d79 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 b11eaa54f5..ca917ff397 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 20daeb3411..0000000000
--- 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 0000000000..0237d39668
--- /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 e2952115e1..5b5385a521 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 91ea49b1fb..0000000000
--- 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 0000000000..d40d62eb7b
--- /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 a7548ceac4..93f4e27136 100644
--- a/apps/codecs/wma.c
+++ b/apps/codecs/wma.c
@@ -464,7 +464,7 @@ enum codec_status codec_main(void)
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 ca5b37db4c..0db0e5a471 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 15e9f49605..0000000000
--- 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 0000000000..416b2b4504
--- /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 19d062286c..0000000000
--- 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 9465c420d2..0000000000
--- 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 03eb77a55b..0000000000
--- 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 071f0d4ba1..0000000000
--- 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 b95fd379c0..c248bcb97b 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -574,13 +574,13 @@ star_tiles.8x8.bmp
#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 @@ matrix_normal.bmp
/* 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 @@ matrix_normal.bmp
#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
index 54e14bbbe1..54e14bbbe1 100644
--- a/apps/plugins/bitmaps/native/star_tiles.10x10.grey.bmp
+++ b/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
index ebc59b9b11..ebc59b9b11 100644
--- a/apps/plugins/bitmaps/native/star_tiles.6x7.mono.bmp
+++ b/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
index 6f810ce562..6f810ce562 100644
--- a/apps/plugins/bitmaps/native/star_tiles.8x8.grey.bmp
+++ b/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 0000000000..7dbcc0bdff
--- /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 d3858fa46a..0000000000
--- 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 3802e75781..0000000000
--- 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 3633f23eb1..2bc3d59c07 100644
--- a/apps/plugins/bitmaps/remote_native/SOURCES
+++ b/apps/plugins/bitmaps/remote_native/SOURCES
@@ -18,7 +18,7 @@ clock_smallsegments_remote.112x64x1.bmp
/* 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 65aaa3ef09..5d92ed1c4b 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 159e1ecfb4..6d84d2bc85 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 17bfeca01d..5415f3b506 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 51ff184d62..9e86c39b11 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 4efb40df4c..0000000000
--- 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 0000000000..067e3f084a
--- /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 f34bdbf24a..f8db7d9b7f 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -43,7 +43,7 @@ extern const fb_data chessbox_pieces[];
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 0000000000..d42984c771
--- /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 132977753a..b497b161b5 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 abf932a682..0000000000
--- 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 1d257fde6e..9279a182ee 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 0000000000..c864d67503
--- /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 549a4a9448..3f5a09d34b 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 2a0590015a..c237a290ec 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 e6e09652d1..750c4d397e 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 25523d45f6..46563e9eb7 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 391bd73519..c41ec3b24c 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 b6c7a9ac29..99f90934d9 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 7c5925d75f..de5f427c8c 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 1147055ce5..1d78c4705e 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 11a5d2fda2..e3e659bf48 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 8be304e808..ec1930f547 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 96cb5a4cc0..145c3ce0be 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 086309a1b8..77bbda3cae 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 df6baf704b..0000000000
--- 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 0000000000..6cd69faee6
--- /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 0000000000..d566f5307b
--- /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 15d0166733..7713fe19f2 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 e982af9f24..02617abc39 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 5987e9c429..f1b62f5b26 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 e79f0ff377..5134d01538 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 b5fabe030d..cd8db5bf8b 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 0f8b92d9b3..8b73221331 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 a4865b47fb..2380dad2b9 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 075edfda33..239827c123 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 83207258b5..0000000000
--- 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 0000000000..9413ef24b3
--- /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 fef3d4f23a..dae413ccbc 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 94f48eae30..bad757c161 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 c75cca1be9..0000000000
--- 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 be4a39c2b5..b2e640161d 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 ca7f708fc8..56483bdfd3 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 f7751ceb48..67c0623dec 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 @@ PLUGIN_HEADER
# 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 c1726a5e95..fac12def4f 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 1841860144..58abbcaa6c 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 03d6bc69bb..0000000000
--- 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 0000000000..9100764974
--- /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 90ffa37e07..4c8139cb0a 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 7f90cbcc8d..0000000000
--- 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 351581548f..45226575c9 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 14863c943d..0c66f3ff32 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 5e34c2b041..dc2dc0d1fd 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 4ee30b7b00..323f8f34f1 100644
--- a/apps/plugins/mpegplayer/mpegplayer.h
+++ b/apps/plugins/mpegplayer/mpegplayer.h
@@ -85,7 +85,7 @@ enum mpeg_malloc_reason_t
#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 0000000000..7242be3715
--- /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 ae1ff512ea..424d2fe503 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 91f08a5a66..100904b01b 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 9cb59a8fad..68b4530e40 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 e1b998a7aa..0000000000
--- 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 0000000000..75a599d602
--- /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 4dde74a94f..29e8a749d5 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 22d67b6775..5d12818beb 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 0000000000..2e266cb190
--- /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 01513c4877..97f085ad6f 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 3df38082ba..9c568df3be 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 97a042e0f7..0000000000
--- 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 d91f24b3d9..1c1cf56168 100644
--- a/apps/plugins/reversi/reversi-gui.c
+++ b/apps/plugins/reversi/reversi-gui.c
@@ -47,7 +47,7 @@ further options:
#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 0000000000..be7369423e
--- /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 4b33513eb2..747689d9db 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 @@ static char* messages[] =
#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 5ff220f2f1..d9b1c0aeb5 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 af3877154a..f3d25e21cd 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 4aa8526125..0000000000
--- 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 0000000000..8806b58389
--- /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 0000000000..62196cf0b7
--- /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 55875257f9..e22cb33cae 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 32c746cc3e..c9a0c6a840 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 7e3cca4940..0000000000
--- 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 2958af8818..0000000000
--- 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 0000000000..fc2a77a2f5
--- /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 ef33a4f642..0d12556696 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 056ab7818b..28315cc34f 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 9b9cd29e0a..0a032f6bd1 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -34,6 +34,14 @@ PLUGIN_HEADER
#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 d48733461d..f95777e024 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 21cfb1e794..b8cf043125 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 f8f24b93d4..536213686a 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 948b315a32..0000000000
--- 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 150edaba54..4430778cac 100644
--- a/apps/plugins/sudoku/sudoku.c
+++ b/apps/plugins/sudoku/sudoku.c
@@ -69,9 +69,9 @@ Example ".ss" file, and one with a saved state:
#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 0000000000..e1f397c121
--- /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 2e421e151e..085435e4c9 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 7148cfc8b7..6d347738b7 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 108360b69a..b0ef787d36 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 7073494d63..01f24b5987 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 6910c6c7e2..c9d973fe22 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 69c6f4ed9e..a31b7c5415 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 51fb791b1d..e85a979bd5 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 405f6df01d..f07eb098a3 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 d4b8bf1fd2..c26e2c4973 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 6586e78b2c..5411d0cb68 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 59e080d2e0..d345c4404f 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 10e43c4a42..3c1c78f9d2 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 d7862c514b..0000000000
--- 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 6c586566f9..bc5df48059 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 0000000000..e617ba3a12
--- /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 2ef67c6385..1e23ca03e3 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"