From: "David Byron" <dbyron@hheld.com>
To: <linux-mtd@lists.infradead.org>
Subject: RE: autoconf for mtd-utils
Date: Wed, 19 Jul 2006 14:37:58 -0700 [thread overview]
Message-ID: <000c01c6ab7b$9aa01f70$a134800a@RudiDell> (raw)
In-Reply-To: AAAAAJOKoN+ryO5OkOyypB2eX+7kXiEA
[-- Attachment #1: Type: text/plain, Size: 198 bytes --]
On Wed, 2006-07-19 at 12:25p, David Woodhouse wrote:
> If you just send a proper Makefile patch which provides
> separate source and build directories, that'd be useful
> though.
Like this?
-DB
[-- Attachment #2: Makefile.patch --]
[-- Type: application/octet-stream, Size: 2420 bytes --]
diff --git a/Makefile b/Makefile
index 37cd7f7..62c7650 100644
--- a/Makefile
+++ b/Makefile
@@ -6,11 +6,18 @@ # $Id: Makefile,v 1.60 2005/11/07 11:15:
SBINDIR=/usr/sbin
MANDIR=/usr/man
INCLUDEDIR=/usr/include
-#CROSS=arm-linux-
-CC := $(CROSS)gcc
+#CROSS=arm-linux
+CC := $(CROSS)-gcc
CFLAGS := -I./include -O2 -Wall
-TARGETS = ftl_format flash_erase flash_eraseall nanddump doc_loadbios \
+ifeq ($(origin CROSS),undefined)
+ BUILDDIR = .
+else
+ BUILDDIR = $(CROSS)
+ CLEAN_BUILDDIR = $(BUILDDIR)
+endif
+
+RAWTARGETS = ftl_format flash_erase flash_eraseall nanddump doc_loadbios \
mkfs.jffs ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info \
flash_otp_info flash_otp_dump mtd_debug flashcp nandwrite \
jffs2dump \
@@ -18,40 +25,48 @@ TARGETS = ftl_format flash_erase flash_e
rfddump rfdformat \
sumtool #jffs2reader
+TARGETS = $(foreach target,$(RAWTARGETS),$(BUILDDIR)/$(target))
+
SYMLINKS =
%: %.o
- $(CC) $(LDFLAGS) -g -o $@ $^
+ $(CC) $(CFLAGS) $(LDFLAGS) -g -o $@ $^
-%.o: %.c
- $(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$<.dep
+$(BUILDDIR)/%.o: %.c
+ mkdir -p $(BUILDDIR)
+ $(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,$(BUILDDIR)/.$(<F).dep
.SUFFIXES:
all: $(TARGETS)
-IGNORE=${wildcard .*.c.dep}
+IGNORE=${wildcard $(BUILDDIR)/.*.c.dep}
-include ${IGNORE}
clean:
- rm -f *.o $(TARGETS) .*.c.dep $(SYMLINKS)
+ rm -f $(BUILDDIR)/*.o $(TARGETS) $(BUILDDIR)/.*.c.dep $(SYMLINKS)
+ if [ "$(CROSS)x" != "x" ]; then rm -rf $(CROSS); fi
$(SYMLINKS):
ln -sf ../fs/jffs2/$@ $@
-mkfs.jffs2: crc32.o compr_rtime.o mkfs.jffs2.o compr_zlib.o compr.o
+$(BUILDDIR)/mkfs.jffs2: $(BUILDDIR)/crc32.o \
+ $(BUILDDIR)/compr_rtime.o \
+ $(BUILDDIR)/mkfs.jffs2.o \
+ $(BUILDDIR)/compr_zlib.o \
+ $(BUILDDIR)/compr.o
$(CC) $(LDFLAGS) -o $@ $^ -lz
-flash_eraseall: crc32.o flash_eraseall.o
+$(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o
$(CC) $(LDFLAGS) -o $@ $^
-jffs2reader: jffs2reader.o
+$(BUILDDIR)/jffs2reader: $(BUILDDIR)/jffs2reader.o
$(CC) $(LDFLAGS) -o $@ $^ -lz
-jffs2dump: jffs2dump.o crc32.o
+$(BUILDDIR)/jffs2dump: $(BUILDDIR)/jffs2dump.o $(BUILDDIR)/crc32.o
$(CC) $(LDFLAGS) -o $@ $^
-sumtool: sumtool.o crc32.o
+$(BUILDDIR)/sumtool: $(BUILDDIR)/sumtool.o $(BUILDDIR)/crc32.o
$(CC) $(LDFLAGS) -o $@ $^
install: ${TARGETS}
next reply other threads:[~2006-07-19 21:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-19 21:37 David Byron [this message]
2006-07-30 18:09 ` autoconf for mtd-utils Josh Boyer
-- strict thread matches above, loose matches on Subject: below --
2006-08-01 19:25 David Byron
2006-08-02 11:00 ` Josh Boyer
2006-08-03 12:22 ` Josh Boyer
2006-07-31 17:47 David Byron
2006-08-01 0:50 ` Josh Boyer
2006-07-19 18:52 David Byron
2006-07-19 19:24 ` David Woodhouse
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='000c01c6ab7b$9aa01f70$a134800a@RudiDell' \
--to=dbyron@hheld.com \
--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