Tweak Makefiles a bit to allow cross compiling Rockbox Utility.

- pass AR to the lib Makefiles to make sure the correct one gets used.
- create an archive index for archives.
- simplify ucl Makefile a bit.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28883 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2010-12-23 18:59:58 +00:00
parent 7f6c271bad
commit e1b1183f40
6 changed files with 24 additions and 24 deletions

View file

@ -60,7 +60,7 @@ $(OBJDIR)%.o: %.c
libmkamsboot$(RBARCH).a: $(LIBOBJS) libmkamsboot$(RBARCH).a: $(LIBOBJS)
@echo AR $@ @echo AR $@
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ $(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^
# building the standalone executable # building the standalone executable
$(OUTPUT): $(OBJS) $(EXTRADEPS) $(OUTPUT): $(OBJS) $(EXTRADEPS)

View file

@ -54,7 +54,7 @@ $(OBJDIR)%.o: %.c
libmkmpioboot$(RBARCH).a: $(LIBOBJS) libmkmpioboot$(RBARCH).a: $(LIBOBJS)
@echo AR $@ @echo AR $@
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ $(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^
# building the standalone executable # building the standalone executable
$(OUTPUT): $(OBJS) $(EXTRADEPS) $(OUTPUT): $(OBJS) $(EXTRADEPS)

View file

@ -56,7 +56,7 @@ $(OUT)/%.o: %.c $(OUT)
libmktccboot$(RBARCH).a: $(LIBOBJS) libmktccboot$(RBARCH).a: $(LIBOBJS)
@echo AR $@ @echo AR $@
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ $(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^
# building the standalone executable # building the standalone executable
$(OUTPUT): $(OBJS) $(EXTRADEPS) $(OUTPUT): $(OBJS) $(EXTRADEPS)

View file

@ -64,30 +64,35 @@ mac {
!static:unix:!mac { !static:unix:!mac {
LIBSPEEX = $$system(pkg-config --silence-errors --libs speex speexdsp) LIBSPEEX = $$system(pkg-config --silence-errors --libs speex speexdsp)
} }
# The external Makefiles use ar to create libs. To allow cross-compiling pass
# the ar that matches the current gcc. Since qmake doesn't provide a variable
# holding the correct ar without any additions we need to figure it ourselves
# here. This assumes that QMAKE_CC will always be "gcc", maybe with a postfix.
MYAR = $$replace(QMAKE_CC,gcc.*,ar)
rbspeex.commands = @$(MAKE) \ rbspeex.commands = @$(MAKE) \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/tools/rbspeex \
librbspeex$$RBLIBPOSTFIX \ librbspeex$$RBLIBPOSTFIX \
CC=\"$$QMAKE_CC\" \ SYS_SPEEX=\"$$LIBSPEEX\" \
SYS_SPEEX=\"$$LIBSPEEX\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libucl.commands = @$(MAKE) \ libucl.commands = @$(MAKE) \
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\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libmkamsboot.commands = @$(MAKE) \ libmkamsboot.commands = @$(MAKE) \
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\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libmktccboot.commands = @$(MAKE) \ libmktccboot.commands = @$(MAKE) \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mktccboot \
libmktccboot$$RBLIBPOSTFIX \ libmktccboot$$RBLIBPOSTFIX \
CC=\"$$QMAKE_CC\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
libmkmpioboot.commands = @$(MAKE) \ libmkmpioboot.commands = @$(MAKE) \
TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkmpioboot \ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/mkmpioboot \
APPVERSION=\"rbutil\" \ APPVERSION=\"rbutil\" \
libmkmpioboot$$RBLIBPOSTFIX \ libmkmpioboot$$RBLIBPOSTFIX \
CC=\"$$QMAKE_CC\" CC=\"$$QMAKE_CC\" AR=\"$$MYAR\"
QMAKE_EXTRA_TARGETS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot QMAKE_EXTRA_TARGETS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
PRE_TARGETDEPS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot PRE_TARGETDEPS += rbspeex libucl libmkamsboot libmktccboot libmkmpioboot
@ -111,7 +116,7 @@ INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher
DEPENDPATH = $$INCLUDEPATH DEPENDPATH = $$INCLUDEPATH
LIBS += -L$$OUT_PWD -L$$MYBUILDDIR -lrbspeex -lmkamsboot -lmktccboot -lmkmpioboot -lucl LIBS += -L$$OUT_PWD -L$$MYBUILDDIR -lrbspeex -lmkamsboot -lmktccboot -lmkmpioboot -lucl -lz
# Add a (possibly found) libspeex now, don't do this before -lrbspeex! # Add a (possibly found) libspeex now, don't do this before -lrbspeex!
!static:!isEmpty(LIBSPEEX) { !static:!isEmpty(LIBSPEEX) {
@ -152,10 +157,6 @@ unix:!static:libusb1:!macx {
DEFINES += LIBUSB1 DEFINES += LIBUSB1
LIBS += -lusb-1.0 LIBS += -lusb-1.0
} }
unix {
# explicitly link zlib, we do need it. Don't rely on implicit linking via Qt.
LIBS += -lz
}
unix:!macx:static { unix:!macx:static {
# force statically linking of libusb. Libraries that are appended # force statically linking of libusb. Libraries that are appended
@ -177,7 +178,7 @@ macx:intel {
} }
macx { macx {
CONFIG += x86 CONFIG += x86
LIBS += -L/usr/local/lib -lz \ LIBS += -L/usr/local/lib \
-framework IOKit -framework CoreFoundation -framework Carbon \ -framework IOKit -framework CoreFoundation -framework Carbon \
-framework SystemConfiguration -framework CoreServices -framework SystemConfiguration -framework CoreServices
INCLUDEPATH += /usr/local/include INCLUDEPATH += /usr/local/include

View file

@ -72,7 +72,7 @@ $(DEPFILE): $(SOURCES)
$(OUT)/librbspeex.a: $(OBJS) $(DEPFILE) $(OUT)/rbspeex.o $(OUT)/librbspeex.a: $(OBJS) $(DEPFILE) $(OUT)/rbspeex.o
@echo AR $(OUT)/librbspeex$(RBARCH).a @echo AR $(OUT)/librbspeex$(RBARCH).a
$(SILENT)$(AR) ruv $@ $+ > /dev/null 2>&1 $(SILENT)$(AR) rucs $@ $+ > /dev/null 2>&1
librbspeex$(RBARCH).a: $(OUT)/librbspeex.a librbspeex$(RBARCH).a: $(OUT)/librbspeex.a
$(SILENT)cp $(OUT)/librbspeex.a $(TARGET_DIR)librbspeex$(RBARCH).a $(SILENT)cp $(OUT)/librbspeex.a $(TARGET_DIR)librbspeex$(RBARCH).a

View file

@ -21,17 +21,16 @@ OUT = $(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_dll.c ucl_init.c ucl_ptr.c ucl_str.c ucl_util.c ucl_init.c ucl_ptr.c ucl_str.c ucl_util.c #ucl_dll.c
OBJS = $(OUT)/alloc.o $(OUT)/io.o $(OUT)/n2b_99.o $(OUT)/n2b_d.o $(OUT)/n2b_ds.o $(OUT)/n2b_to.o $(OUT)/n2d_99.o \ OBJS = $(addprefix $(OUT)/,$(SOURCES:%.c=%.o))
$(OUT)/n2d_d.o $(OUT)/n2d_ds.o $(OUT)/n2d_to.o $(OUT)/n2e_99.o $(OUT)/n2e_d.o $(OUT)/n2e_ds.o $(OUT)/n2e_to.o $(OUT)/ucl_crc.o \
$(OUT)/ucl_dll.o $(OUT)/ucl_init.o $(OUT)/ucl_ptr.o $(OUT)/ucl_str.o $(OUT)/ucl_util.o # This Makefile is _not_ used to build uclpack for Rockbox builds anymore (they
# use tools.make), so we can use $(CC) and $(AR) here.
# we don't use $(AR) and $(RANLIB) below since we want the _native_ tools
# not the cross-compiler tools
libucl$(RBARCH).a: $(OUT) $(OBJS) libucl$(RBARCH).a: $(OUT) $(OBJS)
$(SILENT)ar ruv $(TARGET_DIR)$@ $(OBJS) >/dev/null 2>&1 @echo AR $@
$(SILENT)ranlib $(TARGET_DIR)$@ $(SILENT)$(AR) rucs $(TARGET_DIR)$@ $(OBJS) >/dev/null 2>&1
$(OUT)/%.o: %.c $(OUT)/%.o: %.c
@echo CC $< @echo CC $<