Rearranged makefiles again to move platform-specific stuff from the Makefiles

to either the configure script or to be ifdefed in the sources.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5103 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2004-09-22 08:58:50 +00:00
parent ceceba6d3b
commit fc1e925c16
8 changed files with 344 additions and 515 deletions

View file

@ -7,47 +7,11 @@
# $Id$
#
# $@ is the name to the left of the colon
# $> is the first name to the right of the colon
INCLUDES= -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR)
CC = sh-elf-gcc
LD = sh-elf-ld
AR = sh-elf-ar
AS = sh-elf-as
OC = sh-elf-objcopy
LANGUAGE = english
FIRMWARE := ../firmware
DOCSDIR := ../docs
INCLUDES= -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I. -I$(OBJDIR)
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
-fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) \
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEM}
AFLAGS += -small -relax
# Check if this is a kind of Recorder
ANYREC = $(findstring RECORDER, $(TARGET))
# Check if this is an Ondio model
ANYONDIO = $(findstring ONDIO, $(TARGET))
# scramble tool
TOOL = scramble
ifndef MEM
# if MEM is not set, assume 2MB
MEM=2
endif
ifdef ARCHOS_ROM
ROMBUILD=-DARCHOS_ROM
endif
LDS := $(FIRMWARE)/app.lds
ROMLDS := $(FIRMWARE)/rom.lds
DEPFILE = $(OBJDIR)/dep-apps
LDS := $(FIRMDIR)/app.lds
ROMLDS := $(FIRMDIR)/rom.lds
ifdef DEBUG
DEFINES := -DDEBUG
@ -55,103 +19,64 @@ ifdef DEBUG
endif
SRC := $(wildcard *.c)
DIRS = .
ifeq ($(TARGET), -DARCHOS_FMRECORDER)
TOOL_OPT = -fm
endif
ifeq ($(TARGET), -DARCHOS_RECORDERV2)
TOOL_OPT = -v2
endif
ifeq ($(TARGET), -DARCHOS_ONDIOSP)
TOOL_OPT = -osp
endif
ifeq ($(TARGET), -DARCHOS_ONDIOFM)
TOOL_OPT = -ofm
# set the ROMTARGET here
ROMTARGET := $(ARCHOSROM)
ifdef APPEXTRA
SRC += $(wildcard $(APPEXTRA)/*.c)
DIRS += $(APPEXTRA)
INCLUDES += -I$(APPEXTRA)
endif
ifeq ($(ANYREC), RECORDER)
SRC += $(wildcard recorder/*.c)
CFLAGS += -Irecorder
OUTNAME = ajbrec.ajz
# set the ROMTARGET here to make this get built only on recorders
ROMTARGET := $(OBJDIR)/rombox.ucl
else
ifeq ($(TARGET), -DARCHOS_PLAYER)
SRC += $(wildcard player/*.c)
CFLAGS += -Iplayer
OUTNAME = archos.mod
else
ifeq ($(ANYONDIO), ONDIO)
# use the recorder tree for now
SRC += $(wildcard recorder/*.c)
CFLAGS += -Irecorder
OUTNAME = ajbrec.ajz
else
# some kind of Neo
SRC += $(wildcard neo/*.c)
CFLAGS += -Ineo
OUTNAME = Rockbox.bin
TOOL_OPT = -neo
endif
endif
endif
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
-fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) $(DEFINES) \
-DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o)
SOURCES = $(SRC)
LINKFILE = $(OBJDIR)/linkage.lds
LINKROM = $(OBJDIR)/linkrom.lds
ifndef OBJDIR
no_configure:
@echo "Don't run make here. Run the tools/configure script from your own build"
@echo "directory, then run make there."
@echo
@echo "More help on how to build rockbox can be found here:"
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
endif
ifndef TOOLSDIR
TOOLSDIR=../tools
endif
MAXINFILE = $(OBJDIR)/romstart.temp
MAXOUTFILE = $(OBJDIR)/romstart
ifdef DEBUG
all : $(OBJDIR)/rockbox.elf rocks
all: $(OBJDIR)/rockbox.elf rocks
else
all : $(OBJDIR)/$(OUTNAME) $(OBJDIR)/rockbox.ucl rocks $(ROMTARGET)
all: $(OBJDIR)/$(BINARY) $(OBJDIR)/rockbox.ucl rocks $(ROMTARGET)
endif
dep: $(DEPFILE)
rocks:
$(MAKE) -C plugins/lib TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM}
$(MAKE) -C plugins TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM}
@$(MAKE) -C plugins/lib
@$(MAKE) -C plugins
$(OBJDIR)/librockbox.a:
make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR)
@$(MAKE) -C $(FIRMDIR)
# MEM should be passed on to this makefile with the chosen memory size given
# in number of MB
$(LINKFILE): $(LDS)
cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
@echo "Build LDS file"
@cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
$(LINKROM): $(ROMLDS)
cat $< | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
@echo "Build LDS file for Rombox"
@cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
$(MAXOUTFILE):
@echo '#include "config.h"' > $(MAXINFILE)
@echo "ROM_START" >> $(MAXINFILE)
@cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEM) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
@cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE)
@rm $(MAXINFILE)
$(OBJDIR)/rombox.elf : $(OBJS) $(LINKROM) $(OBJDIR)/librockbox.a
@echo "LD rombox.elf"
@$(CC) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMWARE) -T$(LINKROM) -Wl,-Map,$(OBJDIR)/rombox.map
@$(CC) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMDIR) -T$(LINKROM) -Wl,-Map,$(OBJDIR)/rombox.map
$(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(OBJDIR)/librockbox.a
@echo "LD rockbox.elf"
@$(CC) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMWARE) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map
@$(CC) -Os -nostdlib -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMDIR) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map
$(OBJDIR)/rockbox.bin : $(OBJDIR)/rockbox.elf
@echo "OBJCOPY $<"
@ -164,8 +89,9 @@ $(OBJDIR)/rombox.bin : $(OBJDIR)/rombox.elf
$(OBJDIR)/rockbox.asm: $(OBJDIR)/rockbox.bin
$(TOOLSDIR)/sh2d -sh1 $< > $@
$(OBJDIR)/$(OUTNAME) : $(OBJDIR)/rockbox.bin
$(TOOLSDIR)/$(TOOL) $(TOOL_OPT) $< $@
$(OBJDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin $(DEPFILE)
@echo "Build firmware file"
@$(MKFIRMWARE) $< $@
$(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin
@a=`uclpack -h 2>/dev/null`; \
@ -177,7 +103,7 @@ $(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin
echo "fake" > $@; \
fi
$(OBJDIR)/rombox.ucl: $(OBJDIR)/rombox.bin $(MAXOUTFILE)
$(ARCHOSROM): $(OBJDIR)/rombox.bin $(MAXOUTFILE)
@a=`uclpack -h 2>/dev/null`; \
if test -n "$$a"; then \
echo "UCLPACK rombox" ; \
@ -205,10 +131,7 @@ $(OBJDIR)/credits.o: credits.c credits.h $(OBJDIR)/credits.raw
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.c
@mkdir -p `dirname $@`
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
include $(TOOLSDIR)/make.inc
$(OBJDIR)/build.lang: lang/$(LANGUAGE).lang $(TOOLSDIR)/uplang
@echo "UPLANG"
@ -222,44 +145,13 @@ $(OBJDIR)/lang.o: $(OBJDIR)/build.lang $(TOOLSDIR)/genlang
clean:
@echo "cleaning apps"
@-rm -f $(OBJS) $(OBJDIR)/$(OUTNAME) $(OBJDIR)/rockbox.asm \
@-rm -f $(OBJS) $(OBJDIR)/$(BINARY) $(OBJDIR)/rockbox.asm \
$(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.elf $(OBJDIR)/*.map \
$(OBJDIR)/lang.o $(OBJDIR)/build.lang $(OBJDIR)/lang.[ch] \
$(OBJDIR)/credits.raw $(LINKFILE) $(OBJDIR)/rockbox.ucl \
$(LINKROM) $(OBJDIR)/rombox.ucl $(OBJDIR)/rombox.bin \
$(OBJDIR)/rombox.elf $(MAXOUTFILE)
@-$(RM) -r $(OBJDIR)/$(DEPS)
$(OBJDIR)/rombox.elf $(MAXOUTFILE) $(DEPFILE)
@$(MAKE) -C plugins clean
@rm -rf $(OBJDIR)/recorder $(OBJDIR)/player
DEPS:=.deps
DEPDIRS:=$(DEPS)
ifeq ($(ANYREC), RECORDER)
DEPDIRS += $(DEPS)/recorder
else
ifeq ($(TARGET), -DARCHOS_PLAYER)
DEPDIRS += $(DEPS)/player
else
ifeq ($(ANYONDIO), ONDIO)
# use the recorder tree for now
DEPDIRS += $(DEPS)/recorder
else
# some kind of Neo
DEPDIRS += $(DEPS)/neo
endif
endif
endif
DIRS = $(subst $(DEPS),".",$(DEPDIRS))
tags:
@$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
$(OBJDIR)/$(DEPS)/%.d: %.c
@$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done'
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< 2>/dev/null \
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
[ -s $@ ] || rm -f $@'
ifdef OBJDIR
-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
endif
-include $(DEPFILE)

View file

@ -7,46 +7,27 @@
# $Id$
#
CC = sh-elf-gcc
OC = sh-elf-objcopy
FIRMWARE = ../../firmware
# Check if this is a kind of Recorder
ANYREC = $(findstring RECORDER, $(TARGET))
# Check if this is an Ondio model
ANYONDIO = $(findstring ONDIO, $(TARGET))
INCLUDES = -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I$(FIRMWARE)/common \
-I$(FIRMWARE)/drivers -I.. -Ilib
INCLUDES = -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I$(FIRMDIR)/common \
-I$(FIRMDIR)/drivers -I$(APPSDIR) -Ilib
CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM} -DPLUGIN
$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} -DPLUGIN
ifeq ($(ANYREC), RECORDER)
INCLUDES += -I../recorder
endif
ifeq ($(ANYONDIO), ONDIO)
# use the recorder tree for now
INCLUDES += -I../recorder
ifdef APPEXTRA
INCLUDES += -I$(APPSDIR)/$(APPEXTRA)
endif
LDS := plugin.lds
LINKFILE := $(OBJDIR)/pluginlink.lds
DEPFILE = $(OBJDIR)/dep-plugins
SRC := $(wildcard *.c)
ROCKS := $(SRC:%.c=$(OBJDIR)/%.rock)
SOURCES = $(SRC)
ELFS := $(SRC:%.c=$(OBJDIR)/%.elf)
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
DIRS = .
ifndef OBJDIR
no_configure:
@echo "Don't run make here. Run the tools/configure script from your own build"
@echo "directory, then run make there."
@echo
@echo "More help on how to build rockbox can be found here:"
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
endif
$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(OBJDIR)/libplugin.a
$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(OBJDIR)/libplugin.a $(DEPFILE)
@echo "LD $@"
@$(CC) -O -nostdlib -o $@ $< -L$(OBJDIR) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map
@ -54,9 +35,7 @@ $(OBJDIR)/%.rock : $(OBJDIR)/%.elf
@echo "OBJCOPY $<"
@$(OC) -O binary $< $@
$(OBJDIR)/%.o: %.c ../plugin.h Makefile
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
include $(TOOLSDIR)/make.inc
ifeq ($(ANYONDIO), ONDIO)
all:
@ -68,15 +47,15 @@ endif
$(OBJDIR)/libplugin.a:
@echo "MAKE in lib"
@$(MAKE) -C lib TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEM}
@$(MAKE) -C lib TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" MEM=${MEMORYSIZE}
# MEM should be passed on to this makefile with the chosen memory size given
# in number of MB
$(LINKFILE): $(LDS)
@echo "build $@"
@$(CC) -DMEMORYSIZE=$(MEM) $(DEFINES) -x c -E -P $< >$@
@$(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(DEFINES) -x c -E -P $< >$@
clean:
@echo "cleaning plugins"
@-rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock
@rm -f $(ROCKS) $(LINKFILE) $(OBJDIR)/*.rock $(DEPFILE) $(ELFS) $(OBJS)
@$(MAKE) -C lib clean

View file

@ -7,42 +7,18 @@
# $Id$
#
CC = sh-elf-gcc
LD = sh-elf-ld
AR = sh-elf-ar
AS = sh-elf-as
OC = sh-elf-objcopy
FIRMWARE = ../../../firmware
# Check if this is a kind of Recorder
ANYREC = $(findstring RECORDER, $(TARGET))
# Check if this is an Ondio model
ANYONDIO = $(findstring ONDIO, $(TARGET))
# ../.. for the plugin.h in the apps dir
# .. for stuff in the plugins dir
# . for stuff in the pluginlib dir
INCLUDES=-I../.. -I.. -I. -I$(FIRMWARE)/include -I$(FIRMWARE)/export \
-I$(FIRMWARE)/common -I$(FIRMWARE)/drivers
INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
-I$(FIRMDIR)/common -I$(FIRMDIR)/drivers
ifeq ($(ANYREC), RECORDER)
INCLUDES += -I../../recorder
ifdef APPEXTRA
INCLUDES += -I$(APPSDIR)/$(APPEXTRA)
endif
ifeq ($(ANYONDIO), ONDIO)
# use the recorder tree for now
INCLUDES += -I../../recorder
endif
CFLAGS = -W -Wall -O -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM}
ifndef MEM
# if MEM is not set, assume 2MB
MEM=2
endif
$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
ifdef DEBUG
CFLAGS += -g -DDEBUG
@ -51,51 +27,25 @@ CFLAGS += -fomit-frame-pointer -fschedule-insns
endif
SRC := $(wildcard *.c)
SOURCES = $(SRC)
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
DEPS:=.deps
DEPDIRS:=$(DEPS)
DIRS = $(subst $(DEPS),".",$(DEPDIRS))
DEPFILE = $(OBJDIR)/dep-pluginlib
DIRS = .
OUTPUT = $(OBJDIR)/libplugin.a
ifndef OBJDIR
no_configure:
@echo "Don't run make here. Run the tools/configure script from your own build"
@echo "directory, then run make there."
@echo
@echo "More help on how to build rockbox can be found here:"
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
endif
all: $(OUTPUT)
@echo "lib done"
$(OUTPUT): $(OBJS)
@echo "AR $@"
@$(AR) ruv $@ $+ >/dev/null
@$(AR) ruv $@ $+ >/dev/null 2>&1
$(OBJDIR)/%.o: %.c
@mkdir -p `dirname $@`
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
tags:
@$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
include $(TOOLSDIR)/make.inc
clean:
@echo "cleaning lib"
@rm -f $(OBJS) $(OUTPUT)
@rm -rf $(OBJDIR)/$(DEPS)
@rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
$(OBJDIR)/$(DEPS)/%.d: %.c
@$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done'
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< 2>/dev/null \
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
[ -s $@ ] || rm -f $@'
-include $(DEPFILE)
ifdef OBJDIR
-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
endif

View file

@ -7,20 +7,10 @@
# $Id$
#
CC = sh-elf-gcc
LD = sh-elf-ld
AR = sh-elf-ar
AS = sh-elf-as
OC = sh-elf-objcopy
INCLUDES=-Iinclude -I$(FIRMDIR) -Iexport -Icommon -Idrivers
INCLUDES=-Iinclude -I. -Iexport -Icommon -Idrivers
CFLAGS = -W -Wall -O -m1 -nostdlib -ffreestanding -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM}
ifndef MEM
# if MEM is not set, assume 2MB
MEM=2
endif
CFLAGS = -W -Wall -O -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
ifdef DEBUG
CFLAGS += -g -DDEBUG
@ -30,61 +20,29 @@ endif
SRC := $(wildcard drivers/*.c common/*.c *.c)
SRC_S := $(wildcard drivers/*.S common/*.S *.S)
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(SRC_S:%.S=$(OBJDIR)/%.o)
DEPS:=.deps
DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc
DIRS = $(subst $(DEPS),".",$(DEPDIRS))
SOURCES = $(SRC) $(SRC_S)
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(SRC_S:%.S=$(OBJDIR)/%.o) $(OBJDIR)/sysfont.o
DIRS:=. drivers common
OUTPUT = $(OBJDIR)/librockbox.a
ifeq (RECORDER,$(findstring RECORDER, $(CFLAGS)))
OBJS += $(OBJDIR)/sysfont.o
endif
ifeq (ONDIO,$(findstring ONDIO, $(CFLAGS)))
OBJS += $(OBJDIR)/sysfont.o
endif
ifndef OBJDIR
no_configure:
@echo "Don't run make here. Run the tools/configure script from your own build"
@echo "directory, then run make there."
@echo
@echo "More help on how to build rockbox can be found here:"
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
endif
ifndef TOOLSDIR
TOOLSDIR=../tools
endif
DEPFILE = $(OBJDIR)/dep-firmware
all: $(TOOLSDIR)/convbdf $(OUTPUT) $(EXTRA_TARGETS)
dep: $(DEPFILE)
$(TOOLSDIR)/convbdf:
$(MAKE) -C $(TOOLSDIR)
$(OUTPUT): $(OBJS)
$(OUTPUT): $(OBJS) $(DEPFILE)
@echo "AR $@"
@$(AR) ruv $@ $+ >/dev/null
@$(AR) ruv $@ $+ >/dev/null 2>&1
$(OBJDIR)/%.o: %.c
@mkdir -p `dirname $@`
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.S
@mkdir -p `dirname $@`
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
tags:
@$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
include $(TOOLSDIR)/make.inc
clean:
@echo "cleaning firmware"
@rm -f $(OBJS) $(OUTPUT) $(OBJDIR)/sysfont.c
@rm -rf $(OBJDIR)/$(DEPS)
@rm -f $(OBJS) $(OUTPUT) $(OBJDIR)/sysfont.c $(DEPFILE)
@rm -rf $(OBJDIR)/drivers $(OBJDIR)/common
# Special targets
$(OBJDIR)/thread.o: thread.c export/thread.h
@ -97,13 +55,4 @@ $(OBJDIR)/sysfont.o: fonts/clR6x8.bdf
@echo "CC sysfont.c"
@$(CC) $(CFLAGS) -c $(OBJDIR)/sysfont.c -o $@
$(OBJDIR)/$(DEPS)/%.d: %.c
@$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done'
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< 2>/dev/null \
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
[ -s $@ ] || rm -f $@'
ifdef OBJDIR
-include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
endif
-include $(DEPFILE)

395
tools/configure vendored
View file

@ -17,6 +17,22 @@ input() {
echo $response
}
shcc () {
CC=sh-elf-gcc
LD=sh-elf-ld
AR=sh-elf-ar
AS=sh-elf-as
OC=sh-elf-objcopy
}
coldfirecc () {
CC=m68k-elf-gcc
LD=m68k-elf-ld
AR=m68k-elf-ar
AS=m68k-elf-as
OC=m68k-elf-objcopy
}
whichsim () {
if [ -z "$simver" ]; then
@ -56,32 +72,36 @@ sed > Makefile \
<<EOF
## Automaticly generated. http://rockbox.haxx.se
ARCHOS=@ARCHOS@
ROOTDIR=@ROOTDIR@
SIMDIR=\$(ROOTDIR)/uisimulator/@SIMVER@
TOOLSDIR=\$(ROOTDIR)/tools
DEBUG=@DEBUG@
KEYPAD=@KEYPAD@
THISDIR="@PWD@"
SIMVER=@SIMVER@
TARGET=@TARGET@
LANGUAGE=@LANGUAGE@
VERSION=\$(shell date +%y%m%d-%H%M)
export ARCHOS=@ARCHOS@
export ROOTDIR=@ROOTDIR@
export FIRMDIR=\$(ROOTDIR)/firmware
export APPSDIR=\$(ROOTDIR)/apps
export TOOLSDIR=\$(ROOTDIR)/tools
export DOCSDIR=\$(ROOTDIR)/docs
export APPSDIR=@ROOTDIR@/apps
export SIMDIR=\$(ROOTDIR)/uisimulator/@SIMVER@
export DEBUG=@DEBUG@
export KEYPAD=@KEYPAD@
export OBJDIR=@PWD@
export SIMVER=@SIMVER@
export TARGET=@TARGET@
export LANGUAGE=@LANGUAGE@
export VERSION=\$(shell date +%y%m%d-%H%M)
.PHONY:
all: sim
sim:
\$(MAKE) -C \$(SIMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) LANGUAGE=\$(LANGUAGE)
\$(MAKE) -C \$(SIMDIR)
clean:
\$(MAKE) -C \$(SIMDIR) OBJDIR=\$(THISDIR) clean
\$(MAKE) -C \$(SIMDIR) clean
rm -rf rockbox.zip
tags:
@rm -f TAGS
make -C \$(SIMDIR) OBJDIR=\$(THISDIR) tags
make -C \$(SIMDIR) tags
zip:
\$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" sim\$(TARGET)
@ -169,25 +189,8 @@ fi
pwd=`pwd`;
if [ "$target" = "update" ]; then
update="1"
target=""
if [ -f Makefile ]; then
if { grep "^## Auto" Makefile >/dev/null 2>&1 ; } then
echo "Existing generated Makefile found. Getting defaults from it."
archos=`grep "^ARCHOS=" Makefile | cut -d= -f2-`
debug=`grep "^DEBUG=" Makefile | cut -d= -f2-`
language=`grep "^LANGUAGE=" Makefile | cut -d= -f2-`
memory=`grep "^MEMORYSIZE=" Makefile | cut -d= -f2-`
rootdir=`grep "^ROOTDIR=" Makefile | cut -d= -f2-`
target=`grep "^TARGET=" Makefile | cut -d= -f2-`
if [ "$debug" = "SIMULATOR=1" ]; then
simulator="yes"
keypad=`grep "^KEYPAD=" Makefile | cut -d= -f2-`
simver=`grep "^SIMVER=" Makefile | cut -d= -f2-`
fi
fi
fi
echo "configure update is unfortunately no longer supported"
exit
else
echo "This script will setup your Rockbox build environment."
@ -196,114 +199,6 @@ echo ""
fi
if [ -z "$archos" ]; then
##################################################################
# Figure out target platform
#
echo "Enter target platform: (default is Archos Recorder)"
echo "1 - Archos Player/Studio"
echo "2 - Archos Recorder"
echo "3 - Archos FM Recorder"
echo "4 - Archos Recorder v2"
echo "7 - Archos Ondio SP"
echo "8 - Archos Ondio FM"
echo "9 - Iriver H100"
getit=`input`;
case $getit in
1)
archos="player"
target="-DARCHOS_PLAYER"
;;
3)
archos="fmrecorder"
target="-DARCHOS_FMRECORDER"
;;
4)
archos="recorderv2"
target="-DARCHOS_RECORDERV2"
;;
7)
archos="ondiosp"
target="-DARCHOS_ONDIOSP"
;;
8)
archos="ondiofm"
target="-DARCHOS_ONDIOFM"
;;
9)
archos="h100"
target="-DIRIVER_H100"
memory=32 # always
;;
*)
archos="recorder"
target="-DARCHOS_RECORDER"
;;
esac
echo "Platform set to $archos"
fi
if [ -z "$memory" ]; then
size="2"
if [ -z "$update" ]; then
echo "Enter size of your RAM (in MB): (defaults to 2)"
size=`input`;
fi
case $size in
8)
memory="8"
;;
*)
memory="2"
;;
esac
echo "Memory size selected: $memory MB"
fi
if [ -z "$debug" ]; then
##################################################################
# Figure out debug on/off
#
echo "Build (N)ormal, (D)ebug or (S)imulated version? (N)"
option=`input`;
case $option in
[Ss])
debug="SIMULATOR=1"
simulator="yes"
echo "Simulator build selected"
whichsim
;;
[Dd])
debug="DEBUG=1"
echo "Debug build selected"
;;
*)
debug="NODEBUG=1"
echo "Normal build selected"
;;
esac
fi
if [ -z "$rootdir" ]; then
##################################################################
# Figure out where the source code root is!
@ -340,6 +235,149 @@ if [ -z "$rootdir" ]; then
cd $now
fi
if [ -z "$archos" ]; then
##################################################################
# Figure out target platform
#
echo "Enter target platform: (default is Archos Recorder)"
echo "1 - Archos Player/Studio"
echo "2 - Archos Recorder"
echo "3 - Archos FM Recorder"
echo "4 - Archos Recorder v2"
echo "7 - Archos Ondio SP"
echo "8 - Archos Ondio FM"
echo "9 - Iriver H100"
getit=`input`;
case $getit in
1)
archos="player"
target="-DARCHOS_PLAYER"
shcc
tool="scramble"
output="archos.mod"
appextra="player"
archosrom=""
;;
*)
archos="recorder"
target="-DARCHOS_RECORDER"
shcc
tool="scramble"
output="ajbrec.ajz"
appextra="recorder"
archosrom="$pwd/rombox.ucl"
;;
3)
archos="fmrecorder"
target="-DARCHOS_FMRECORDER"
shcc
tool="scramble -fm"
output="ajbrec.ajz"
appextra="recorder"
archosrom="$pwd/rombox.ucl"
;;
4)
archos="recorderv2"
target="-DARCHOS_RECORDERV2"
shcc
tool="scramble -v2"
output="ajbrec.ajz"
appextra="recorder"
archosrom="$pwd/rombox.ucl"
;;
7)
archos="ondiosp"
target="-DARCHOS_ONDIOSP"
shcc
tool="scramble -osp"
output="ajbrec.ajz"
appextra="recorder"
archosrom=""
;;
8)
archos="ondiofm"
target="-DARCHOS_ONDIOFM"
shcc
tool="scramble -ofm"
output="ajbrec.ajz"
appextra="recorder"
archosrom=""
;;
9)
archos="h100"
target="-DIRIVER_H100"
memory=32 # always
coldfirecc
tool="not-written-yet"
output="rockbox.iriver"
appextra=""
archosrom=""
;;
esac
echo "Platform set to $archos"
fi
if [ -z "$memory" ]; then
size="2"
if [ -z "$update" ]; then
echo "Enter size of your RAM (in MB): (defaults to 2)"
size=`input`;
fi
case $size in
8)
memory="8"
;;
*)
memory="2"
;;
esac
echo "Memory size selected: $memory MB"
fi
if [ -z "$debug" ]; then
##################################################################
# Figure out debug on/off
#
echo "Build (N)ormal, (D)ebug or (S)imulated version? (N)"
option=`input`;
case $option in
[Ss])
debug="1"
simulator="yes"
echo "Simulator build selected"
whichsim
;;
[Dd])
debug="1"
echo "Debug build selected"
;;
*)
debug=""
echo "Normal build selected"
;;
esac
fi
if [ -z "$language" ]; then
@ -369,50 +407,57 @@ sed > Makefile \
-e "s,@ARCHOS@,${archos},g" \
-e "s,@LANGUAGE@,${language},g" \
-e "s,@PWD@,${pwd},g" \
-e "s,@CC@,${CC},g" \
-e "s,@LD@,${LD},g" \
-e "s,@AR@,${AR},g" \
-e "s,@AS@,${AS},g" \
-e "s,@OC@,${OC},g" \
-e "s,@TOOL@,${tool},g" \
-e "s,@OUTPUT@,${output},g" \
-e "s,@APPEXTRA@,${appextra},g" \
-e "s,@ARCHOSROM@,${archosrom},g" \
<<EOF
## Automaticly generated. http://rockbox.haxx.se
ROOTDIR=@ROOTDIR@
FIRMDIR=\$(ROOTDIR)/firmware
APPSDIR=\$(ROOTDIR)/apps
TOOLSDIR=\$(ROOTDIR)/tools
DEBUG=@DEBUG@
ARCHOS=@ARCHOS@
TARGET=@TARGET@
THISDIR="@PWD@"
LANGUAGE=@LANGUAGE@
MEMORYSIZE=@MEMORY@
VERSION=\$(shell date +%y%m%d-%H%M)
export ROOTDIR=@ROOTDIR@
export FIRMDIR=\$(ROOTDIR)/firmware
export APPSDIR=\$(ROOTDIR)/apps
export TOOLSDIR=\$(ROOTDIR)/tools
export DOCSDIR=\$(ROOTDIR)/docs
export DEBUG=@DEBUG@
export ARCHOS=@ARCHOS@
export ARCHOSROM=@ARCHOSROM@
export TARGET=@TARGET@
export OBJDIR=@PWD@
export LANGUAGE=@LANGUAGE@
export MEMORYSIZE=@MEMORY@
export VERSION=\$(shell date +%y%m%d-%H%M)
export MKFIRMWARE=\$(TOOLSDIR)/@TOOL@
export BINARY=@OUTPUT@
export APPEXTRA=@APPEXTRA@
export CC=@CC@
export LD=@LD@
export AR=@AR@
export AS=@AS@
export OC=@OC@
.PHONY: firmware apps
.PHONY: all clean tags zip
all: firmware apps
firmware:
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) MEM=\$(MEMORYSIZE) TOOLSDIR=\$(TOOLSDIR)
apps:
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR) VERSION=\$(VERSION) LANGUAGE=\$(LANGUAGE) MEM=\$(MEMORYSIZE) TOOLSDIR=\$(TOOLSDIR)
clean-firmware:
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean
clean-apps:
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) clean
all:
@\$(MAKE) -C \$(FIRMDIR)
@\$(MAKE) -C \$(APPSDIR)
clean:
\$(MAKE) clean-firmware clean-apps
rm -f rockbox.zip
tags-firmware:
\$(MAKE) -C \$(FIRMDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) tags
tags-apps:
\$(MAKE) -C \$(APPSDIR) TARGET=\$(TARGET) OBJDIR=\$(THISDIR) tags
@\$(MAKE) -C \$(FIRMDIR) clean
@\$(MAKE) -C \$(APPSDIR) clean
@rm -f rockbox.zip TAGS
tags:
@rm -f TAGS
\$(MAKE) tags-firmware tags-apps
\$(MAKE) -C \$(FIRMDIR) tags
\$(MAKE) -C \$(APPSDIR) tags
\$(MAKE) -C \$(APPSDIR)/plugins tags
\$(MAKE) -C \$(APPSDIR)/plugins/lib tags
zip:
\$(TOOLSDIR)/buildzip.pl -r "\$(ROOTDIR)" \$(TARGET)

View file

@ -773,6 +773,7 @@ int gen_c_source(struct font* pf, char *path)
char hdr1[] = {
"/* Generated by convbdf on %s. */\n"
"#include \"font.h\"\n"
"#ifdef HAVE_LCD_BITMAP\n"
"\n"
"/* Font information:\n"
" name: %s\n"
@ -946,7 +947,8 @@ int gen_c_source(struct font* pf, char *path)
" %s /* offset */\n"
" %s\n"
" %d, /* defaultchar */\n"
"};\n",
"};\n"
"#endif /* HAVE_LCD_BITMAP */\n",
pf->maxwidth, pf->height,
pf->ascent,
pf->firstchar,

21
tools/make.inc Normal file
View file

@ -0,0 +1,21 @@
$(OBJDIR)/%.o: %.c
@mkdir -p `dirname $@`
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.S
@mkdir -p `dirname $@`
@echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@
$(DEPFILE): $(SOURCES)
@rm -f $(DEPFILE)
@(for each in $(SOURCES); do \
obj=`echo $$each | sed -e 's/\.c/.o/'`; \
$(CC) -MM -MT "$(OBJDIR)/$$obj.o" $(CFLAGS) $$each >> $(DEPFILE) 2>/dev/null; \
done )
tags:
@(for d in $(DIRS); do \
etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; \
done)

View file

@ -17,10 +17,9 @@
#
############################################################################
APPDIR = ../../apps
RECDIR = $(APPDIR)/recorder
PLAYDIR = $(APPDIR)/player
PLUGINDIR = $(APPDIR)/plugins
RECDIR = $(APPSDIR)/recorder
PLAYDIR = $(APPSDIR)/player
PLUGINDIR = $(APPSDIR)/plugins
SIMCOMMON = ../common
ISONDIO := $(findstring ONDIO, $(TARGET))
@ -31,17 +30,14 @@ else
MACHINEDIR = $(RECDIR)
endif
PREVAPPDIR= ..
FIRMWAREDIR = ../../firmware
PREVAPPSDIR= ..
# build some sources from these dirs
DRIVERS = $(FIRMWAREDIR)/drivers
COMMON = $(FIRMWAREDIR)/common
DRIVERS = $(FIRMDIR)/drivers
COMMON = $(FIRMDIR)/common
# include here:
EXPORT = $(FIRMWAREDIR)/export
TOOLSDIR = ../../tools
DOCSDIR = ../../docs
EXPORT = $(FIRMDIR)/export
RM = rm -f
DEBUG = -g
@ -55,20 +51,16 @@ no_configure:
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
endif
LANGUAGE = english
TARGET = $(OBJDIR)/rockboxui
DEFINES := -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
$(TARGET) -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES)
# Use this for simulator-only files
INCLUDES = -I. -I$(EXPORT) -I$(APPDIR) -I$(MACHINEDIR) -I$(SIMCOMMON) -I$(OBJDIR) -I$(PLUGINDIR)/lib
INCLUDES = -I. -I$(EXPORT) -I$(APPSDIR) -I$(MACHINEDIR) -I$(SIMCOMMON) -I$(OBJDIR) -I$(PLUGINDIR)/lib
# The true Rockbox Applications should use this include path:
APPINCLUDES = $(INCLUDES)
SRCDIRS = . $(DRIVERS) $(FIRMWAREDIR)/export $(APPDIR) $(MACHINEDIR)
SRCDIRS = . $(DRIVERS) $(FIRMDIR)/export $(APPSDIR) $(MACHINEDIR)
# The true Rockbox Applications should use this include path:
APPINCLUDES = $(INCLUDES)
@ -164,26 +156,26 @@ clean:
################## Specific dependencies ##################
$(OBJDIR)/credits.raw: $(DOCSDIR)/CREDITS
perl $(APPDIR)/credits.pl < $< > $@
perl $(APPSDIR)/credits.pl < $< > $@
$(OBJDIR)/uisw32-res.o: uisw32.rc
$(WINDRES) -i $< -o $@
$(OBJDIR)/credits.o: $(APPDIR)/credits.c $(APPDIR)/credits.h $(OBJDIR)/credits.raw
$(OBJDIR)/credits.o: $(APPSDIR)/credits.c $(APPSDIR)/credits.h $(OBJDIR)/credits.raw
$(OBJDIR)/thread.o: ./thread.c
$(OBJDIR)/plugin.o: $(APPDIR)/plugin.c
$(OBJDIR)/build.lang: $(APPDIR)/lang/$(LANGUAGE).lang
$(OBJDIR)/plugin.o: $(APPSDIR)/plugin.c
$(OBJDIR)/build.lang: $(APPSDIR)/lang/$(LANGUAGE).lang
@echo "UPLANG"
@perl $(TOOLSDIR)/uplang $(APPDIR)/lang/english.lang $< > $@
@perl $(TOOLSDIR)/uplang $(APPSDIR)/lang/english.lang $< > $@
$(OBJDIR)/lang.o: $(OBJDIR)/build.lang
@echo GENLANG
@perl -s $(TOOLSDIR)/genlang -p=$(OBJDIR)/lang $<
@echo "CC lang.c"
@$(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@
$(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@
$(OBJDIR)/sysfont.o: $(FIRMWAREDIR)/fonts/clR6x8.bdf
$(OBJDIR)/sysfont.o: $(FIRMDIR)/fonts/clR6x8.bdf
@echo CC $<
@$(TOOLSDIR)/convbdf -c -o $(OBJDIR)/sysfont.c $<
@$(CC) $(APPCFLAGS) -c $(OBJDIR)/sysfont.c -o $@
@ -197,7 +189,7 @@ $(OBJDIR)/%.o: $(PLUGINDIR)/lib/%.c
@echo CC $<
@$(CC) $(CFLAGS) -DPLUGIN -c $< -o $@
$(OBJDIR)/%.rock: $(APPDIR)/plugins/%.c $(APPDIR)/plugin.h
$(OBJDIR)/%.rock: $(APPSDIR)/plugins/%.c $(APPSDIR)/plugin.h
@echo CC $<
@$(CC) $(APPCFLAGS) -DPLUGIN -L$(OBJDIR) -lplugin -shared $< -o $@
@chmod -x $@
@ -219,7 +211,7 @@ $(OBJDIR)/%.o: $(DRIVERS)/%.c
@echo CC $<
@$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/%.o: $(FIRMWAREDIR)/%.c
$(OBJDIR)/%.o: $(FIRMDIR)/%.c
@echo CC $<
@$(CC) $(APPCFLAGS) -c $< -o $@
@ -227,7 +219,7 @@ $(OBJDIR)/%.o: $(COMMON)/%.c
@echo CC $<
@$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/%.o: $(APPDIR)/%.c
$(OBJDIR)/%.o: $(APPSDIR)/%.c
@echo CC $<
@$(CC) $(APPCFLAGS) -c $< -o $@
@ -239,7 +231,6 @@ $(DEPS)/%.d: %.c
@$(SHELL) -c 'if [ ! -d $(DEPS) ]; then \
echo Creating the dependency directory: $(DEPS); \
mkdir -p $(DEPS); fi'
@echo "Updating Dependencies for $<"
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
[ -s $@ ] || rm -f $@'