* autoconf for mtd-utils
@ 2006-07-19 18:52 David Byron
2006-07-19 19:24 ` David Woodhouse
0 siblings, 1 reply; 9+ messages in thread
From: David Byron @ 2006-07-19 18:52 UTC (permalink / raw)
To: linux-mtd
In my environment, it would help to have separate build and source
directories for mtd-utils. I need a native build for mkfs.jffs2 and a
cross-compiled build for flash_eraseall, etc. A few weeks ago it looks like
Josh Boyer removed an attempt at a Makefile.am.
Is there a general aversion to automake? If I submit a Makefile.in /
configure.ac that uses autoconf but not automake, does it have a chance of
getting accepted?
I'm happy to create a Makefile.am and configure.ac for automake if that's
got a better shot.
Thanks.
-DB
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: autoconf for mtd-utils
2006-07-19 18:52 David Byron
@ 2006-07-19 19:24 ` David Woodhouse
0 siblings, 0 replies; 9+ messages in thread
From: David Woodhouse @ 2006-07-19 19:24 UTC (permalink / raw)
To: dbyron; +Cc: linux-mtd
On Wed, 2006-07-19 at 11:52 -0700, David Byron wrote:
> In my environment, it would help to have separate build and source
> directories for mtd-utils. I need a native build for mkfs.jffs2 and a
> cross-compiled build for flash_eraseall, etc. A few weeks ago it looks like
> Josh Boyer removed an attempt at a Makefile.am.
>
> Is there a general aversion to automake? If I submit a Makefile.in /
> configure.ac that uses autoconf but not automake, does it have a chance of
> getting accepted?
No.
If you just send a proper Makefile patch which provides separate source
and build directories, that'd be useful though.
--
dwmw2
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: autoconf for mtd-utils
@ 2006-07-19 21:37 David Byron
2006-07-30 18:09 ` Josh Boyer
0 siblings, 1 reply; 9+ messages in thread
From: David Byron @ 2006-07-19 21:37 UTC (permalink / raw)
To: linux-mtd
[-- 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}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: autoconf for mtd-utils
2006-07-19 21:37 David Byron
@ 2006-07-30 18:09 ` Josh Boyer
0 siblings, 0 replies; 9+ messages in thread
From: Josh Boyer @ 2006-07-30 18:09 UTC (permalink / raw)
To: dbyron; +Cc: linux-mtd
On 7/19/06, David Byron <dbyron@hheld.com> wrote:
> 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?
Something like that. But leave the definition of CROSS alone. It's
better to leave the trailing '-' at the end so that if other cross
tools are needed, you just specify $(CROSS)ld, etc.
josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: autoconf for mtd-utils
@ 2006-07-31 17:47 David Byron
2006-08-01 0:50 ` Josh Boyer
0 siblings, 1 reply; 9+ messages in thread
From: David Byron @ 2006-07-31 17:47 UTC (permalink / raw)
To: 'Josh Boyer'; +Cc: linux-mtd
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
On Sun, 2006-07-30 at 11:10a, Josh Boyer wrote:
> Something like that. But leave the definition of CROSS alone. It's
> better to leave the trailing '-' at the end so that if other cross
> tools are needed, you just specify $(CROSS)ld, etc.
How's this?
-DB
[-- Attachment #2: Makefile.patch.3 --]
[-- Type: application/octet-stream, Size: 2310 bytes --]
diff --git a/Makefile b/Makefile
index 37cd7f7..683ddbf 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,14 @@ #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
+# Remove the trailing slash to make the directory name
+ BUILDDIR := $(CROSS:-=)
+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 [ "$(BUILDDIR)x" != ".x" ]; then rm -rf $(BUILDDIR); 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}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: autoconf for mtd-utils
2006-07-31 17:47 autoconf for mtd-utils David Byron
@ 2006-08-01 0:50 ` Josh Boyer
0 siblings, 0 replies; 9+ messages in thread
From: Josh Boyer @ 2006-08-01 0:50 UTC (permalink / raw)
To: dbyron; +Cc: linux-mtd
On 7/31/06, David Byron <dbyron@hheld.com> wrote:
> On Sun, 2006-07-30 at 11:10a, Josh Boyer wrote:
>
> > Something like that. But leave the definition of CROSS alone. It's
> > better to leave the trailing '-' at the end so that if other cross
> > tools are needed, you just specify $(CROSS)ld, etc.
>
> How's this?
Better. But it only defines BUILDDIR during a cross compile. Is that
what you wanted? Or did you want a general purpose way to separate
the object and binary files from the source during build time?
Sorry for not asking that question sooner. I've just gotten back from
vacation so I'm a bit slow to respond on some things.
josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: autoconf for mtd-utils
@ 2006-08-01 19:25 David Byron
2006-08-02 11:00 ` Josh Boyer
0 siblings, 1 reply; 9+ messages in thread
From: David Byron @ 2006-08-01 19:25 UTC (permalink / raw)
To: 'Josh Boyer'; +Cc: linux-mtd
On Mon, 2006-07-31 at 5:50p, Josh Boyer wrote:
> Better. But it only defines BUILDDIR during a cross compile. Is that
> what you wanted? Or did you want a general purpose way to separate
> the object and binary files from the source during build time?
I do define BUILDDIR for native builds too, but to the current directory.
The important thing for me is that native objects live in a different place
than cross-compiled objects. Where they are relative to the source isn't
important to me at the moment.
-DB
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: autoconf for mtd-utils
2006-08-01 19:25 David Byron
@ 2006-08-02 11:00 ` Josh Boyer
2006-08-03 12:22 ` Josh Boyer
0 siblings, 1 reply; 9+ messages in thread
From: Josh Boyer @ 2006-08-02 11:00 UTC (permalink / raw)
To: dbyron; +Cc: linux-mtd
On 8/1/06, David Byron <dbyron@hheld.com> wrote:
> On Mon, 2006-07-31 at 5:50p, Josh Boyer wrote:
>
> > Better. But it only defines BUILDDIR during a cross compile. Is that
> > what you wanted? Or did you want a general purpose way to separate
> > the object and binary files from the source during build time?
>
> I do define BUILDDIR for native builds too, but to the current directory.
> The important thing for me is that native objects live in a different place
> than cross-compiled objects. Where they are relative to the source isn't
> important to me at the moment.
This looks OK to me. dwmw2, do you have any issues with this?
josh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: autoconf for mtd-utils
2006-08-02 11:00 ` Josh Boyer
@ 2006-08-03 12:22 ` Josh Boyer
0 siblings, 0 replies; 9+ messages in thread
From: Josh Boyer @ 2006-08-03 12:22 UTC (permalink / raw)
To: dbyron; +Cc: linux-mtd
On 8/2/06, Josh Boyer <jwboyer@gmail.com> wrote:
> On 8/1/06, David Byron <dbyron@hheld.com> wrote:
> > I do define BUILDDIR for native builds too, but to the current directory.
> > The important thing for me is that native objects live in a different place
> > than cross-compiled objects. Where they are relative to the source isn't
> > important to me at the moment.
>
> This looks OK to me. dwmw2, do you have any issues with this?
I've committed this patch. Thanks again David.
josh
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-08-03 12:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 17:47 autoconf for mtd-utils David Byron
2006-08-01 0:50 ` 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-19 21:37 David Byron
2006-07-30 18:09 ` Josh Boyer
2006-07-19 18:52 David Byron
2006-07-19 19:24 ` David Woodhouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox