-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
125 lines (102 loc) · 3.99 KB
/
Makefile.in
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
SHELL = /bin/sh
CC = @CC@ -m32
CFLAGS = @CFLAGS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
PACKAGE = @PACKAGE_TARNAME@
VERSION = @PACKAGE_VERSION@
distdir = $(PACKAGE)-$(VERSION)
INSTALL_PROGRAM = install -m 755
kernel_version = 2.6.29
fuse_version = 2.9.7
util_linux_ng_version = 2.30
kernel_source = linux-$(kernel_version)
fuse_source = fuse-$(fuse_version)
util_linux_ng_source = util-linux-$(util_linux_ng_version)
kernel_patch = mountlo-$(kernel_version).patch
kernel_fix_patch = fix_kernel_errors.patch
kernel_config = config-$(kernel_version)
DISTFILES = COPYING Makefile.in README aclocal.m4 $(kernel_config) \
$(kernel_patch) config.h.in configure configure.ac initramfs_list \
mountlo.c fuseserv_kern.c fuseserv_user.c fusexmp_uml.c
base = $(shell pwd)
libfuse = $(base)/$(fuse_source)/lib/.libs/libfuse.a
FUSE_LIBS = $(libfuse)
export FUSE_LIBS
FUSE_CFLAGS = $(CFLAGS) @FUSE_CFLAGS@
FUSE_LDFLAGS = $(LDFLAGS) -static -L$(fuse_source)/lib/.libs -lfuse -lpthread -ldl -lrt
export FUSE_CFLAGS
all: mountlo
mountlo: $(kernel_source)/linux
cp -f $(kernel_source)/linux mountlo
strip mountlo
$(kernel_source)/linux: $(kernel_source) \
fusexmp_uml mount.static initramfs_list \
$(kernel_source)/arch/um/drivers/fuseserv_kern.c \
$(kernel_source)/arch/um/drivers/fuseserv_user.c \
$(kernel_source)/arch/um/kernel/mountlo.c \
$(kernel_source)/arch/um/kernel/mountlo-config.h \
$(kernel_source)/$(kernel_patch) \
$(kernel_source)/.config
cd $(kernel_source) && make -j2 ARCH=um SUBARCH=i386
mount.static:
cd $(base) && \
if [ ! -d $(util_linux_ng_source) ]; then mkdir -p $(util_linux_ng_source); cd $(util_linux_ng_source); tar xfz ../3rd/$(util_linux_ng_source).tar.gz; fi
cd $(base)/$(util_linux_ng_source) && ./autogen.sh && ./configure --enable-static-programs=yes --without-ncurses --without-python CC="$(CC)" && make CPPFLAGS=-I/usr/include/blkid
cp -f $(util_linux_ng_source)/mount.static mount.static
strip mount.static
touch initramfs_list
$(libfuse):
cd $(base) && \
if [ ! -d $(fuse_source) ]; then tar xfz 3rd/$(fuse_source).tar.gz; fi
cd $(fuse_source) && ./configure CC="$(CC)" && make
fusexmp_uml: fusexmp_uml.c $(libfuse)
$(CC) $(FUSE_CFLAGS) fusexmp_uml.c -o fusexmp_uml $(FUSE_LDFLAGS)
strip fusexmp_uml
touch initramfs_list
$(kernel_source):
cd $(base) && \
if [ ! -d $(kernel_source) ]; then mkdir -p $(kernel_source); cd $(kernel_source) && tar xfz ../3rd/$(kernel_source).tar.gz; fi
$(kernel_source)/arch/um/drivers/fuseserv_kern.c: fuseserv_kern.c
cp -f fuseserv_kern.c $(kernel_source)/arch/um/drivers
$(kernel_source)/arch/um/drivers/fuseserv_user.c: fuseserv_user.c
cp -f fuseserv_user.c $(kernel_source)/arch/um/drivers
$(kernel_source)/arch/um/kernel/mountlo.c: mountlo.c
cp -f mountlo.c $(kernel_source)/arch/um/kernel
$(kernel_source)/arch/um/kernel/mountlo-config.h: config.h
cp -f config.h $(kernel_source)/arch/um/kernel/mountlo-config.h
$(kernel_source)/$(kernel_patch): $(kernel_patch)
if test -f $(kernel_source)/$(kernel_patch); then \
cd $(kernel_source); patch -p1 -R < $(kernel_patch); \
fi
cp -f $(kernel_patch) $(kernel_source)/
cd $(kernel_source); patch -p1 < $(kernel_patch)
if test -f $(kernel_source)/$(kernel_fix_patch); then \
cd $(kernel_source); patch -p1 -R < $(kernel_fix_patch); \
fi
cp -f $(kernel_fix_patch) $(kernel_source)/
cd $(kernel_source); patch -p1 < $(kernel_fix_patch);
$(kernel_source)/.config: $(kernel_config)
cp -f $(kernel_config) $(kernel_source)/.config
install:
test -z "$(bindir)" || mkdir -p "$(DESTDIR)$(bindir)"
$(INSTALL_PROGRAM) mountlo "$(DESTDIR)$(bindir)"
clean:
rm -f fusexmp_uml
rm -f mountlo
rm -f mount.static
@if test -e $(kernel_source); then \
cd $(kernel_source) && make clean ARCH=um SUBARCH=i386; \
fi
distclean: clean
rm -rf $(kernel_source)
rm -rf $(fuse_source)
rm -rf $(util_linux_ng_source)
rm -f config.h config.status config.log Makefile
dist:
rm -rf $(distdir)
mkdir $(distdir)
cp -p $(DISTFILES) $(distdir)
tar czf $(distdir).tar.gz $(distdir)
rm -rf $(distdir)