diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile index 3b4cc11404..8f4953a9e3 100644 --- a/rbutil/mkamsboot/Makefile +++ b/rbutil/mkamsboot/Makefile @@ -25,18 +25,17 @@ endif endif endif -CC?= gcc ifdef RBARCH CFLAGS += -arch $(RBARCH) endif -OUT = build$(RBARCH) +OUT = $(TARGET_DIR)build$(RBARCH) all: $(OUTPUT) $(LIBUCL): - make -C ../../tools/ucl/src libucl.a + make -C ../../tools/ucl/src $(TARGET_DIR)libucl.a # This file can be generated in the dualboot/ directory $(OUT)/dualboot.o: dualboot.c @@ -55,27 +54,27 @@ $(OUT)/libmkamsboot.o: mkamsboot.c dualboot.h md5.h $(CC) $(CFLAGS) -DLIB -c -o $(OUT)/libmkamsboot.o -W -Wall mkamsboot.c libmkamsboot$(RBARCH).a: $(OUT) $(OUT)/libmkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o - $(AR) ru libmkamsboot$(RBARCH).a $(OUT)/libmkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o + $(AR) ru $(TARGET_DIR)libmkamsboot$(RBARCH).a $(OUT)/libmkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o # some trickery to build ppc and i386 from a single call ifeq ($(RBARCH),) libmkamsbooti386.a: - make RBARCH=i386 libmkamsbooti386.a + make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libmkamsbooti386.a libmkamsbootppc.a: - make RBARCH=ppc libmkamsbootppc.a + make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkamsbootppc.a endif libmkamsboot-universal: libmkamsbooti386.a libmkamsbootppc.a - @echo lipo libmkamsboot.a - $(SILENT) rm -f libmkamsboot.a - lipo -create libmkamsbootppc.a libmkamsbooti386.a -output libmkamsboot.a + @echo lipo $(TARGET_DIR)libmkamsboot.a + $(SILENT) rm -f $(TARGET_DIR)libmkamsboot.a + lipo -create $(TARGET_DIR)libmkamsbootppc.a $(TARGET_DIR)libmkamsbooti386.a -output $(TARGET_DIR)libmkamsboot.a clean: - rm -f $(OUTPUT) libmkamsboot.o libmkamsboot*.a + rm -f $(OUTPUT) libmkamsboot.o $(TARGET_DIR)libmkamsboot*.a rm -rf build* -build$(RBARCH): - @echo MKDIR build$(RBARCH) - $(SILENT)mkdir build$(RBARCH) +$(OUT): + @echo MKDIR $(OUT) + $(SILENT)mkdir $(OUT) diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index 78c399ebd7..cdae11dc5c 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro @@ -1,3 +1,6 @@ + + +# ccache unix:!mac { CCACHE = $$system(which ccache) !isEmpty(CCACHE) { @@ -7,10 +10,10 @@ unix:!mac { } } -OBJECTS_DIR = build/o -UI_DIR = build/ui -MOC_DIR = build/moc -RCC_DIR = build/rcc +OBJECTS_DIR = $$OUT_PWD/build/o +UI_DIR = $$OUT_PWD/build/ui +MOC_DIR = $$OUT_PWD/build/moc +RCC_DIR = $$OUT_PWD/build/rcc # check version of Qt installation VER = $$find(QT_VERSION, ^4\.[3-9]+.*) @@ -20,12 +23,17 @@ isEmpty(VER) { } message("Qt version used:" $$VER) +RBBASE_DIR = $$_PRO_FILE_PWD_ +RBBASE_DIR = $$replace(RBBASE_DIR,/rbutil/rbutilqt,) + +message("Rockbox Base dir: "$$RBBASE_DIR) + # add a custom rule for pre-building librbspeex !mac { -rbspeex.commands = @$(MAKE) -C ../../tools/rbspeex librbspeex.a +rbspeex.commands = @$(MAKE) TARGET_DIR=$$OUT_PWD/ -C $$RBBASE_DIR/tools/rbspeex librbspeex.a } mac { -rbspeex.commands = @$(MAKE) -C ../../tools/rbspeex librbspeex-universal +rbspeex.commands = @$(MAKE) TARGET_DIR=$$OUT_PWD/ -C $$RBBASE_DIR/tools/rbspeex librbspeex-universal } QMAKE_EXTRA_TARGETS += rbspeex PRE_TARGETDEPS += rbspeex @@ -36,7 +44,7 @@ tags.depends = $(SOURCES) QMAKE_EXTRA_TARGETS += tags # add a custom rule for making the translations -lrelease.commands = $$[QT_INSTALL_BINS]/lrelease -silent rbutilqt.pro +lrelease.commands = $$[QT_INSTALL_BINS]/lrelease -silent $$_PRO_FILE_ QMAKE_EXTRA_TARGETS += lrelease !dbg { PRE_TARGETDEPS += lrelease @@ -44,20 +52,20 @@ QMAKE_EXTRA_TARGETS += lrelease #custom rules for libucl.a !mac { -libucl.commands = @$(MAKE) -C ../../tools/ucl/src libucl.a +libucl.commands = @$(MAKE) TARGET_DIR=$$OUT_PWD/ -C $$RBBASE_DIR/tools/ucl/src libucl.a } mac { -libucl.commands = @$(MAKE) -C ../../tools/ucl/src libucl-universal +libucl.commands = @$(MAKE) TARGET_DIR=$$OUT_PWD/ -C $$RBBASE_DIR/tools/ucl/src libucl-universal } QMAKE_EXTRA_TARGETS += libucl PRE_TARGETDEPS += libucl #custom rules for libmkamsboot.a !mac { -libmkamsboot.commands = @$(MAKE) -C ../mkamsboot libmkamsboot.a +libmkamsboot.commands = @$(MAKE) TARGET_DIR=$$OUT_PWD/ -C $$RBBASE_DIR/rbutil/mkamsboot libmkamsboot.a } mac { -libmkamsboot.commands = @$(MAKE) -C ../mkamsboot libmkamsboot-universal +libmkamsboot.commands = @$(MAKE) TARGET_DIR=$$OUT_PWD/ -C $$RBBASE_DIR/rbutil/mkamsboot libmkamsboot-universal } QMAKE_EXTRA_TARGETS += libmkamsboot PRE_TARGETDEPS += libmkamsboot @@ -167,10 +175,10 @@ HEADERS += rbutilqt.h \ ../../tools/iriver.h # Needed by QT on Win -INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools -INCLUDEPATH += base +INCLUDEPATH = $$_PRO_FILE_PWD_ $$_PRO_FILE_PWD_/irivertools $$_PRO_FILE_PWD_/zip $$_PRO_FILE_PWD_/zlib $$_PRO_FILE_PWD_/base +INCLUDEPATH += $$RBBASE_DIR/rbutil/ipodpatcher $$RBBASE_DIR/rbutil/sansapatcher $$RBBASE_DIR/tools/rbspeex $$RBBASE_DIR/tools -LIBS += -L../../tools/rbspeex -lrbspeex -L../mkamsboot -lmkamsboot -L../../tools/ucl/src/ -lucl +LIBS += -L$$OUT_PWD -lrbspeex -lmkamsboot -lucl TEMPLATE = app dbg { @@ -201,12 +209,12 @@ FORMS += rbutilqtfrm.ui \ sysinfofrm.ui \ systracefrm.ui -RESOURCES += rbutilqt.qrc +RESOURCES += $$_PRO_FILE_PWD_/rbutilqt.qrc win32 { - RESOURCES += rbutilqt-win.qrc + RESOURCES += $$_PRO_FILE_PWD_/rbutilqt-win.qrc } !dbg { - RESOURCES += rbutilqt-lang.qrc + RESOURCES += $$_PRO_FILE_PWD_/rbutilqt-lang.qrc } TRANSLATIONS += lang/rbutil_de.ts \ diff --git a/tools/rbspeex/Makefile b/tools/rbspeex/Makefile index a82e80e017..41bf775d38 100644 --- a/tools/rbspeex/Makefile +++ b/tools/rbspeex/Makefile @@ -35,7 +35,7 @@ endif # This sets up 'SRC' based on the files mentioned in SOURCES SRC := $(shell cat $(SPEEXSRC)/SOURCES | $(CC) $(CFLAGS) -E -P - | grep -v "^\#" | grep -v "^$$") -OUT = build$(RBARCH) +OUT = $(TARGET_DIR)build$(RBARCH) SOURCES = $(SRC:%.c=$(SPEEXSRC)/%.c) rbspeex.c rbspeexenc.c rbspeexdec.c OBJS = $(addprefix $(OUT)/,$(SRC:%.c=%.o)) DEPFILE = $(OUT)/dep-speex @@ -46,8 +46,8 @@ DIRS = all: ../rbspeexenc ../rbspeexdec $(DEPFILE): $(SOURCES) - @echo MKDIR build$(RBARCH) - $(SILENT)mkdir -p build$(RBARCH) + @echo MKDIR $(OUT) + $(SILENT)mkdir -p $(OUT) @echo Creating dependencies $(SILENT)rm -f $(DEPFILE) $(SILENT)(for each in $(SOURCES) x; do \ @@ -69,7 +69,7 @@ $(OUT)/librbspeex.a: $(OBJS) $(DEPFILE) $(OUT)/rbspeex.o $(SILENT)$(AR) ruv $@ $+ > /dev/null 2>&1 librbspeex$(RBARCH).a: $(OUT)/librbspeex.a - $(SILENT)cp $(OUT)/librbspeex.a librbspeex$(RBARCH).a + $(SILENT)cp $(OUT)/librbspeex.a $(TARGET_DIR)librbspeex$(RBARCH).a ../rbspeexenc: $(OBJS) $(OUT)/rbspeexenc.o librbspeex$(RBARCH).a @echo Linking ../rbspeexenc @@ -86,22 +86,22 @@ librbspeex$(RBARCH).a: $(OUT)/librbspeex.a # some trickery to build ppc and i386 from a single call ifeq ($(RBARCH),) librbspeexi386.a: - make RBARCH=i386 librbspeexi386.a + make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) librbspeexi386.a librbspeexppc.a: - make RBARCH=ppc librbspeexppc.a + make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) librbspeexppc.a endif librbspeex-universal: librbspeexi386.a librbspeexppc.a @echo lipo librbspeex.a - $(SILENT) rm -f librbspeex.a - lipo -create librbspeexppc.a librbspeexi386.a -output librbspeex.a + $(SILENT) rm -f $(TARGET_DIR)librbspeex.a + lipo -create $(TARGET_DIR)librbspeexppc.a $(TARGET_DIR)librbspeexi386.a -output $(TARGET_DIR)librbspeex.a clean: - rm -f $(OBJS) librbspeex* ../rbspeexenc ../rbspeexdec dep-speex + rm -f $(OBJS) $(TARGET_DIR)librbspeex* ../rbspeexenc ../rbspeexdec $(TARGET_DIR)dep-speex rm -rf build* -build$(RBARCH): - @echo MKDIR build$(RBARCH) - $(SILENT)mkdir build$(RBARCH) +$(OUT): + @echo MKDIR $(OUT) + $(SILENT)mkdir $(OUT) diff --git a/tools/ucl/src/Makefile b/tools/ucl/src/Makefile index b4b841a4f1..147959aaa1 100644 --- a/tools/ucl/src/Makefile +++ b/tools/ucl/src/Makefile @@ -17,7 +17,8 @@ ifdef RBARCH CFLAGS += -arch $(RBARCH) endif -OUT = build$(RBARCH) + +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 \ n2d_d.c n2d_ds.c n2d_to.c n2e_99.c n2e_d.c n2e_ds.c n2e_to.c ucl_crc.c \ @@ -30,8 +31,8 @@ OBJS = $(OUT)/alloc.o $(OUT)/io.o $(OUT)/n2b_99.o $(OUT)/n2b_d.o $(OUT)/n2b_ds.o # we don't use $(AR) and $(RANLIB) below since we want the _native_ tools # not the cross-compiler tools libucl$(RBARCH).a: $(OUT) $(OBJS) - $(SILENT)ar ruv $@ $(OBJS) >/dev/null 2>&1 - $(SILENT)ranlib $@ + $(SILENT)ar ruv $(TARGET_DIR)$@ $(OBJS) >/dev/null 2>&1 + $(SILENT)ranlib $(TARGET_DIR)$@ $(OUT)/%.o: %.c @echo CC $< @@ -40,22 +41,22 @@ $(OUT)/%.o: %.c # some trickery to build ppc and i386 from a single call ifeq ($(RBARCH),) libucli386.a: - make RBARCH=i386 libucli386.a + make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libucli386.a libuclppc.a: - make RBARCH=ppc libuclppc.a + make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libuclppc.a endif libucl-universal: libucli386.a libuclppc.a - @echo lipo libucl.a - $(SILENT) rm -f libucl.a - lipo -create libuclppc.a libucli386.a -output libucl.a + @echo lipo $(TARGET_DIR)libucl.a + $(SILENT) rm -f $(TARGET_DIR)libucl.a + lipo -create $(TARGET_DIR)libuclppc.a $(TARGET_DIR)libucli386.a -output $(TARGET_DIR)libucl.a clean: - rm -f libucl*.a + rm -f $(TARGET_DIR)libucl*.a rm -rf build* -build$(RBARCH): - @echo MKDIR build$(RBARCH) - $(SILENT)mkdir build$(RBARCH) +$(OUT): + @echo MKDIR $(OUT) + $(SILENT)mkdir $(OUT)