public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] new-utils: fix up build system
@ 2008-12-09 13:38 Mike Frysinger
  2008-12-09 13:44 ` Artem Bityutskiy
  2008-12-10 10:45 ` Artem Bityutskiy
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Frysinger @ 2008-12-09 13:38 UTC (permalink / raw)
  To: linux-mtd; +Cc: Nicolas Pitre

The previous change with CFLAGS handling was not entirely correct.  So fix
CFLAGS/CPPFLAGS/LDFLAGS to work like standard build systems (i.e. autotools)
and change `ranlib` to $(RANLIB) to fix cross-compiling.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 ubi-utils/new-utils/Makefile |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/ubi-utils/new-utils/Makefile b/ubi-utils/new-utils/Makefile
index 133dd66..9ba0d95 100644
--- a/ubi-utils/new-utils/Makefile
+++ b/ubi-utils/new-utils/Makefile
@@ -9,8 +9,12 @@ MANDIR=/usr/man
 INCLUDEDIR=/usr/include
 
 CC := $(CROSS)gcc
-CFLAGS ?= -O2 -Wall
-CPPFLAGS := -Iinclude -Isrc -I$(KERNELHDR) $(CFLAGS) -Werror -Wall
+AR := $(CROSS)ar
+RANLIB := $(CROSS)ranlib
+CFLAGS ?= -O2
+CFLAGS += -Werror -Wall
+CPPFLAGS += -Iinclude -Isrc -I$(KERNELHDR)
+LDFLAGS += -L.
 
 LIBS = libubi libmtd libubigen libiniparser libscan
 UTILS = ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \
@@ -26,40 +30,40 @@ all: $(UTILS)
 
 # The below is the rule to get an .o file from a .c file
 %.o: %.c
-	$(CC) $(CPPFLAGS) $< -c -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -o $@
 
 # And the below is the rule to get final executable from its .o and common.o
 %: libubi.a %.o common.o
-	$(CC) $(CFLAGS) $(filter %.o, $^) -L. -lubi -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.o, $^) -lubi -o $@
 
 ubicrc32: ubicrc32.o crc32.o
-	$(CC) $(CFLAGS) -o $@ $^
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
 
 ubinize: ubinize.o common.o crc32.o libiniparser.a libubigen.a
-	$(CC) $(CFLAGS) $(filter %.o, $^) -L. -liniparser -lubigen -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.o, $^) -liniparser -lubigen -o $@
 
 ubiformat: ubiformat.o common.o crc32.o libmtd.a libscan.a libubi.a libubigen.a
-	$(CC) $(CFLAGS) $(filter %.o, $^) -L. -lmtd -lscan -lubi -lubigen -o $@
+	$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.o, $^) -lmtd -lscan -lubi -lubigen -o $@
 
 libubi.a: libubi.o
 	$(AR) crv $@ $^
-	ranlib $@
+	$(RANLIB) $@
 
 libmtd.a: libmtd.o
 	$(AR) crv $@ $^
-	ranlib $@
+	$(RANLIB) $@
 
 libubigen.a: libubigen.o
 	$(AR) crv $@ $^
-	ranlib $@
+	$(RANLIB) $@
 
 libiniparser.a: libiniparser.o dictionary.o
 	$(AR) crv $@ $^
-	ranlib $@
+	$(RANLIB) $@
 
 libscan.a: libscan.o crc32.o
 	$(AR) crv $@ $^
-	ranlib $@
+	$(RANLIB) $@
 
 clean:
 	rm -rf *.o $(addsuffix .a, $(LIBS)) $(UTILS) .*.c.dep
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] new-utils: fix up build system
  2008-12-09 13:38 [PATCH] new-utils: fix up build system Mike Frysinger
@ 2008-12-09 13:44 ` Artem Bityutskiy
  2008-12-10 10:45 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2008-12-09 13:44 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Nicolas Pitre, linux-mtd

On Tue, 2008-12-09 at 08:38 -0500, Mike Frysinger wrote:
> The previous change with CFLAGS handling was not entirely correct.  So fix
> CFLAGS/CPPFLAGS/LDFLAGS to work like standard build systems (i.e. autotools)
> and change `ranlib` to $(RANLIB) to fix cross-compiling.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  ubi-utils/new-utils/Makefile |   28 ++++++++++++++++------------
>  1 files changed, 16 insertions(+), 12 deletions(-)

This looks OK for me and I'll push it later unless there are complaints.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] new-utils: fix up build system
  2008-12-09 13:38 [PATCH] new-utils: fix up build system Mike Frysinger
  2008-12-09 13:44 ` Artem Bityutskiy
@ 2008-12-10 10:45 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2008-12-10 10:45 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Nicolas Pitre, linux-mtd

On Tue, 2008-12-09 at 08:38 -0500, Mike Frysinger wrote:
> The previous change with CFLAGS handling was not entirely correct.  So fix
> CFLAGS/CPPFLAGS/LDFLAGS to work like standard build systems (i.e. autotools)
> and change `ranlib` to $(RANLIB) to fix cross-compiling.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Pushed, thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-10 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 13:38 [PATCH] new-utils: fix up build system Mike Frysinger
2008-12-09 13:44 ` Artem Bityutskiy
2008-12-10 10:45 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox