diff --git a/rbutil/chinachippatcher/Makefile b/rbutil/chinachippatcher/Makefile index cdce19814d..c8defcb5c4 100644 --- a/rbutil/chinachippatcher/Makefile +++ b/rbutil/chinachippatcher/Makefile @@ -11,7 +11,7 @@ CFLAGS += -g -Wall OUTPUT = chinachippatcher LIBSOURCES = chinachip.c -SOURCES = $(LIBSOURCES) main.c +SOURCES = main.c include ../libtools.make diff --git a/rbutil/ipodpatcher/Makefile b/rbutil/ipodpatcher/Makefile index 382423b4f2..4254995d22 100644 --- a/rbutil/ipodpatcher/Makefile +++ b/rbutil/ipodpatcher/Makefile @@ -32,7 +32,7 @@ LDOPTS_OSX = -framework CoreFoundation -framework IOKit LIBSOURCES = ipodpatcher.c fat32format.c arc4.c \ ipodio-posix.c ipodio-win32-scsi.c ipodio-win32.c -SOURCES = main.c $(BOOTSRC) $(LIBSOURCES) +SOURCES = main.c $(BOOTSRC) ipodpatcher: SOURCES+= ipodio-posix.c OUTPUT = ipodpatcher diff --git a/rbutil/libtools.make b/rbutil/libtools.make index 7a125f98ea..c107e69bfd 100644 --- a/rbutil/libtools.make +++ b/rbutil/libtools.make @@ -37,8 +37,6 @@ TARGET_DIR ?= $(abspath .)/ NATIVECC ?= gcc CC ?= gcc CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) -# use POSIX/C99 printf on windows -CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 BINARY = $(OUTPUT) # when building a Windows binary add the correct file suffix @@ -50,6 +48,8 @@ else ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW) BINARY = $(OUTPUT).exe COMPILETARGET = mingw +# use POSIX/C99 printf on windows +CFLAGS += -D__USE_MINGW_ANSI_STDIO=1 else ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE) COMPILETARGET = darwin @@ -79,16 +79,9 @@ CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 NATIVECC = gcc-4.0 endif endif -WINDRES = windres BUILD_DIR ?= $(TARGET_DIR)build$(COMPILETARGET) - -ifdef RBARCH -ARCHFLAGS += -arch $(RBARCH) -OBJDIR = $(abspath $(BUILD_DIR)/$(RBARCH))/ -else OBJDIR = $(abspath $(BUILD_DIR))/ -endif all: $(BINARY) @@ -103,20 +96,20 @@ DEPS = $(addprefix $(OBJDIR),$(subst .c,.d,$(notdir $(SOURCES) $(LIBSOURCES)))) # additional link dependencies for the standalone executable # extra dependencies: libucl -LIBUCL = libucl$(RBARCH).a +LIBUCL = libucl.a $(LIBUCL): $(OBJDIR)$(LIBUCL) $(OBJDIR)$(LIBUCL): $(SILENT)$(MAKE) -C $(TOP)/../tools/ucl/src TARGET_DIR=$(OBJDIR) $@ # building the standalone executable -$(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) +$(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(TARGET_DIR)lib$(OUTPUT).a @echo LD $@ $(SILENT)$(call mkdir,$(dir $@)) # EXTRADEPS need to be built into OBJDIR. $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -o $(BINARY) \ $(OBJS) $(addprefix $(OBJDIR),$(EXTRADEPS)) \ - $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) $(LDOPTS) + $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) lib$(OUTPUT).a $(addprefix $(OBJDIR),$(EXTRADEPS)) $(LDOPTS) # common rules $(OBJDIR)%.o: @@ -125,10 +118,10 @@ $(OBJDIR)%.o: $(SILENT)$(CROSS)$(CC) $(ARCHFLAGS) $(CFLAGS) -c -o $@ $< # lib rules -lib$(OUTPUT)$(RBARCH).a: $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a -lib$(OUTPUT)$(RBARCH): $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a +lib$(OUTPUT).a: $(TARGET_DIR)lib$(OUTPUT).a +lib$(OUTPUT): $(TARGET_DIR)lib$(OUTPUT).a -$(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a: $(LIBOBJS) \ +$(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) \ $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) # rules to build a DLL. Only works for W32 as target (i.e. MinGW toolchain) dll: $(OUTPUT).dll @@ -140,7 +133,7 @@ $(TARGET_DIR)$(OUTPUT).dll: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def # create lib file from objects -$(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) +$(TARGET_DIR)lib$(OUTPUT).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) @echo AR $(notdir $@) $(SILENT)$(call mkdir,$(dir $@)) $(SILENT)$(call rm,$@) diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile index 67fe91e51d..7100bd9512 100644 --- a/rbutil/mkamsboot/Makefile +++ b/rbutil/mkamsboot/Makefile @@ -9,11 +9,11 @@ CFLAGS += -I../../tools/ucl/include -Wall OUTPUT = mkamsboot -LIBUCL = libucl$(RBARCH).a +LIBUCL = libucl.a # inputs LIBSOURCES := dualboot.c md5.c mkamsboot.c -SOURCES := $(LIBSOURCES) main.c +SOURCES := main.c # additional link dependencies for the standalone executable EXTRADEPS := $(LIBUCL) diff --git a/rbutil/mkmpioboot/Makefile b/rbutil/mkmpioboot/Makefile index 0a42e39217..8aa2d37028 100644 --- a/rbutil/mkmpioboot/Makefile +++ b/rbutil/mkmpioboot/Makefile @@ -13,7 +13,7 @@ OUTPUT = mkmpioboot # inputs LIBSOURCES = mkmpioboot.c -SOURCES = $(LIBSOURCES) main.c +SOURCES = main.c EXTRADEPS = $(LIBUCL) include ../libtools.make diff --git a/rbutil/mktccboot/Makefile b/rbutil/mktccboot/Makefile index df49c6977d..4943a8c568 100644 --- a/rbutil/mktccboot/Makefile +++ b/rbutil/mktccboot/Makefile @@ -16,7 +16,7 @@ OUTPUT = mktccboot # inputs LIBSOURCES := mktccboot.c $(TOOLSDIR)telechips.c -SOURCES := $(LIBSOURCES) main.c +SOURCES := main.c EXTRADEPS := include ../libtools.make diff --git a/rbutil/mkzenboot/Makefile b/rbutil/mkzenboot/Makefile index 019b8a669f..ebc7a1670a 100644 --- a/rbutil/mkzenboot/Makefile +++ b/rbutil/mkzenboot/Makefile @@ -19,7 +19,7 @@ LIBSOURCES := dualboot.c mkzenboot.c md5.c utils.c \ $(addprefix $(TOOLS_DIR),$(TOOLS_SOURCES)) # inputs for binary only -SOURCES := $(LIBSOURCES) main.c +SOURCES := main.c # dependencies for binary EXTRADEPS := diff --git a/rbutil/sansapatcher/Makefile b/rbutil/sansapatcher/Makefile index 08af2bb6c8..85c36c6d14 100644 --- a/rbutil/sansapatcher/Makefile +++ b/rbutil/sansapatcher/Makefile @@ -12,7 +12,7 @@ OUTPUT = sansapatcher # inputs LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c -SOURCES := $(LIBSOURCES) main.c +SOURCES := main.c # additional link dependencies for the standalone executable EXTRADEPS :=