Clean up util.h and util.c
[wimlib] / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4
2
3 AM_CPPFLAGS     = -I$(top_srcdir)/include $(WINDOWS_CPPFLAGS) \
4                   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
5
6 AM_CFLAGS       = -std=c99 -Wmissing-prototypes -Wstrict-prototypes     \
7                   -Werror-implicit-function-declaration                 \
8                   -fno-common -Wundef -Wno-pointer-sign
9
10 if WINDOWS_NATIVE_BUILD
11 # This option is needed to make packed structures work as expected
12 # with gcc 4.7+ (mingw) on Windows.
13 AM_CFLAGS += -mno-ms-bitfields
14 endif
15
16 lib_LTLIBRARIES = libwim.la
17
18 libwim_la_LDFLAGS = -version-info 18:0:3 $(WINDOWS_LDFLAGS)
19
20 libwim_la_SOURCES =             \
21         src/add_image.c         \
22         src/avl_tree.c          \
23         src/capture_common.c    \
24         src/compress.c          \
25         src/compress_common.c   \
26         src/compress_parallel.c \
27         src/compress_serial.c   \
28         src/decompress.c        \
29         src/decompress_common.c \
30         src/delete_image.c      \
31         src/dentry.c            \
32         src/divsufsort.c        \
33         src/encoding.c          \
34         src/error.c             \
35         src/export_image.c      \
36         src/extract.c           \
37         src/file_io.c           \
38         src/header.c            \
39         src/inode.c             \
40         src/inode_fixup.c       \
41         src/integrity.c         \
42         src/iterate_dir.c       \
43         src/join.c              \
44         src/lookup_table.c      \
45         src/lz_binary_trees.c   \
46         src/lz_hash_chains.c    \
47         src/lz_lcp_interval_tree.c      \
48         src/lz_linked_suffix_array.c    \
49         src/lz_mf.c             \
50         src/lz_null.c           \
51         src/lz_repsearch.c      \
52         src/lz_suffix_array_utils.c     \
53         src/lzms-common.c       \
54         src/lzms-compress.c     \
55         src/lzms-decompress.c   \
56         src/lzx-common.c        \
57         src/lzx-compress.c      \
58         src/lzx-decompress.c    \
59         src/metadata_resource.c \
60         src/mount_image.c       \
61         src/pathlist.c          \
62         src/paths.c             \
63         src/progress.c          \
64         src/resource.c          \
65         src/reference.c         \
66         src/security.c          \
67         src/sha1.c              \
68         src/split.c             \
69         src/reparse.c           \
70         src/tagged_items.c      \
71         src/template.c          \
72         src/textfile.c          \
73         src/timestamp.c         \
74         src/update_image.c      \
75         src/util.c              \
76         src/verify.c            \
77         src/wildcard.c          \
78         src/wim.c               \
79         src/write.c             \
80         src/xml.c               \
81         src/xpress-compress.c   \
82         src/xpress-decompress.c \
83         include/wimlib/apply.h          \
84         include/wimlib/assert.h         \
85         include/wimlib/avl_tree.h       \
86         include/wimlib/bitops.h         \
87         include/wimlib/callback.h       \
88         include/wimlib/capture.h        \
89         include/wimlib/case.h           \
90         include/wimlib/compiler.h       \
91         include/wimlib/compiler-gcc.h   \
92         include/wimlib/compressor_ops.h \
93         include/wimlib/compress_common.h        \
94         include/wimlib/chunk_compressor.h       \
95         include/wimlib/decompressor_ops.h       \
96         include/wimlib/decompress_common.h      \
97         include/wimlib/dentry.h         \
98         include/wimlib/divsufsort.h     \
99         include/wimlib/encoding.h       \
100         include/wimlib/endianness.h     \
101         include/wimlib/error.h          \
102         include/wimlib/file_io.h        \
103         include/wimlib/glob.h           \
104         include/wimlib/header.h         \
105         include/wimlib/inode.h          \
106         include/wimlib/inode_table.h    \
107         include/wimlib/integrity.h      \
108         include/wimlib/list.h           \
109         include/wimlib/lookup_table.h   \
110         include/wimlib/lz_extend.h      \
111         include/wimlib/lz_hash3.h       \
112         include/wimlib/lz_mf.h          \
113         include/wimlib/lz_mf_ops.h      \
114         include/wimlib/lz_repsearch.h   \
115         include/wimlib/lz_suffix_array_utils.h  \
116         include/wimlib/lzms.h           \
117         include/wimlib/lzms_constants.h \
118         include/wimlib/lzx.h            \
119         include/wimlib/lzx_constants.h  \
120         include/wimlib/metadata.h       \
121         include/wimlib/pathlist.h       \
122         include/wimlib/paths.h          \
123         include/wimlib/progress.h       \
124         include/wimlib/reparse.h        \
125         include/wimlib/resource.h       \
126         include/wimlib/security.h       \
127         include/wimlib/security_descriptor.h    \
128         include/wimlib/sha1.h           \
129         include/wimlib/textfile.h       \
130         include/wimlib/timestamp.h      \
131         include/wimlib/types.h          \
132         include/wimlib/unaligned.h      \
133         include/wimlib/unix_data.h      \
134         include/wimlib/util.h           \
135         include/wimlib/wildcard.h       \
136         include/wimlib/wim.h            \
137         include/wimlib/write.h          \
138         include/wimlib/xml.h            \
139         include/wimlib/xpress.h
140
141 if WITH_NTFS_3G
142 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
143                      src/ntfs-3g_capture.c      \
144                      include/wimlib/ntfs_3g.h
145 endif
146
147 if WINDOWS_NATIVE_BUILD
148 libwim_la_SOURCES += src/win32_common.c                 \
149                      src/win32_apply.c                  \
150                      src/win32_capture.c                \
151                      src/win32_replacements.c           \
152                      src/wimboot.c                      \
153                      include/wimlib/win32_common.h      \
154                      include/wimlib/win32.h             \
155                      include/wimlib/wimboot.h           \
156                      include/wimlib/wof.h
157 else
158 libwim_la_SOURCES += src/unix_apply.c           \
159                      src/unix_capture.c
160 endif
161
162
163
164 EXTRA_libwim_la_SOURCES = src/sha1-ssse3.asm
165 libwim_la_DEPENDENCIES = $(SSSE3_SHA1_OBJ)
166
167 src/sha1-ssse3.lo:src/sha1-ssse3.asm
168         $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/build-aux/nasm_lt.sh \
169         $(NASM) $(NAFLAGS) $(NASM_WINDOWS_FLAGS)                            \
170         -DINTEL_SHA1_UPDATE_FUNCNAME=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_ssse3       \
171         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_default  \
172         $< -o $@
173
174 libwim_la_LIBADD =              \
175         $(LIBXML2_LIBS)         \
176         $(LIBFUSE_LIBS)         \
177         $(LIBRT_LIBS)           \
178         $(LIBNTFS_3G_LIBS)      \
179         $(LTLIBICONV)           \
180         $(LIBCRYPTO_LIBS)       \
181         $(SSSE3_SHA1_OBJ)       \
182         $(PTHREAD_LDADD)
183
184 libwim_la_CFLAGS =              \
185         $(AM_CFLAGS)            \
186         $(VISIBILITY_CFLAGS)    \
187         $(LIBXML2_CFLAGS)       \
188         $(LIBFUSE_CFLAGS)       \
189         $(LIBNTFS_3G_CFLAGS)    \
190         $(LIBCRYPTO_CFLAGS)
191
192
193 bin_PROGRAMS     = imagex
194 imagex_SOURCES   = programs/imagex.c    \
195                    include/wimlib.h     \
196                    include/wimlib_tchar.h
197 imagex_LDADD     = $(top_builddir)/libwim.la
198 imagex_CFLAGS    = $(AM_CFLAGS) $(WINDOWS_CFLAGS) -Wno-deprecated-declarations
199
200 if WINDOWS_NATIVE_BUILD
201 imagex_SOURCES += programs/imagex-win32.c       \
202                   programs/imagex-win32.h       \
203                   programs/wgetopt.c            \
204                   programs/wgetopt.h
205 endif
206
207 imagex_cmds =   append  \
208                 apply   \
209                 capture \
210                 delete  \
211                 dir     \
212                 export  \
213                 extract \
214                 info    \
215                 join    \
216                 mount   \
217                 mountrw \
218                 optimize\
219                 split   \
220                 unmount \
221                 update  \
222                 verify
223
224 install-exec-hook:
225         if [ "@IMAGEX_PROGNAME@" != imagex ]; then                          \
226                 cd $(DESTDIR)$(bindir) && mv -f imagex "@IMAGEX_PROGNAME@"; \
227         fi
228         for cmd in $(imagex_cmds); do                           \
229                 cd $(DESTDIR)$(bindir) &&                       \
230                         ln -f "@IMAGEX_PROGNAME@" wim$${cmd};   \
231         done
232
233 install-data-hook:
234         for cmd in $(imagex_cmds); do                                       \
235                 cd $(DESTDIR)$(mandir)/man1 &&                              \
236                         ln -sf "@IMAGEX_PROGNAME@-$${cmd}.1" wim$${cmd}.1;  \
237         done
238
239 uninstall-hook:
240         if [ "@IMAGEX_PROGNAME@" != imagex ]; then              \
241                 rm -f $(DESTDIR)$(bindir)/"@IMAGEX_PROGNAME@";  \
242                 rm -f $(DESTDIR)$(bindir)/imagex;               \
243         fi
244         for cmd in $(imagex_cmds); do                           \
245                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};           \
246         done
247         for cmd in $(imagex_cmds); do                           \
248                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;    \
249         done
250
251
252 dist_bin_SCRIPTS = programs/mkwinpeimg
253
254 include_HEADERS = include/wimlib.h
255
256 EXTRA_DIST =                                    \
257         build-aux/nasm_lt.sh                    \
258         archlinux                               \
259         debian                                  \
260         rpm                                     \
261         examples                                \
262         COPYING                                 \
263         COPYING.GPLv3                           \
264         COPYING.LGPLv3                          \
265         README                                  \
266         README.WINDOWS                          \
267         tests/common_tests.sh                   \
268         tests/tests-common.sh                   \
269         tests/security_descriptor_1.base64      \
270         tests/security_descriptor_1.bin         \
271         tests/security_descriptor_2.base64      \
272         tests/security_descriptor_2.bin
273
274 pkgconfigdir    = @pkgconfigdir@
275 pkgconfig_DATA  = wimlib.pc
276
277 $(pkgconfig_DATA): config.status
278
279 wimlib_manpages =                               \
280         doc/man1/@IMAGEX_PROGNAME@.1                    \
281         doc/man1/@IMAGEX_PROGNAME@-append.1             \
282         doc/man1/@IMAGEX_PROGNAME@-apply.1              \
283         doc/man1/@IMAGEX_PROGNAME@-capture.1            \
284         doc/man1/@IMAGEX_PROGNAME@-delete.1             \
285         doc/man1/@IMAGEX_PROGNAME@-dir.1                \
286         doc/man1/@IMAGEX_PROGNAME@-export.1             \
287         doc/man1/@IMAGEX_PROGNAME@-extract.1            \
288         doc/man1/@IMAGEX_PROGNAME@-info.1               \
289         doc/man1/@IMAGEX_PROGNAME@-join.1               \
290         doc/man1/@IMAGEX_PROGNAME@-mount.1              \
291         doc/man1/@IMAGEX_PROGNAME@-mountrw.1            \
292         doc/man1/@IMAGEX_PROGNAME@-optimize.1   \
293         doc/man1/@IMAGEX_PROGNAME@-split.1              \
294         doc/man1/@IMAGEX_PROGNAME@-unmount.1            \
295         doc/man1/@IMAGEX_PROGNAME@-update.1             \
296         doc/man1/@IMAGEX_PROGNAME@-verify.1             \
297         doc/man1/mkwinpeimg.1
298
299 man1_MANS = $(wimlib_manpages)
300 DISTCLEANFILES = $(wimlib_manpages)
301
302 $(man1_MANS): config.status
303
304 check_PROGRAMS = tests/tree-cmp
305 tests_tree_cmp_SOURCES = tests/tree-cmp.c
306
307 dist_check_SCRIPTS = tests/test-imagex \
308                      tests/test-imagex-capture_and_apply \
309                      tests/test-imagex-update_and_extract
310
311 if WITH_FUSE
312 dist_check_SCRIPTS += tests/test-imagex-mount
313 endif
314
315 if WITH_NTFS_3G
316 dist_check_SCRIPTS += tests/test-imagex-ntfs
317 endif
318
319 if WINDOWS_NATIVE_BUILD
320 # Tests are run manually for Windows builds.
321 TESTS =
322 else
323 TESTS = $(dist_check_SCRIPTS)
324 endif
325