Prevent unnecessary rebuilding of libs.

- When building for Rockbox Utility the called Makefiles would rebuild the libs
  every time. Change dependencies a bit to allow make to properly detect if the
  lib is already up to date.
- Remove dependency on output folder in some cases to avoid unnecessary
  rebuilds.
- Add standard Rockbox header to files lacking it.
- Make make calls from qmake silent.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30608 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2011-09-26 20:51:23 +00:00
parent ccc5f4c4e1
commit c7c657ca92
5 changed files with 66 additions and 47 deletions

View file

@ -1,9 +1,15 @@
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
#change for releases #change for releases
ifndef APPVERSION ifndef APPVERSION
APPVERSION=`../../tools/version.sh ../../` APPVERSION=$(shell ../../tools/version.sh ../../)
endif endif
TARGET_DIR ?= $(shell pwd)/
# We use the UCL code available in the Rockbox tools/ directory # We use the UCL code available in the Rockbox tools/ directory
CFLAGS=-I../../tools/ucl/include -Wall -DVERSION=\"$(APPVERSION)\" CFLAGS=-I../../tools/ucl/include -Wall -DVERSION=\"$(APPVERSION)\"
@ -37,10 +43,10 @@ endif
all: $(OUTPUT) all: $(OUTPUT)
# additional link dependencies for the standalone executable # additional link dependencies for the standalone executable
LIBUCL=../../tools/ucl/src/libucl$(RBARCH).a LIBUCL=$(OBJDIR)libucl$(RBARCH).a
$(LIBUCL): $(LIBUCL):
$(MAKE) -C ../../tools/ucl/src $(TARGET_DIR)libucl$(RBARCH).a $(SILENT)$(MAKE) -C ../../tools/ucl/src TARGET_DIR=$(OBJDIR) libucl$(RBARCH).a
# inputs # inputs
LIBSOURCES := dualboot.c md5.c mkamsboot.c LIBSOURCES := dualboot.c md5.c mkamsboot.c
@ -58,9 +64,11 @@ $(OBJDIR)%.o: %.c
$(SILENT)mkdir -p $(dir $@) $(SILENT)mkdir -p $(dir $@)
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $< $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
libmkamsboot$(RBARCH).a: $(LIBOBJS) libmkamsboot$(RBARCH).a: $(TARGET_DIR)libmkamsboot$(RBARCH).a
@echo AR $@
$(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^ $(TARGET_DIR)libmkamsboot$(RBARCH).a: $(LIBOBJS)
@echo AR $(notdir $@)
$(SILENT)$(AR) rucs $@ $^
# building the standalone executable # building the standalone executable
$(OUTPUT): $(OBJS) $(EXTRADEPS) $(OUTPUT): $(OBJS) $(EXTRADEPS)
@ -74,7 +82,7 @@ $(TARGET_DIR)libmkamsbooti386.a:
$(TARGET_DIR)libmkamsbootppc.a: $(TARGET_DIR)libmkamsbootppc.a:
make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkamsbootppc.a make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkamsbootppc.a
endif endif
libmkamsboot-universal: $(TARGET_DIR)libmkamsbooti386.a $(TARGET_DIR)libmkamsbootppc.a libmkamsboot-universal: $(TARGET_DIR)libmkamsbooti386.a $(TARGET_DIR)libmkamsbootppc.a
@echo lipo $(TARGET_DIR)libmkamsboot.a @echo lipo $(TARGET_DIR)libmkamsboot.a

View file

@ -1,3 +1,9 @@
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
#change for releases #change for releases
ifndef APPVERSION ifndef APPVERSION
@ -33,6 +39,7 @@ else
OBJDIR = $(TARGET_DIR)build/ OBJDIR = $(TARGET_DIR)build/
endif endif
TARGET_DIR ?= $(shell pwd)
all: $(OUTPUT) all: $(OUTPUT)
@ -52,9 +59,11 @@ $(OBJDIR)%.o: %.c
$(SILENT)mkdir -p $(dir $@) $(SILENT)mkdir -p $(dir $@)
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $< $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
libmkmpioboot$(RBARCH).a: $(LIBOBJS) libmkmpioboot$(RBARCH).a: $(TARGET_DIR)libmkmpioboot$(RBARCH).a
@echo AR $@
$(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^ $(TARGET_DIR)libmkmpioboot$(RBARCH).a: $(LIBOBJS)
@echo AR $(notdir $@)
$(SILENT)$(AR) rucs $@ $^
# building the standalone executable # building the standalone executable
$(OUTPUT): $(OBJS) $(EXTRADEPS) $(OUTPUT): $(OBJS) $(EXTRADEPS)
@ -68,7 +77,7 @@ $(TARGET_DIR)libmkmpiobooti386.a:
$(TARGET_DIR)libmkmpiobootppc.a: $(TARGET_DIR)libmkmpiobootppc.a:
make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkmpiobootppc.a make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkmpiobootppc.a
endif endif
libmkmpioboot-universal: $(TARGET_DIR)libmkmpiobooti386.a $(TARGET_DIR)libmkmpiobootppc.a libmkmpioboot-universal: $(TARGET_DIR)libmkmpiobooti386.a $(TARGET_DIR)libmkmpiobootppc.a
@echo lipo $(TARGET_DIR)libmkmpioboot.a @echo lipo $(TARGET_DIR)libmkmpioboot.a

View file

@ -34,29 +34,34 @@ ifdef RBARCH
CFLAGS += -arch $(RBARCH) CFLAGS += -arch $(RBARCH)
endif endif
OUT = $(TARGET_DIR)build$(RBARCH) TARGET_DIR ?= $(shell pwd)/
OBJDIR = $(TARGET_DIR)build$(RBARCH)
all: $(OUTPUT) all: $(OUTPUT)
# inputs # inputs
LIBSOURCES := mktccboot.c $(TOOLSDIR)/telechips.o LIBSOURCES := mktccboot.c $(TOOLSDIR)/telechips.o
SOURCES := $(LIBSOURCES) main.c SOURCES := $(LIBSOURCES) main.c
OBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(notdir $(SOURCES)))) OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR)/,$(notdir $(SOURCES))))
LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(notdir $(LIBSOURCES)))) LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR)/,$(notdir $(LIBSOURCES))))
EXTRADEPS := EXTRADEPS :=
# rule for sources from tools dir # rule for sources from tools dir
$(OUT)/%.o: $(TOOLSDIR)/%.c $(OUT) $(OBJDIR)/%.o: $(TOOLSDIR)/%.c
@echo CC $< @echo CC $<
$(SILENT)mkdir -p $(dir $@)
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $< $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
$(OUT)/%.o: %.c $(OUT) $(OBJDIR)/%.o: %.c
@echo CC $< @echo CC $<
$(SILENT)mkdir -p $(dir $@)
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $< $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
libmktccboot$(RBARCH).a: $(LIBOBJS) libmktccboot$(RBARCH).a: $(TARGET_DIR)libmktccboot$(RBARCH).a
@echo AR $@
$(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^ $(TARGET_DIR)libmktccboot$(RBARCH).a: $(LIBOBJS)
@echo AR $(notdir $@)
$(SILENT)$(AR) rucs $@ $^
# building the standalone executable # building the standalone executable
$(OUTPUT): $(OBJS) $(EXTRADEPS) $(OUTPUT): $(OBJS) $(EXTRADEPS)
@ -70,16 +75,16 @@ $(TARGET_DIR)libmktccbooti386.a:
$(TARGET_DIR)libmktccbootppc.a: $(TARGET_DIR)libmktccbootppc.a:
make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmktccbootppc.a make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmktccbootppc.a
endif endif
libmktccboot-universal: $(TARGET_DIR)libmktccbooti386.a $(TARGET_DIR)libmktccbootppc.a libmktccboot-universal: $(TARGET_DIR)libmktccbooti386.a $(TARGET_DIR)libmktccbootppc.a
@echo lipo $(TARGET_DIR)libmktccboot.a @echo lipo $(TARGET_DIR)libmktccboot.a
$(SILENT) rm -f $(TARGET_DIR)libmktccboot.a $(SILENT) rm -f $(TARGET_DIR)libmktccboot.a
$(SILENT)lipo -create $(TARGET_DIR)libmktccbootppc.a $(TARGET_DIR)libmktccbooti386.a -output $(TARGET_DIR)libmktccboot.a $(SILENT)lipo -create $(TARGET_DIR)libmktccbootppc.a $(TARGET_DIR)libmktccbooti386.a -output $(TARGET_DIR)libmktccboot.a
clean: clean:
rm -f $(OUTPUT) $(TARGET_DIR)libmktccboot*.a mktccboot.dmg rm -f $(OUTPUT) $(TARGET_DIR)libmktccboot*.a mktccboot.dmg
rm -rf $(OUT) rm -rf $(OBJDIR)
mktccboot-i386: mktccboot-i386:
$(MAKE) RBARCH=i386 $(MAKE) RBARCH=i386
@ -96,8 +101,5 @@ mktccboot.dmg: mktccboot-mac
mkdir -p mktccboot-dmg mkdir -p mktccboot-dmg
cp -p mktccboot-mac mktccboot-dmg cp -p mktccboot-mac mktccboot-dmg
hdiutil create -srcfolder mktccboot-dmg mktccboot.dmg hdiutil create -srcfolder mktccboot-dmg mktccboot.dmg
$(OUT):
@echo MKDIR $(OUT)
$(SILENT)mkdir $(OUT)

View file

@ -70,25 +70,25 @@ mac {
# here. This assumes that QMAKE_CC will always be "gcc", maybe with a postfix. # here. This assumes that QMAKE_CC will always be "gcc", maybe with a postfix.
MYAR = $$replace(QMAKE_CC,gcc.*,ar) MYAR = $$replace(QMAKE_CC,gcc.*,ar)
rbspeex.commands = @$(MAKE) \ rbspeex.commands = @$(MAKE) -s \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \
librbspeex$$RBLIBPOSTFIX \ librbspeex$$RBLIBPOSTFIX \
SYS_SPEEX=\"$$LIBSPEEX\" \ SYS_SPEEX=\"$$LIBSPEEX\" \
CC=\"$$QMAKE_CC\" AR=\"$$MYAR\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libucl.commands = @$(MAKE) \ libucl.commands = @$(MAKE) -s \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/ucl/src \
libucl$$RBLIBPOSTFIX \ libucl$$RBLIBPOSTFIX \
CC=\"$$QMAKE_CC\" AR=\"$$MYAR\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libmkamsboot.commands = @$(MAKE) \ libmkamsboot.commands = @$(MAKE) -s \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkamsboot \
APPVERSION=\"rbutil\" \ APPVERSION=\"rbutil\" \
libmkamsboot$$RBLIBPOSTFIX \ libmkamsboot$$RBLIBPOSTFIX \
CC=\"$$QMAKE_CC\" AR=\"$$MYAR\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libmktccboot.commands = @$(MAKE) \ libmktccboot.commands = @$(MAKE) -s \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot \
libmktccboot$$RBLIBPOSTFIX \ libmktccboot$$RBLIBPOSTFIX \
CC=\"$$QMAKE_CC\" AR=\"$$MYAR\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libmkmpioboot.commands = @$(MAKE) \ libmkmpioboot.commands = @$(MAKE) -s \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkmpioboot \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkmpioboot \
APPVERSION=\"rbutil\" \ APPVERSION=\"rbutil\" \
libmkmpioboot$$RBLIBPOSTFIX \ libmkmpioboot$$RBLIBPOSTFIX \

View file

@ -17,25 +17,29 @@ CFLAGS += -arch $(RBARCH)
endif endif
OUT = $(TARGET_DIR)build$(RBARCH) TARGET_DIR ?= $(shell pwd)
OBJDIR = $(TARGET_DIR)build$(RBARCH)
SOURCES = alloc.c io.c n2b_99.c n2b_d.c n2b_ds.c n2b_to.c n2d_99.c \ SOURCES = alloc.c io.c n2b_99.c n2b_d.c n2b_ds.c n2b_to.c n2d_99.c \
n2d_d.c n2d_ds.c n2d_to.c n2e_99.c n2e_d.c n2e_ds.c n2e_to.c ucl_crc.c \ n2d_d.c n2d_ds.c n2d_to.c n2e_99.c n2e_d.c n2e_ds.c n2e_to.c ucl_crc.c \
ucl_init.c ucl_ptr.c ucl_str.c ucl_util.c #ucl_dll.c ucl_init.c ucl_ptr.c ucl_str.c ucl_util.c #ucl_dll.c
OBJS = $(addprefix $(OUT)/,$(SOURCES:%.c=%.o)) OBJS = $(addprefix $(OBJDIR)/,$(SOURCES:%.c=%.o))
# This Makefile is _not_ used to build uclpack for Rockbox builds anymore (they # This Makefile is _not_ used to build uclpack for Rockbox builds anymore (they
# use tools.make), so we can use $(CC) and $(AR) here. # use tools.make), so we can use $(CC) and $(AR) here.
libucl$(RBARCH).a: $(OUT) $(OBJS) libucl$(RBARCH).a: $(TARGET_DIR)libucl$(RBARCH).a
@echo AR $@
$(SILENT)$(AR) rucs $(TARGET_DIR)$@ $(OBJS) >/dev/null 2>&1
$(OUT)/%.o: %.c $(TARGET_DIR)libucl$(RBARCH).a: $(OBJS)
@echo AR $(notdir $@)
$(SILENT)$(AR) rucs $@ $(OBJS) >/dev/null 2>&1
$(OBJDIR)/%.o: %.c
@echo CC $< @echo CC $<
$(SILENT)mkdir -p $(dir $@)
$(SILENT)$(CC) $(CFLAGS) -c $< -o $@ $(SILENT)$(CC) $(CFLAGS) -c $< -o $@
# some trickery to build ppc and i386 from a single call # some trickery to build ppc and i386 from a single call
ifeq ($(RBARCH),) ifeq ($(RBARCH),)
$(TARGET_DIR)libucli386.a: $(TARGET_DIR)libucli386.a:
@ -43,18 +47,14 @@ $(TARGET_DIR)libucli386.a:
$(TARGET_DIR)libuclppc.a: $(TARGET_DIR)libuclppc.a:
make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libuclppc.a make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libuclppc.a
endif endif
libucl-universal: $(TARGET_DIR)libucli386.a $(TARGET_DIR)libuclppc.a libucl-universal: $(TARGET_DIR)libucli386.a $(TARGET_DIR)libuclppc.a
@echo lipo $(TARGET_DIR)libucl.a @echo lipo $(TARGET_DIR)libucl.a
$(SILENT) rm -f $(TARGET_DIR)libucl.a $(SILENT) rm -f $(TARGET_DIR)libucl.a
$(SILENT)lipo -create $(TARGET_DIR)libuclppc.a $(TARGET_DIR)libucli386.a -output $(TARGET_DIR)libucl.a $(SILENT)lipo -create $(TARGET_DIR)libuclppc.a $(TARGET_DIR)libucli386.a -output $(TARGET_DIR)libucl.a
clean: clean:
rm -f $(TARGET_DIR)libucl*.a rm -f $(TARGET_DIR)libucl*.a
rm -rf build* rm -rf build*
$(OUT):
@echo MKDIR $(OUT)
$(SILENT)mkdir -p $(OUT)