forked from ASdev/android_img_repack_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
203 lines (183 loc) · 5.19 KB
/
Makefile
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
CC=gcc -I. -DANDROID
AR=ar
RM=rm
ECHO=echo
CFLAGS=-DHOST -Icore/include -Icore/libsparse/include -Icore/libsparse -Ilibselinux/include -Icore/mkbootimg
LDFLAGS=-L.
LIBS=-lz
LIBZ=-lsparse_host -lselinux
SELINUX_SRCS= \
libselinux/src/booleans.c \
libselinux/src/canonicalize_context.c \
libselinux/src/disable.c \
libselinux/src/enabled.c \
libselinux/src/fgetfilecon.c \
libselinux/src/fsetfilecon.c \
libselinux/src/getenforce.c \
libselinux/src/getfilecon.c \
libselinux/src/getpeercon.c \
libselinux/src/lgetfilecon.c \
libselinux/src/load_policy.c \
libselinux/src/lsetfilecon.c \
libselinux/src/policyvers.c \
libselinux/src/procattr.c \
libselinux/src/setenforce.c \
libselinux/src/setfilecon.c \
libselinux/src/context.c \
libselinux/src/mapping.c \
libselinux/src/stringrep.c \
libselinux/src/compute_create.c \
libselinux/src/compute_av.c \
libselinux/src/avc.c \
libselinux/src/avc_internal.c \
libselinux/src/avc_sidtab.c \
libselinux/src/get_initial_context.c \
libselinux/src/checkAccess.c
SELINUX_HOST= \
libselinux/src/callbacks.c \
libselinux/src/check_context.c \
libselinux/src/freecon.c \
libselinux/src/init.c \
libselinux/src/label.c \
libselinux/src/label_file.c \
libselinux/src/label_android_property.c
ZLIB_SRCS= \
zlib/src/adler32.c \
zlib/src/compress.c \
zlib/src/crc32.c \
zlib/src/deflate.c \
zlib/src/gzclose.c \
zlib/src/gzlib.c \
zlib/src/gzread.c \
zlib/src/gzwrite.c \
zlib/src/infback.c \
zlib/src/inflate.c \
zlib/src/inftrees.c \
zlib/src/inffast.c \
zlib/src/trees.c \
zlib/src/uncompr.c \
zlib/src/zutil.c
LIBMINCRYPT_SRCS= core/libmincrypt/*.c
LIBSPARSE_SRCS= \
core/libsparse/backed_block.c \
core/libsparse/output_file.c \
core/libsparse/sparse.c \
core/libsparse/sparse_crc32.c \
core/libsparse/sparse_err.c \
core/libsparse/sparse_read.c
EXT4FS_SRCS= \
extras/ext4_utils/make_ext4fs.c \
extras/ext4_utils/ext4fixup.c \
extras/ext4_utils/ext4_utils.c \
extras/ext4_utils/allocate.c \
extras/ext4_utils/contents.c \
extras/ext4_utils/extent.c \
extras/ext4_utils/indirect.c \
extras/ext4_utils/uuid.c \
extras/ext4_utils/sha1.c \
extras/ext4_utils/wipe.c \
extras/ext4_utils/crc16.c
all: \
libselinux \
libz \
libmincrypt_host \
mkbootimg \
mkbootfs \
libsparse_host \
simg2img \
simg2simg \
img2simg \
make_ext4fs \
ext2simg \
unpackbootimg \
sgs4ext4fs
.PHONY: libselinux
libselinux:
@$(ECHO) "Building libselinux..."
@$(CC) -c $(SELINUX_SRCS) $(CFLAGS) $(SELINUX_HOST)
@$(AR) cqs [email protected] *.o
@$(RM) -rfv *.o
@$(ECHO) "*******************************************"
libz:
@$(ECHO) "Building zlib_host..."
@$(CC) -c $(ZLIB_SRCS) $(CFLAGS)
@$(AR) cqs [email protected] *.o
@$(RM) -rf *.o
@$(ECHO) "*******************************************"
libmincrypt_host:
@$(ECHO) "Building libmincrypt_host..."
@$(CC) -c $(LIBMINCRYPT_SRCS) $(CFLAGS)
@$(AR) cqs [email protected] *.o
@$(RM) -rf *.o
@$(ECHO) "*******************************************"
mkbootimg:
@$(ECHO) "Building mkbootimg..."
@$(CC) core/mkbootimg/mkbootimg.c -o $@ $(CFLAGS) $(LIBS) libmincrypt_host.a
@$(ECHO) "*******************************************"
mkbootfs:
@$(ECHO) "Building mkbootfs..."
@$(CC) core/cpio/mkbootfs.c -o $@ $(CFLAGS) $(LIBS)
@$(ECHO) "*******************************************"
libsparse_host:
@$(ECHO) "Building libsparse_host..."
@$(ECHO) "*******************************************"
@$(CC) -c core/libsparse/*.c $(CFLAGS)
@$(AR) -x libz.a
@$(AR) cqs [email protected] *.o
@$(RM) -rf *.o
@$(ECHO) "*******************************************"
simg2img:
@$(ECHO) "Building simg2img..."
@$(CC) core/libsparse/simg2img.c -o $@ $(LIBSPARSE_SRCS) $(CFLAGS) $(LIBS)
@$(ECHO) "*******************************************"
simg2simg:
@$(ECHO) "Building simg2simg..."
@$(CC) core/libsparse/simg2simg.c -o $@ $(LIBSPARSE_SRCS) $(CFLAGS) $(LIBS)
@$(ECHO) "*******************************************"
img2simg:
@$(ECHO) "Building img2simg..."
@$(CC) core/libsparse/img2simg.c -o $@ $(LIBSPARSE_SRCS) $(CFLAGS) $(LIBS)
@$(ECHO) "*******************************************"
make_ext4fs:
@$(ECHO) "Building make_ext4fs..."
@$(CC) -o $@ extras/ext4_utils/make_ext4fs_main.c $(EXT4FS_SRCS) $(CFLAGS) $(LDFLAGS) $(LIBS) $(LIBZ)
@$(ECHO) "*******************************************"
ext2simg:
@$(ECHO) "Building ext2simg..."
@$(CC) -o $@ extras/ext4_utils/ext2simg.c $(EXT4FS_SRCS) $(CFLAGS) $(LDFLAGS) $(LIBS) $(LIBZ)
@$(ECHO) "*******************************************"
unpackbootimg:
@$(ECHO) "Building unpackbootimg..."
@$(CC) external/android_system_core/mkbootimg/unpackbootimg.c -o $@ $(CFLAGS) $(LIBS) libmincrypt_host.a
@$(RM) -rfv *.a
@$(ECHO) "*******************************************"
sgs4ext4fs:
@$(ECHO) "Building sgs4ext4fs..."
@$(CC) external/sgs4ext4fs/main.c -o $@
@$(ECHO) "*******************************************"
.PHONY:
clean:
@$(ECHO) "Cleaning..."
@$(RM) -rfv *.o *.a \
libmincrypt \
mkbootimg \
mkbootfs \
unpackbootimg \
libsparse_host \
simg2img \
simg2simg \
img2simg \
make_ext4fs \
ext2simg \
sgs4ext4fs
@$(ECHO) "*******************************************"
.PHONY:
clear:
@$(ECHO) "Clearing..."
@$(RM) -rfv *.o *.a *.sh
@$(RM) -drfv \
core \
extras \
libselinux \
zlib \
external