diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-12-18 16:05:18 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-12-22 10:13:37 +0200 |
commit | 96a4f76f2e9dad7fdbd6fd7740de44bc90d5769e (patch) | |
tree | 9367832bd2a5df10897fa7f2835cc4b24f468c87 /ubi-utils/new-utils/Makefile | |
parent | ef1e909207cd901871d60a916e4b7ff7b3e97d7d (diff) |
Unify all common build system parts
Rather than duplicating the same thing over and over in every Makefile,
move it all to common.mk.
Other things fixed here:
- doing subdirs in parallel
- fix src!=build compiling in subdirs
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 | 79 |
1 files changed, 29 insertions, 50 deletions
diff --git a/ubi-utils/new-utils/Makefile b/ubi-utils/new-utils/Makefile index 9ba0d95..6ae60b3 100644 --- a/ubi-utils/new-utils/Makefile +++ b/ubi-utils/new-utils/Makefile @@ -3,76 +3,55 @@ # KERNELHDR := ../../include -DESTDIR := /usr/local -SBINDIR=/usr/sbin -MANDIR=/usr/man -INCLUDEDIR=/usr/include - -CC := $(CROSS)gcc -AR := $(CROSS)ar -RANLIB := $(CROSS)ranlib -CFLAGS ?= -O2 -CFLAGS += -Werror -Wall + +#CFLAGS += -Werror CPPFLAGS += -Iinclude -Isrc -I$(KERNELHDR) -LDFLAGS += -L. LIBS = libubi libmtd libubigen libiniparser libscan -UTILS = ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ - ubidetach ubinize ubiformat +TARGETS = ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ + ubidetach ubinize ubiformat vpath %.c src -all: $(UTILS) - -# The below cancels existing implicite rule to make programs from .c files, -# in order to force make using our rule defined below -%: %.c - -# The below is the rule to get an .o file from a .c file -%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $< -c -o $@ +include ../../common.mk # And the below is the rule to get final executable from its .o and common.o -%: libubi.a %.o common.o - $(CC) $(CFLAGS) $(LDFLAGS) $(filter %.o, $^) -lubi -o $@ +$(TARGETS): $(addprefix $(BUILDDIR)/,\ + libubi.a common.o) +# $(CC) $(CFLAGS) $(filter %.o, $^) -L. -lubi -o $@ -ubicrc32: ubicrc32.o crc32.o - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ +$(BUILDDIR)/ubicrc32: $(addprefix $(BUILDDIR)/,\ + ubicrc32.o crc32.o) +# $(CC) $(CFLAGS) -o $@ $^ -ubinize: ubinize.o common.o crc32.o libiniparser.a libubigen.a - $(CC) $(CFLAGS) $(LDFLAGS) $(filter %.o, $^) -liniparser -lubigen -o $@ +$(BUILDDIR)/ubinize: $(addprefix $(BUILDDIR)/,\ + ubinize.o common.o crc32.o libiniparser.a libubigen.a) +# $(CC) $(CFLAGS) $(filter %.o, $^) -L. -liniparser -lubigen -o $@ -ubiformat: ubiformat.o common.o crc32.o libmtd.a libscan.a libubi.a libubigen.a - $(CC) $(CFLAGS) $(LDFLAGS) $(filter %.o, $^) -lmtd -lscan -lubi -lubigen -o $@ +$(BUILDDIR)/ubiformat: $(addprefix $(BUILDDIR)/,\ + ubiformat.o common.o crc32.o libmtd.a libscan.a libubi.a libubigen.a) +# $(CC) $(CFLAGS) $(filter %.o, $^) -L. -lmtd -lscan -lubi -lubigen -o $@ -libubi.a: libubi.o - $(AR) crv $@ $^ - $(RANLIB) $@ +$(BUILDDIR)/libubi.a: $(BUILDDIR)/libubi.o -libmtd.a: libmtd.o - $(AR) crv $@ $^ - $(RANLIB) $@ +$(BUILDDIR)/libmtd.a: $(BUILDDIR)/libmtd.o -libubigen.a: libubigen.o - $(AR) crv $@ $^ - $(RANLIB) $@ +$(BUILDDIR)/libubigen.a: $(BUILDDIR)/libubigen.o -libiniparser.a: libiniparser.o dictionary.o - $(AR) crv $@ $^ - $(RANLIB) $@ +$(BUILDDIR)/libiniparser.a: $(addprefix $(BUILDDIR)/,\ + libiniparser.o dictionary.o) -libscan.a: libscan.o crc32.o - $(AR) crv $@ $^ - $(RANLIB) $@ +$(BUILDDIR)/libscan.a: $(addprefix $(BUILDDIR)/,\ + libscan.o crc32.o) -clean: - rm -rf *.o $(addsuffix .a, $(LIBS)) $(UTILS) .*.c.dep +clean:: + rm -f $(addsuffix .a, $(LIBS)) -install: ${UTILS} +install:: mkdir -p ${DESTDIR}/${SBINDIR} - install -m 0755 ${UTILS} ${DESTDIR}/${SBINDIR}/ + install -m 0755 ${TARGETS} ${DESTDIR}/${SBINDIR}/ uninstall: - for file in ${UTILS}; do \ + for file in ${TARGETS}; do \ $(RM) ${DESTDIR}/${SBINDIR}/$$file; \ done |