diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-12-09 08:38:10 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-12-10 14:21:34 +0200 |
commit | 47c791bdea3aee5de01f3718e5aa6b76f6dab08a (patch) | |
tree | 4e4efe9e4f31e5b2c27d7ed3d61fcbc991215eef /ubi-utils/new-utils/Makefile | |
parent | 22597af06855eaa944f783e867b4545048fe4543 (diff) |
ubi-utils: fix up build system
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>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/new-utils/Makefile')
-rw-r--r-- | 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 |