Directly link with ntdll on Windows
[wimlib] / Makefile.am
1 ##############################################################################
2 #                               General                                      #
3 ##############################################################################
4
5
6 ACLOCAL_AMFLAGS = -I m4
7
8 AM_CPPFLAGS     = -I$(top_srcdir)/include $(PLATFORM_CPPFLAGS)  \
9                   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
10
11 # Note: -std=gnu99 instead of -std=c99 is needed for unnamed structs and unions,
12 # which are in C11 but not C99.  But we can't yet actually use -std=c11 because
13 # we want to support older versions of gcc.
14 AM_CFLAGS       = -std=gnu99 $(PLATFORM_CFLAGS) -fno-common     \
15                   -Wmissing-prototypes -Wstrict-prototypes      \
16                   -Wundef -Wno-pointer-sign
17
18 AM_LDFLAGS      = $(PLATFORM_LDFLAGS)
19
20 EXTRA_DIST      = README README.WINDOWS                         \
21                   COPYING COPYING.GPLv3 COPYING.LGPLv3          \
22                   examples                                      \
23                   archlinux debian rpm
24
25 ##############################################################################
26 #                               Library                                      #
27 ##############################################################################
28
29 lib_LTLIBRARIES = libwim.la
30 include_HEADERS = include/wimlib.h
31
32 pkgconfigdir    = @pkgconfigdir@
33 pkgconfig_DATA  = wimlib.pc
34 wimlib.pc: config.status
35
36 libwim_la_SOURCES =             \
37         src/add_image.c         \
38         src/avl_tree.c          \
39         src/blob_table.c        \
40         src/capture_common.c    \
41         src/compress.c          \
42         src/compress_common.c   \
43         src/compress_parallel.c \
44         src/compress_serial.c   \
45         src/decompress.c        \
46         src/decompress_common.c \
47         src/delete_image.c      \
48         src/dentry.c            \
49         src/divsufsort.c        \
50         src/encoding.c          \
51         src/error.c             \
52         src/export_image.c      \
53         src/extract.c           \
54         src/file_io.c           \
55         src/header.c            \
56         src/inode.c             \
57         src/inode_fixup.c       \
58         src/inode_table.c       \
59         src/integrity.c         \
60         src/iterate_dir.c       \
61         src/join.c              \
62         src/lcpit_matchfinder.c \
63         src/lzms_common.c       \
64         src/lzms_compress.c     \
65         src/lzms_decompress.c   \
66         src/lzx_common.c        \
67         src/lzx_compress.c      \
68         src/lzx_decompress.c    \
69         src/metadata_resource.c \
70         src/mount_image.c       \
71         src/pathlist.c          \
72         src/paths.c             \
73         src/pattern.c           \
74         src/progress.c          \
75         src/reference.c         \
76         src/registry.c          \
77         src/reparse.c           \
78         src/resource.c          \
79         src/security.c          \
80         src/sha1.c              \
81         src/solid.c             \
82         src/split.c             \
83         src/tagged_items.c      \
84         src/template.c          \
85         src/textfile.c          \
86         src/timestamp.c         \
87         src/update_image.c      \
88         src/util.c              \
89         src/verify.c            \
90         src/wim.c               \
91         src/write.c             \
92         src/x86_cpu_features.c  \
93         src/xml.c               \
94         src/xml_windows.c       \
95         src/xpress_compress.c   \
96         src/xpress_decompress.c \
97         include/wimlib/alloca.h         \
98         include/wimlib/apply.h          \
99         include/wimlib/assert.h         \
100         include/wimlib/avl_tree.h       \
101         include/wimlib/bitops.h         \
102         include/wimlib/blob_table.h     \
103         include/wimlib/bt_matchfinder.h \
104         include/wimlib/capture.h        \
105         include/wimlib/case.h           \
106         include/wimlib/compiler.h       \
107         include/wimlib/compressor_ops.h \
108         include/wimlib/compress_common.h        \
109         include/wimlib/chunk_compressor.h       \
110         include/wimlib/decompressor_ops.h       \
111         include/wimlib/decompress_common.h      \
112         include/wimlib/dentry.h         \
113         include/wimlib/divsufsort.h     \
114         include/wimlib/encoding.h       \
115         include/wimlib/endianness.h     \
116         include/wimlib/error.h          \
117         include/wimlib/file_io.h        \
118         include/wimlib/glob.h           \
119         include/wimlib/guid.h           \
120         include/wimlib/hc_matchfinder.h \
121         include/wimlib/header.h         \
122         include/wimlib/inode.h          \
123         include/wimlib/inode_table.h    \
124         include/wimlib/integrity.h      \
125         include/wimlib/lcpit_matchfinder.h      \
126         include/wimlib/list.h           \
127         include/wimlib/lz_extend.h      \
128         include/wimlib/lz_hash.h        \
129         include/wimlib/lzms_common.h    \
130         include/wimlib/lzms_constants.h \
131         include/wimlib/lzx_common.h     \
132         include/wimlib/lzx_constants.h  \
133         include/wimlib/metadata.h       \
134         include/wimlib/pathlist.h       \
135         include/wimlib/paths.h          \
136         include/wimlib/pattern.h        \
137         include/wimlib/progress.h       \
138         include/wimlib/registry.h       \
139         include/wimlib/reparse.h        \
140         include/wimlib/resource.h       \
141         include/wimlib/security.h       \
142         include/wimlib/security_descriptor.h    \
143         include/wimlib/sha1.h           \
144         include/wimlib/solid.h          \
145         include/wimlib/textfile.h       \
146         include/wimlib/timestamp.h      \
147         include/wimlib/types.h          \
148         include/wimlib/unaligned.h      \
149         include/wimlib/unix_data.h      \
150         include/wimlib/util.h           \
151         include/wimlib/wim.h            \
152         include/wimlib/write.h          \
153         include/wimlib/x86_cpu_features.h       \
154         include/wimlib/xml.h            \
155         include/wimlib/xml_windows.h    \
156         include/wimlib/xpress_constants.h
157
158 if WITH_NTFS_3G
159 libwim_la_SOURCES += src/ntfs-3g_apply.c        \
160                      src/ntfs-3g_capture.c      \
161                      include/wimlib/ntfs_3g.h
162 endif
163
164 if WINDOWS_NATIVE_BUILD
165 libwim_la_SOURCES += src/wimboot.c                      \
166                      src/win32_common.c                 \
167                      src/win32_apply.c                  \
168                      src/win32_capture.c                \
169                      src/win32_replacements.c           \
170                      src/win32_vss.c                    \
171                      include/wimlib/wimboot.h           \
172                      include/wimlib/win32.h             \
173                      include/wimlib/win32_common.h      \
174                      include/wimlib/win32_vss.h         \
175                      include/wimlib/wof.h
176 PLATFORM_LIBS = -lmsvcrt -lntdll
177 else
178 libwim_la_SOURCES += src/unix_apply.c           \
179                      src/unix_capture.c
180 PLATFORM_LIBS =
181 endif
182
183 libwim_la_CFLAGS =              \
184         $(AM_CFLAGS)            \
185         $(PTHREAD_CFLAGS)       \
186         $(LIBXML2_CFLAGS)       \
187         $(LIBNTFS_3G_CFLAGS)    \
188         $(LIBFUSE_CFLAGS)       \
189         $(LIBCRYPTO_CFLAGS)
190
191 libwim_la_LDFLAGS = $(AM_LDFLAGS) -version-info 24:0:9
192
193 libwim_la_LIBADD =              \
194         $(PTHREAD_LIBS)         \
195         $(LIBXML2_LIBS)         \
196         $(LTLIBICONV)           \
197         $(LIBNTFS_3G_LIBS)      \
198         $(LIBFUSE_LIBS)         \
199         $(LIBRT_LIBS)           \
200         $(LIBCRYPTO_LIBS)       \
201         $(PLATFORM_LIBS)
202
203 if ENABLE_SSSE3_SHA1
204 libwim_la_SOURCES += src/sha1-ssse3.asm
205 libwim_la_LIBADD += src/sha1-ssse3.lo
206
207 src/sha1-ssse3.lo:src/sha1-ssse3.asm
208         $(LIBTOOL) --mode=compile $(srcdir)/build-aux/nasm_lt.sh \
209         $(NASM) $(NAFLAGS) $(NASM_PLATFORM_FLAGS)                           \
210         -DINTEL_SHA1_UPDATE_FUNCNAME=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_ssse3       \
211         -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_default  \
212         $< -o $@
213
214 EXTRA_DIST += build-aux/nasm_lt.sh
215 endif
216
217 ##############################################################################
218 #                               Programs                                     #
219 ##############################################################################
220
221 bin_PROGRAMS = wimlib-imagex
222 dist_bin_SCRIPTS = programs/mkwinpeimg
223
224 wimlib_imagex_SOURCES =         \
225         programs/imagex.c       \
226         include/wimlib.h        \
227         include/wimlib_tchar.h
228
229 if WINDOWS_NATIVE_BUILD
230 wimlib_imagex_SOURCES +=        \
231         programs/imagex-win32.c \
232         programs/imagex-win32.h \
233         programs/wgetopt.c      \
234         programs/wgetopt.h
235 endif
236
237 wimlib_imagex_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
238
239 wimlib_imagex_LDADD = $(top_builddir)/libwim.la
240
241 wimlib_imagex_cmds =    \
242         append          \
243         apply           \
244         capture         \
245         delete          \
246         dir             \
247         export          \
248         extract         \
249         info            \
250         join            \
251         mount           \
252         mountrw         \
253         optimize        \
254         split           \
255         unmount         \
256         update          \
257         verify
258
259 ##############################################################################
260 #                                 Hooks                                      #
261 ##############################################################################
262
263 install-exec-hook:
264         for cmd in $(wimlib_imagex_cmds); do                            \
265                 cd $(DESTDIR)$(bindir) &&                               \
266                         ln -f wimlib-imagex wim$${cmd};                 \
267         done
268
269 install-data-hook:
270         for cmd in $(wimlib_imagex_cmds); do                            \
271                 cd $(DESTDIR)$(mandir)/man1 &&                          \
272                         ln -sf wimlib-imagex-$${cmd}.1 wim$${cmd}.1;    \
273         done
274
275 uninstall-hook:
276         for cmd in $(wimlib_imagex_cmds); do                            \
277                 rm -f $(DESTDIR)$(bindir)/wim$${cmd};                   \
278                 rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;            \
279         done
280
281 ##############################################################################
282 #                               Documentation                                #
283 ##############################################################################
284
285 man1_MANS =                                     \
286         doc/man1/wimlib-imagex.1                \
287         doc/man1/wimlib-imagex-append.1         \
288         doc/man1/wimlib-imagex-apply.1          \
289         doc/man1/wimlib-imagex-capture.1        \
290         doc/man1/wimlib-imagex-delete.1         \
291         doc/man1/wimlib-imagex-dir.1            \
292         doc/man1/wimlib-imagex-export.1         \
293         doc/man1/wimlib-imagex-extract.1        \
294         doc/man1/wimlib-imagex-info.1           \
295         doc/man1/wimlib-imagex-join.1           \
296         doc/man1/wimlib-imagex-mount.1          \
297         doc/man1/wimlib-imagex-mountrw.1        \
298         doc/man1/wimlib-imagex-optimize.1       \
299         doc/man1/wimlib-imagex-split.1          \
300         doc/man1/wimlib-imagex-unmount.1        \
301         doc/man1/wimlib-imagex-update.1         \
302         doc/man1/wimlib-imagex-verify.1         \
303         doc/man1/mkwinpeimg.1
304
305 EXTRA_DIST += $(man1_MANS)
306
307 ##############################################################################
308 #                                 Tests                                      #
309 ##############################################################################
310
311 check_PROGRAMS = tests/tree-cmp
312 tests_tree_cmp_SOURCES = tests/tree-cmp.c
313
314 dist_check_SCRIPTS = tests/test-imagex \
315                      tests/test-imagex-capture_and_apply \
316                      tests/test-imagex-update_and_extract
317
318 if WITH_FUSE
319 dist_check_SCRIPTS += tests/test-imagex-mount
320 endif
321
322 if WITH_NTFS_3G
323 dist_check_SCRIPTS += tests/test-imagex-ntfs
324 endif
325
326 EXTRA_DIST +=                                   \
327         tests/common_tests.sh                   \
328         tests/tests-common.sh                   \
329         tests/security_descriptor_1.base64      \
330         tests/security_descriptor_1.bin         \
331         tests/security_descriptor_2.base64      \
332         tests/security_descriptor_2.bin
333
334 if WINDOWS_NATIVE_BUILD
335 # Tests are run manually for Windows builds.
336 TESTS =
337 else
338 TESTS = $(dist_check_SCRIPTS)
339 endif
340
341 ##############################################################################