public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Sebastian Siewior <sebastian@breakpoint.cc>
To: Artem Bityutskiy <dedekind@infradead.org>
Cc: linux-mtd@lists.infradead.org
Subject: [RFC] mtd-utils: make cross build functional again
Date: Wed, 27 Aug 2008 00:07:05 +0200	[thread overview]
Message-ID: <20080826220705.GA4834@Chamillionaire.breakpoint.cc> (raw)

as of current HEAD "make CROSS=whatever-" breaks once we leave
the main Makefile.
With this patch everything builds except NTARGETS in ubi-utils and with
CROSS being undefined.

The problem with CROSS being undefined could be solved by setting
BUILDDIR explicit to "native" for instance.
The NTARGETS thing is a little tricky. The easiest solution would be
probably to move the NTARGETS targets into its own Makefile.

Anyway, is this something worth to fix since it is almost a year broken?
Should the BUILDDIR thing be removed or is it used?

Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc>
---
 Makefile            |    6 ++++--
 mkfs.ubifs/Makefile |    6 ++++--
 ubi-utils/Makefile  |   26 ++++++++++++++------------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 796c31b..d54e170 100644
--- a/Makefile
+++ b/Makefile
@@ -47,8 +47,10 @@ $(BUILDDIR)/%.o: %.c
 .SUFFIXES:
 
 all: $(TARGETS)
-	$(MAKE) -C $(BUILDDIR)/ubi-utils
-	$(MAKE) -C $(BUILDDIR)/mkfs.ubifs
+	mkdir -p $(BUILDDIR)/ubi-utils
+	mkdir -p $(BUILDDIR)/mkfs.ubifs
+	$(MAKE) -C ubi-utils BUILDDIR=../$(BUILDDIR)/ubi-utils
+	$(MAKE) -C mkfs.ubifs BUILDDIR=../$(BUILDDIR)/mkfs.ubifs
 
 IGNORE=${wildcard $(BUILDDIR)/.*.c.dep}
 -include ${IGNORE}
diff --git a/mkfs.ubifs/Makefile b/mkfs.ubifs/Makefile
index a327eee..81ef429 100644
--- a/mkfs.ubifs/Makefile
+++ b/mkfs.ubifs/Makefile
@@ -3,11 +3,13 @@ SBINDIR=/usr/sbin
 ALL_SOURCES=*.[ch] hashtable/*.[ch]
 CFLAGS += -Wall
 LDLIBS += -lz -llzo2 -lm -luuid
-TARGETS = mkfs.ubifs
+RAWTARGETS = mkfs.ubifs
+
+TARGETS = $(foreach target,$(RAWTARGETS),$(BUILDDIR)/$(target))
 
 all: $(TARGETS)
 
-mkfs.ubifs: crc16.o crc32.o lpt.o compr.o hashtable/hashtable.o \
+$(BUILDDIR)/mkfs.ubifs: crc16.o crc32.o lpt.o compr.o hashtable/hashtable.o \
             hashtable/hashtable_itr.o devtable.o
 
 clean:
diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile
index 4cca316..bdcd444 100644
--- a/ubi-utils/Makefile
+++ b/ubi-utils/Makefile
@@ -18,16 +18,18 @@ PERLPROGS = mkpfi ubicrc32.pl
 
 NTARGETS = ubiattach ubicrc32 ubidetach ubimkvol ubinfo ubinize \
 	ubirmvol ubiupdatevol ubiformat
-TARGETS = pfiflash pddcustomize ubimirror bin2nand nand2bin ubigen \
+RAWTARGETS = pfiflash pddcustomize ubimirror bin2nand nand2bin ubigen \
 	mkbootenv unubi pfi2bin $(NTARGETS)
 
+TARGETS = $(foreach target,$(RAWTARGETS),$(BUILDDIR)/$(target))
+
 vpath   %.c ./src
 
 %: %.o
 	$(CC) $(LDFLAGS) -g -o $@ $^
 
-%.o: %.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep
+$(BUILDDIR)/%.o: %.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -g -Wp,-MD,$(BUILDDIR)/.$(shell basename $<).dep
 
 all: $(TARGETS)
 
@@ -42,34 +44,34 @@ clean:
 	rm -rf *.o $(TARGETS) .*.c.dep
 	$(MAKE) -C new-utils clean
 
-pddcustomize: pddcustomize.o error.o libubimirror.o bootenv.o hashmap.o \
+$(BUILDDIR)/pddcustomize: pddcustomize.o error.o libubimirror.o bootenv.o hashmap.o \
 		libubi.o crc32.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-pfiflash: pfiflash.o libpfiflash.o list.o reader.o error.o libubimirror.o \
+$(BUILDDIR)/pfiflash: pfiflash.o libpfiflash.o list.o reader.o error.o libubimirror.o \
 		bootenv.o hashmap.o pfi.o libubi.o crc32.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-ubimirror: ubimirror.o error.o libubimirror.o bootenv.o hashmap.o \
+$(BUILDDIR)/ubimirror: ubimirror.o error.o libubimirror.o bootenv.o hashmap.o \
 		libubi.o crc32.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-nand2bin: nand2bin.o nandecc.o nandcorr.o
+$(BUILDDIR)/nand2bin: nand2bin.o nandecc.o nandcorr.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-bin2nand: bin2nand.o error.o nandecc.o
+$(BUILDDIR)/bin2nand: bin2nand.o error.o nandecc.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-ubigen: ubigen.o libubigen.o crc32.o
+$(BUILDDIR)/ubigen: ubigen.o libubigen.o crc32.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-mkbootenv: mkbootenv.o bootenv.o hashmap.o error.o crc32.o
+$(BUILDDIR)/mkbootenv: mkbootenv.o bootenv.o hashmap.o error.o crc32.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-unubi: unubi.o crc32.o unubi_analyze.o eb_chain.o
+$(BUILDDIR)/unubi: unubi.o crc32.o unubi_analyze.o eb_chain.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-pfi2bin: pfi2bin.o peb.o error.o list.o crc32.o libubigen.o bootenv.o \
+$(BUILDDIR)/pfi2bin: pfi2bin.o peb.o error.o list.o crc32.o libubigen.o bootenv.o \
 		hashmap.o reader.o pfi.o
 	$(CC) $(LDFLAGS) -o $@ $^
 
-- 
1.5.6.5

             reply	other threads:[~2008-08-26 22:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26 22:07 Sebastian Siewior [this message]
2008-08-27  5:50 ` [RFC] mtd-utils: make cross build functional again Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080826220705.GA4834@Chamillionaire.breakpoint.cc \
    --to=sebastian@breakpoint.cc \
    --cc=dedekind@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox