summaryrefslogtreecommitdiffstats
path: root/rbutil/mkimxboot
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-14 22:00:47 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-14 22:00:47 +0000
commitb52a9cc976f07e656b1cb8aa2a5a43f2600b3502 (patch)
treeb11e1ead9e2e6ad6b2e695a9ac0303d9d0d63841 /rbutil/mkimxboot
parent0d4af186c70e4ce22d4dbfb795602fd0ddc9fa8f (diff)
downloadrockbox-b52a9cc976f07e656b1cb8aa2a5a43f2600b3502.tar.gz
rockbox-b52a9cc976f07e656b1cb8aa2a5a43f2600b3502.zip
mkimxboot: use common Makefile.
Change mkimxboot to use the common Makefile. This will fix the object file clash when building libmkimxboot for linking with Rockbox Utility (will be needed for FS#12402). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31261 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/mkimxboot')
-rw-r--r--rbutil/mkimxboot/Makefile103
1 files changed, 12 insertions, 91 deletions
diff --git a/rbutil/mkimxboot/Makefile b/rbutil/mkimxboot/Makefile
index 08cd887fce..2293d3939a 100644
--- a/rbutil/mkimxboot/Makefile
+++ b/rbutil/mkimxboot/Makefile
@@ -5,108 +5,29 @@
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
-#change for releases
-ifndef APPVERSION
-APPVERSION=$(shell ../../tools/version.sh ../../)
-endif
-TARGET_DIR ?= $(shell pwd)/
# We use the SB code available in the Rockbox utils/sbtools directory
IMXTOOLS_DIR=../../utils/imxtools/
-CFLAGS=-I$(IMXTOOLS_DIR) -Wall -DVERSION=\"$(APPVERSION)\"
-
-ifndef V
-SILENT = @
-endif
-
-ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
-OUTPUT=mkimxboot.exe
-CFLAGS+=-mno-cygwin
-else
-ifeq ($(findstring MINGW,$(shell uname)),MINGW)
-OUTPUT=mkimxboot.exe
-else
-ifeq ($(findstring mingw,$(CC)),mingw)
-OUTPUT=mkimxboot.exe
-else
-OUTPUT=mkimxboot
-endif
-endif
-endif
-
-ifdef RBARCH
-CFLAGS += -arch $(RBARCH)
-OBJDIR = $(TARGET_DIR)build/$(RBARCH)/
-else
-OBJDIR = $(TARGET_DIR)build/
-endif
-
+CFLAGS = -I$(IMXTOOLS_DIR) -Wall
CFLAGS += -std=c99
-all: $(OUTPUT)
+OUTPUT = mkimxboot
-# inputs
-LIBIMXSOURCES=misc.c sb.c crypto.c crc.c aes128.c sha1.c
-LIBSOURCES := dualboot.c mkimxboot.c md5.c $(LIBIMXSOURCES)
+# inputs for lib
+IMXTOOLS_SOURCES = misc.c sb.c crypto.c crc.c aes128.c sha1.c
+LIBSOURCES := dualboot.c mkimxboot.c md5.c \
+ $(addprefix $(IMXTOOLS_DIR),$(IMXTOOLS_SOURCES))
+# inputs for binary only
SOURCES := $(LIBSOURCES) main.c
-OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
-LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES)))
-EXTRADEPS :=
+# dependencies for binary
+EXTRADEPS :=
+
+include ../libtools.make
# explicit dependencies on dualboot.{c,h} and mkimxboot.h
$(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h
$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h
-$(OBJDIR)%.o: %.c
- @echo CC $<
- $(SILENT)mkdir -p $(dir $@)
- $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
-
$(OBJDIR)%.o: $(IMXTOOLS_DIR)%.c
@echo CC $<
$(SILENT)mkdir -p $(dir $@)
- $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
-
-libmkimxboot$(RBARCH).a: $(TARGET_DIR)libmkimxboot$(RBARCH).a
-
-$(TARGET_DIR)libmkimxboot$(RBARCH).a: $(LIBOBJS)
- @echo AR $(notdir $@)
- $(SILENT)$(AR) rucs $@ $^
-
-# building the standalone executable
-$(OUTPUT): $(OBJS) $(EXTRADEPS)
- @echo LD $@
- $(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(EXTRADEPS)
-
-# some trickery to build ppc and i386 from a single call
-ifeq ($(RBARCH),)
-$(TARGET_DIR)libmkimxbooti386.a:
- make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libmkimxbooti386.a
-
-$(TARGET_DIR)libmkimxbootppc.a:
- make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkimxbootppc.a
-endif
-
-libmkimxboot-universal: $(TARGET_DIR)libmkimxbooti386.a $(TARGET_DIR)libmkimxbootppc.a
- @echo lipo $(TARGET_DIR)libmkimxboot.a
- $(SILENT) rm -f $(TARGET_DIR)libmkimxboot.a
- $(SILENT)lipo -create $(TARGET_DIR)libmkimxbootppc.a $(TARGET_DIR)libmkimxbooti386.a -output $(TARGET_DIR)libmkimxboot.a
-
-clean:
- rm -f $(OBJS) $(OUTPUT) libmkimxboot.o $(TARGET_DIR)libmkimxboot*.a mkimxboot.dmg
- rm -rf mkimxboot-* i386 ppc $(OBJDIR)
-
-mkimxboot-i386:
- $(MAKE) RBARCH=i386
- mv mkimxboot mkimxboot-i386
-
-mkimxboot-ppc:
- $(MAKE) RBARCH=ppc
- mv mkimxboot mkimxboot-ppc
-
-mkimxboot-mac: mkimxboot-i386 mkimxboot-ppc
- $(SILENT)lipo -create mkimxboot-ppc mkimxboot-i386 -output mkimxboot-mac
-
-mkimxboot.dmg: mkimxboot-mac
- mkdir -p mkimxboot-dmg
- cp -p mkimxboot-mac mkimxboot-dmg
- hdiutil create -srcfolder mkimxboot-dmg mkimxboot.dmg
+ $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c -o $@ $<