aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/Makefile
blob: e736a09243927c1ab2ff18cd781a013cbcda458a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# Makefile for ubi-utils
#

KERNELHDR := ../include

SUBDIRS = old-utils

# CFLAGS += -Werror
CPPFLAGS += -Iinclude -Isrc -I$(KERNELHDR)

LIBS = libubi libmtd libubigen libiniparser libscan
TARGETS = ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \
          ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol

VPATH = src

include ../common.mk

# And the below is the rule to get final executable from its .o and common.o
$(TARGETS): $(addprefix $(BUILDDIR)/,\
	libubi.a common.o)
#	$(CC) $(CFLAGS) $(filter %.o, $^) -L. -lubi -o $@

$(BUILDDIR)/ubicrc32: $(addprefix $(BUILDDIR)/,\
	ubicrc32.o crc32.o)
#	$(CC) $(CFLAGS) -o $@ $^

$(BUILDDIR)/ubinize: $(addprefix $(BUILDDIR)/,\
	ubinize.o common.o crc32.o libiniparser.a libubigen.a)
#	$(CC) $(CFLAGS) $(filter %.o, $^) -L. -liniparser -lubigen -o $@

$(BUILDDIR)/mtdinfo: $(addprefix $(BUILDDIR)/,\
	libmtd.a libubigen.a crc32.o common.o)
#	$(CC) $(CFLAGS) $(filter %.o, $^) -L. -lmtd -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 $@

$(BUILDDIR)/libubi.a: $(BUILDDIR)/libubi.o

$(BUILDDIR)/libmtd.a: $(BUILDDIR)/libmtd.o $(BUILDDIR)/libmtd_legacy.o

$(BUILDDIR)/libubigen.a: $(BUILDDIR)/libubigen.o

$(BUILDDIR)/libiniparser.a: $(addprefix $(BUILDDIR)/,\
	libiniparser.o dictionary.o)

$(BUILDDIR)/libscan.a: $(addprefix $(BUILDDIR)/,\
	libscan.o crc32.o)

clean::
	rm -f $(addsuffix .a, $(LIBS))

install::
	mkdir -p ${DESTDIR}/${SBINDIR}
	install -m 0755 ${TARGETS} ${DESTDIR}/${SBINDIR}/

uninstall:
	for file in ${TARGETS}; do \
		$(RM) ${DESTDIR}/${SBINDIR}/$$file; \
	done