blob: 2000b172ad106800d4057c3d45311800438ad224 (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# -*- sh -*-
PREFIX=/usr
EXEC_PREFIX=$(PREFIX)
SBINDIR=$(EXEC_PREFIX)/sbin
MANDIR=$(PREFIX)/share/man
INCLUDEDIR=$(PREFIX)/include
#CROSS=arm-linux-
CC := $(CROSS)gcc
CFLAGS ?= -O2 -g
CFLAGS += -Wall
CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
ifeq ($(origin CROSS),undefined)
BUILDDIR := .
else
# Remove the trailing slash to make the directory name
BUILDDIR := $(CROSS:-=)
endif
ifeq ($(WITHOUT_XATTR), 1)
CPPFLAGS += -DWITHOUT_XATTR
endif
RAWTARGETS = ftl_format flash_erase flash_eraseall nanddump doc_loadbios \
ftl_check mkfs.jffs2 flash_lock flash_unlock flash_info \
flash_otp_info flash_otp_dump mtd_debug flashcp nandwrite nandtest \
jffs2dump \
nftldump nftl_format docfdisk \
rfddump rfdformat \
serve_image recv_image \
sumtool #jffs2reader
TARGETS = $(foreach target,$(RAWTARGETS),$(BUILDDIR)/$(target))
SYMLINKS =
%: %.o
$(CC) $(CFLAGS) $(LDFLAGS) -g -o $@ $^
$(BUILDDIR)/%.o: %.c
mkdir -p $(BUILDDIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< -g -Wp,-MD,$(BUILDDIR)/.$(<F).dep
.SUFFIXES:
all: $(TARGETS)
make -C $(BUILDDIR)/ubi-utils
make -C $(BUILDDIR)/mkfs.ubifs
IGNORE=${wildcard $(BUILDDIR)/.*.c.dep}
-include ${IGNORE}
clean:
rm -f $(BUILDDIR)/*.o $(TARGETS) $(BUILDDIR)/.*.c.dep $(SYMLINKS)
if [ "$(BUILDDIR)x" != ".x" ]; then rm -rf $(BUILDDIR); fi
make -C $(BUILDDIR)/ubi-utils clean
make -C $(BUILDDIR)/mkfs.ubifs clean
$(SYMLINKS):
ln -sf ../fs/jffs2/$@ $@
$(BUILDDIR)/mkfs.jffs2: $(BUILDDIR)/crc32.o \
$(BUILDDIR)/compr_rtime.o \
$(BUILDDIR)/mkfs.jffs2.o \
$(BUILDDIR)/compr_zlib.o \
$(BUILDDIR)/compr_lzo.o \
$(BUILDDIR)/compr.o \
$(BUILDDIR)/rbtree.o
$(CC) $(LDFLAGS) -o $@ $^ $(ZLIBLDFLAGS) -lz $(LZOLDFLAGS) -llzo2
$(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o
$(CC) $(LDFLAGS) -o $@ $^
$(BUILDDIR)/jffs2reader: $(BUILDDIR)/jffs2reader.o
$(CC) $(LDFLAGS) -o $@ $^ $(ZLIBLDFLAGS) -lz
$(BUILDDIR)/jffs2dump: $(BUILDDIR)/jffs2dump.o $(BUILDDIR)/crc32.o
$(CC) $(LDFLAGS) -o $@ $^
$(BUILDDIR)/sumtool: $(BUILDDIR)/sumtool.o $(BUILDDIR)/crc32.o
$(CC) $(LDFLAGS) -o $@ $^
$(BUILDDIR)/serve_image: $(BUILDDIR)/serve_image.o $(BUILDDIR)/crc32.o $(BUILDDIR)/fec.o
$(CC) $(LDFLAGS) -o $@ $^
$(BUILDDIR)/recv_image: $(BUILDDIR)/recv_image.o $(BUILDDIR)/crc32.o $(BUILDDIR)/fec.o
$(CC) $(LDFLAGS) -o $@ $^
$(BUILDDIR)/fectest: $(BUILDDIR)/fectest.o $(BUILDDIR)/crc32.o $(BUILDDIR)/fec.o
$(CC) $(LDFLAGS) -o $@ $^
install: ${TARGETS}
mkdir -p ${DESTDIR}/${SBINDIR}
install -m0755 ${TARGETS} ${DESTDIR}/${SBINDIR}/
mkdir -p ${DESTDIR}/${MANDIR}/man1
gzip -9c mkfs.jffs2.1 > ${DESTDIR}/${MANDIR}/man1/mkfs.jffs2.1.gz
make -C $(BUILDDIR)/ubi-utils install
make -C $(BUILDDIR)/mkfs.ubifs install
|