From ea6178065c6df158db18793c72669393a37198e2 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Wed, 4 Nov 2009 20:58:40 +0000 Subject: Clean up mkamsboot building. No functional changes. - split out standalone functions to a separate file. - adjust and clean up Makefile. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23520 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/mkamsboot/Makefile | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'rbutil/mkamsboot/Makefile') diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile index 98a027ffb5..6cf74ee2b5 100644 --- a/rbutil/mkamsboot/Makefile +++ b/rbutil/mkamsboot/Makefile @@ -1,12 +1,13 @@ -# We use the UCL code available in the Rockbox tools/ directory -CFLAGS=-I../../tools/ucl/include -Wall -CC = gcc #change for releases ifndef APPVERSION APPVERSION=`../../tools/version.sh` endif +# We use the UCL code available in the Rockbox tools/ directory +CFLAGS=-I../../tools/ucl/include -Wall -DVERSION=\"$(APPVERSION)\" +CC = gcc + ifndef V SILENT = @ endif @@ -34,38 +35,36 @@ OUT = $(TARGET_DIR)build$(RBARCH) all: $(OUTPUT) -# Dependant modules +# additional link dependencies for the standalone executable LIBUCL=../../tools/ucl/src/libucl$(RBARCH).a $(LIBUCL): make -C ../../tools/ucl/src $(TARGET_DIR)libucl$(RBARCH).a -# This file can be generated in the dualboot/ directory -$(OUT)/dualboot.o: dualboot.[ch] - @echo CC $< - $(SILENT)$(CC) $(CFLAGS) -c -o $(OUT)/dualboot.o dualboot.c +# inputs +LIBSOURCES := dualboot.c md5.c mkamsboot.c +SOURCES := $(LIBSOURCES) main.c +OBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(SOURCES))) +LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(LIBSOURCES))) +EXTRADEPS := $(LIBUCL) -$(OUT)/md5.o: md5.[ch] - @echo CC $< - $(SILENT)$(CC) $(CFLAGS) -c -o $(OUT)/md5.o -W -Wall md5.c - -DEPENDANT_OBJS=$(LIBUCL) $(OUT)/dualboot.o $(OUT)/md5.o - -$(OUT)/mkamsboot.o: mkamsboot.[ch] $(DEPENDANT_OBJS) - @echo CC $< - $(SILENT)$(CC) $(CFLAGS) -c -o $(OUT)/mkamsboot.o -W -Wall mkamsboot.c -DVERSION=\"$(APPVERSION)\" - -$(OUTPUT): $(OUT) $(OUT)/mkamsboot.o - @echo CC $< - $(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OUT)/mkamsboot.o $(DEPENDANT_OBJS) +$(OUT)/%.o: %.c $(OUT) + @echo CC $< $ + $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< +# building the library archive $(OUT)/libmkamsboot.o: $(OUT)/mkamsboot.o @echo CC $< $(SILENT)$(CC) $(CFLAGS) -DLIB -c -o $(OUT)/libmkamsboot.o -W -Wall mkamsboot.c -libmkamsboot$(RBARCH).a: $(OUT) $(OUT)/libmkamsboot.o +libmkamsboot$(RBARCH).a: $(LIBOBJS) @echo AR $@ - $(SILENT)$(AR) ruc $(TARGET_DIR)libmkamsboot$(RBARCH).a $(OUT)/libmkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o + $(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^ + +# 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),) -- cgit v1.2.3