aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/Makefile
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-12-18 16:05:18 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-22 10:13:37 +0200
commit96a4f76f2e9dad7fdbd6fd7740de44bc90d5769e (patch)
tree9367832bd2a5df10897fa7f2835cc4b24f468c87 /ubi-utils/Makefile
parentef1e909207cd901871d60a916e4b7ff7b3e97d7d (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/Makefile')
-rw-r--r--ubi-utils/Makefile77
1 files changed, 27 insertions, 50 deletions
diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile
index 63058e1..3be813a 100644
--- a/ubi-utils/Makefile
+++ b/ubi-utils/Makefile
@@ -3,77 +3,54 @@
#
KERNELHDR := ../include
-DESTDIR := /usr/local
-SBINDIR=/usr/sbin
-MANDIR=/usr/share/man
-INCLUDEDIR=/usr/include
-CC := $(CROSS)gcc
CFLAGS ?= -O2 -g -Werror
-CFLAGS += -Wall -Wwrite-strings -W
CPPFLAGS += -I./inc -I./src -I$(KERNELHDR) \
-std=gnu99 -DPACKAGE_VERSION=\"1.0\"
PERLPROGS = mkpfi ubicrc32.pl
-NTARGETS = ubiattach ubicrc32 ubidetach ubimkvol ubinfo ubinize \
- ubirmvol ubiupdatevol ubiformat
+SUBDIRS = new-utils
+
TARGETS = pfiflash pddcustomize ubimirror bin2nand nand2bin ubigen \
- mkbootenv unubi pfi2bin $(NTARGETS)
+ mkbootenv unubi pfi2bin
vpath %.c ./src
-%: %.o
- $(CC) $(LDFLAGS) -g -o $@ $^
-
-%.o: %.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep
-
-all: $(TARGETS)
-
-IGNORE=${wildcard .*.c.dep}
--include ${IGNORE}
-
-$(NTARGETS):
- $(MAKE) -C new-utils $@
- mv new-utils/$@ $@
-
-clean:
- rm -rf *.o $(TARGETS) .*.c.dep
- $(MAKE) -C new-utils clean
+include ../common.mk
-pddcustomize: pddcustomize.o error.o libubimirror.o bootenv.o hashmap.o \
- libubi.o crc32.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/pddcustomize: $(addprefix $(BUILDDIR)/,\
+ pddcustomize.o error.o libubimirror.o bootenv.o hashmap.o \
+ libubi.o crc32.o)
-pfiflash: pfiflash.o libpfiflash.o list.o reader.o error.o libubimirror.o \
- bootenv.o hashmap.o pfi.o libubi.o crc32.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/pfiflash: $(addprefix $(BUILDDIR)/,\
+ pfiflash.o libpfiflash.o list.o reader.o error.o libubimirror.o \
+ bootenv.o hashmap.o pfi.o libubi.o crc32.o)
-ubimirror: ubimirror.o error.o libubimirror.o bootenv.o hashmap.o \
- libubi.o crc32.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/ubimirror: $(addprefix $(BUILDDIR)/,\
+ ubimirror.o error.o libubimirror.o bootenv.o hashmap.o \
+ libubi.o crc32.o)
-nand2bin: nand2bin.o nandecc.o nandcorr.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/nand2bin: $(addprefix $(BUILDDIR)/,\
+ nand2bin.o nandecc.o nandcorr.o)
-bin2nand: bin2nand.o error.o nandecc.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/bin2nand: $(addprefix $(BUILDDIR)/,\
+ bin2nand.o error.o nandecc.o)
-ubigen: ubigen.o libubigen.o crc32.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/ubigen: $(addprefix $(BUILDDIR)/,\
+ ubigen.o libubigen.o crc32.o)
-mkbootenv: mkbootenv.o bootenv.o hashmap.o error.o crc32.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/mkbootenv: $(addprefix $(BUILDDIR)/,\
+ mkbootenv.o bootenv.o hashmap.o error.o crc32.o)
-unubi: unubi.o crc32.o unubi_analyze.o eb_chain.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/unubi: $(addprefix $(BUILDDIR)/,\
+ unubi.o crc32.o unubi_analyze.o eb_chain.o)
-pfi2bin: pfi2bin.o peb.o error.o list.o crc32.o libubigen.o bootenv.o \
- hashmap.o reader.o pfi.o
- $(CC) $(LDFLAGS) -o $@ $^
+$(BUILDDIR)/pfi2bin: $(addprefix $(BUILDDIR)/,\
+ pfi2bin.o peb.o error.o list.o crc32.o libubigen.o bootenv.o \
+ hashmap.o reader.o pfi.o)
-install: ${TARGETS}
+install::
mkdir -p ${DESTDIR}/${SBINDIR}
install -m 0755 ${TARGETS} ${DESTDIR}/${SBINDIR}/
(cd perl && install ${PERLPROGS} ${DESTDIR}/${SBINDIR}/)