win32-test-imagex-capture_and_apply: eliminate unnecessary %errorlevel% checks
[wimlib] / Makefile.am
index f5ac406..d6b42d1 100644 (file)
@@ -1,26 +1,43 @@
+##############################################################################
+#                              General                                      #
+##############################################################################
+
+
 ACLOCAL_AMFLAGS = -I m4
 
-AM_CPPFLAGS    = -I$(top_srcdir)/include $(WINDOWS_CPPFLAGS) \
+AM_CPPFLAGS    = -I$(top_srcdir)/include $(PLATFORM_CPPFLAGS)  \
                  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
-AM_CFLAGS      = -std=gnu99 -Wmissing-prototypes -Wstrict-prototypes   \
-                 -Werror-implicit-function-declaration                 \
-                 -fno-common -Wundef -Wno-pointer-sign
+# Note: -std=gnu99 instead of -std=c99 is needed for unnamed structs and unions,
+# which are in C11 but not C99.  But we can't yet actually use -std=c11 because
+# we want to support older versions of gcc.
+AM_CFLAGS      = -std=gnu99 $(PLATFORM_CFLAGS) -fno-common     \
+                 -Wmissing-prototypes -Wstrict-prototypes      \
+                 -Wundef -Wno-pointer-sign
 
-if WINDOWS_NATIVE_BUILD
-# This option is needed to make packed structures work as expected
-# with gcc 4.7+ (mingw) on Windows.
-AM_CFLAGS += -mno-ms-bitfields
-endif
+AM_LDFLAGS     = $(PLATFORM_LDFLAGS)
+
+EXTRA_DIST     = README README.WINDOWS                         \
+                 COPYING COPYING.GPLv3 COPYING.LGPLv3          \
+                 examples                                      \
+                 archlinux debian rpm
+
+##############################################################################
+#                              Library                                      #
+##############################################################################
 
 lib_LTLIBRARIES = libwim.la
+include_HEADERS = include/wimlib.h
 
-libwim_la_LDFLAGS = -version-info 14:0:5 $(WINDOWS_LDFLAGS)
+pkgconfigdir   = @pkgconfigdir@
+pkgconfig_DATA = wimlib.pc
+wimlib.pc: config.status
 
 libwim_la_SOURCES =            \
        src/add_image.c         \
+       src/avl_tree.c          \
+       src/blob_table.c        \
        src/capture_common.c    \
-       src/compat.c            \
        src/compress.c          \
        src/compress_common.c   \
        src/compress_parallel.c \
@@ -29,55 +46,61 @@ libwim_la_SOURCES =         \
        src/decompress_common.c \
        src/delete_image.c      \
        src/dentry.c            \
+       src/divsufsort.c        \
        src/encoding.c          \
+       src/error.c             \
        src/export_image.c      \
        src/extract.c           \
        src/file_io.c           \
        src/header.c            \
        src/inode.c             \
        src/inode_fixup.c       \
+       src/inode_table.c       \
        src/integrity.c         \
        src/iterate_dir.c       \
        src/join.c              \
-       src/lookup_table.c      \
-       src/lzms-common.c       \
-       src/lzms-compress.c     \
-       src/lzms-decompress.c   \
-       src/lz_hash.c           \
-       src/lz_sarray.c         \
-       src/divsufsort/divsufsort.c             \
-       src/divsufsort/divsufsort.h             \
-       src/divsufsort/divsufsort_private.h     \
-       src/divsufsort/sssort.c \
-       src/divsufsort/trsort.c \
-       src/lzx-common.c        \
-       src/lzx-compress.c      \
-       src/lzx-decompress.c    \
+       src/lcpit_matchfinder.c \
+       src/lzms_common.c       \
+       src/lzms_compress.c     \
+       src/lzms_decompress.c   \
+       src/lzx_common.c        \
+       src/lzx_compress.c      \
+       src/lzx_decompress.c    \
        src/metadata_resource.c \
        src/mount_image.c       \
        src/pathlist.c          \
        src/paths.c             \
-       src/resource.c          \
-       src/rbtree.c            \
+       src/pattern.c           \
+       src/progress.c          \
        src/reference.c         \
+       src/registry.c          \
+       src/reparse.c           \
+       src/resource.c          \
        src/security.c          \
        src/sha1.c              \
+       src/solid.c             \
        src/split.c             \
-       src/reparse.c           \
+       src/tagged_items.c      \
        src/template.c          \
+       src/textfile.c          \
        src/timestamp.c         \
        src/update_image.c      \
        src/util.c              \
        src/verify.c            \
-       src/wildcard.c          \
        src/wim.c               \
        src/write.c             \
+       src/x86_cpu_features.c  \
        src/xml.c               \
-       src/xpress-compress.c   \
-       src/xpress-decompress.c \
+       src/xml_windows.c       \
+       src/xpress_compress.c   \
+       src/xpress_decompress.c \
+       include/wimlib/alloca.h         \
        include/wimlib/apply.h          \
        include/wimlib/assert.h         \
-       include/wimlib/callback.h       \
+       include/wimlib/avl_tree.h       \
+       include/wimlib/bitops.h         \
+       include/wimlib/blob_table.h     \
+       include/wimlib/bt_matchfinder.h \
        include/wimlib/capture.h        \
        include/wimlib/case.h           \
        include/wimlib/compiler.h       \
@@ -87,42 +110,51 @@ libwim_la_SOURCES =                \
        include/wimlib/decompressor_ops.h       \
        include/wimlib/decompress_common.h      \
        include/wimlib/dentry.h         \
+       include/wimlib/divsufsort.h     \
        include/wimlib/encoding.h       \
        include/wimlib/endianness.h     \
        include/wimlib/error.h          \
        include/wimlib/file_io.h        \
        include/wimlib/glob.h           \
+       include/wimlib/guid.h           \
+       include/wimlib/hc_matchfinder.h \
        include/wimlib/header.h         \
        include/wimlib/inode.h          \
        include/wimlib/inode_table.h    \
        include/wimlib/integrity.h      \
+       include/wimlib/lcpit_matchfinder.h      \
        include/wimlib/list.h           \
-       include/wimlib/lookup_table.h   \
-       include/wimlib/lz.h             \
+       include/wimlib/lz_extend.h      \
        include/wimlib/lz_hash.h        \
-       include/wimlib/lz_optimal.h     \
-       include/wimlib/lz_sarray.h      \
-       include/wimlib/lzms.h           \
-       include/wimlib/lzx.h            \
+       include/wimlib/lzms_common.h    \
+       include/wimlib/lzms_constants.h \
+       include/wimlib/lzx_common.h     \
+       include/wimlib/lzx_constants.h  \
        include/wimlib/metadata.h       \
+       include/wimlib/object_id.h      \
        include/wimlib/pathlist.h       \
        include/wimlib/paths.h          \
-       include/wimlib/rbtree.h         \
+       include/wimlib/pattern.h        \
+       include/wimlib/progress.h       \
+       include/wimlib/registry.h       \
        include/wimlib/reparse.h        \
        include/wimlib/resource.h       \
        include/wimlib/security.h       \
        include/wimlib/security_descriptor.h    \
        include/wimlib/sha1.h           \
+       include/wimlib/solid.h          \
+       include/wimlib/textfile.h       \
        include/wimlib/timestamp.h      \
        include/wimlib/types.h          \
+       include/wimlib/unaligned.h      \
        include/wimlib/unix_data.h      \
        include/wimlib/util.h           \
-       include/wimlib/version.h        \
-       include/wimlib/wildcard.h       \
        include/wimlib/wim.h            \
        include/wimlib/write.h          \
+       include/wimlib/x86_cpu_features.h       \
        include/wimlib/xml.h            \
-       include/wimlib/xpress.h
+       include/wimlib/xml_windows.h    \
+       include/wimlib/xpress_constants.h
 
 if WITH_NTFS_3G
 libwim_la_SOURCES += src/ntfs-3g_apply.c       \
@@ -131,152 +163,151 @@ libwim_la_SOURCES += src/ntfs-3g_apply.c        \
 endif
 
 if WINDOWS_NATIVE_BUILD
-libwim_la_SOURCES += src/win32_common.c                        \
+libwim_la_SOURCES += src/wimboot.c                     \
+                    src/win32_common.c                 \
                     src/win32_apply.c                  \
                     src/win32_capture.c                \
                     src/win32_replacements.c           \
+                    src/win32_vss.c                    \
+                    include/wimlib/wimboot.h           \
+                    include/wimlib/win32.h             \
                     include/wimlib/win32_common.h      \
-                    include/wimlib/win32.h
+                    include/wimlib/win32_vss.h         \
+                    include/wimlib/wof.h
+PLATFORM_LIBS = -lmsvcrt -lntdll
 else
 libwim_la_SOURCES += src/unix_apply.c          \
                     src/unix_capture.c
+PLATFORM_LIBS =
 endif
 
+libwim_la_CFLAGS =             \
+       $(AM_CFLAGS)            \
+       $(PTHREAD_CFLAGS)       \
+       $(LIBXML2_CFLAGS)       \
+       $(LIBNTFS_3G_CFLAGS)    \
+       $(LIBFUSE_CFLAGS)       \
+       $(LIBCRYPTO_CFLAGS)
 
-
-EXTRA_libwim_la_SOURCES = src/sha1-ssse3.asm
-libwim_la_DEPENDENCIES = $(SSSE3_SHA1_OBJ)
-STRIP_FPIC = sh $(top_srcdir)/build-aux/strip_fPIC.sh
-
-sha1-ssse3.lo:src/sha1-ssse3.asm
-       $(LIBTOOL) --mode=compile --tag=CC $(STRIP_FPIC) $(NASM) -f elf64 \
-       -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=ssse3_not_found \
-       $<
+libwim_la_LDFLAGS = $(AM_LDFLAGS) -version-info 24:0:9
 
 libwim_la_LIBADD =             \
+       $(PTHREAD_LIBS)         \
        $(LIBXML2_LIBS)         \
+       $(LTLIBICONV)           \
+       $(LIBNTFS_3G_LIBS)      \
        $(LIBFUSE_LIBS)         \
        $(LIBRT_LIBS)           \
-       $(LIBNTFS_3G_LIBS)      \
-       $(LTLIBICONV)           \
        $(LIBCRYPTO_LIBS)       \
-       $(SSSE3_SHA1_OBJ)       \
-       $(PTHREAD_LDADD)        \
-       $(WINDOWS_LDADD)
+       $(PLATFORM_LIBS)
 
-libwim_la_CFLAGS =             \
-       $(AM_CFLAGS)            \
-       $(VISIBILITY_CFLAGS)    \
-       $(LIBXML2_CFLAGS)       \
-       $(LIBFUSE_CFLAGS)       \
-       $(LIBNTFS_3G_CFLAGS)    \
-       $(LIBCRYPTO_CFLAGS)
+if ENABLE_SSSE3_SHA1
+libwim_la_SOURCES += src/sha1-ssse3.asm
+libwim_la_LIBADD += src/sha1-ssse3.lo
 
+src/sha1-ssse3.lo:src/sha1-ssse3.asm
+       $(LIBTOOL) --mode=compile $(srcdir)/build-aux/nasm_lt.sh \
+       $(NASM) $(NAFLAGS) $(NASM_PLATFORM_FLAGS)                           \
+       -DINTEL_SHA1_UPDATE_FUNCNAME=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_ssse3       \
+       -DINTEL_SHA1_UPDATE_DEFAULT_DISPATCH=$(NASM_SYMBOL_PREFIX)sha1_transform_blocks_default  \
+       $< -o $@
+
+EXTRA_DIST += build-aux/nasm_lt.sh
+endif
+
+##############################################################################
+#                              Programs                                     #
+##############################################################################
+
+bin_PROGRAMS = wimlib-imagex
+dist_bin_SCRIPTS = programs/mkwinpeimg
 
-bin_PROGRAMS    = imagex
-imagex_SOURCES   = programs/imagex.c   \
-                  include/wimlib.h     \
-                  include/wimlib_tchar.h
-imagex_LDADD    = $(top_builddir)/libwim.la
-imagex_CFLAGS    = $(AM_CFLAGS) $(WINDOWS_CFLAGS) -Wno-deprecated-declarations
+wimlib_imagex_SOURCES =                \
+       programs/imagex.c       \
+       include/wimlib.h        \
+       include/wimlib_tchar.h
 
 if WINDOWS_NATIVE_BUILD
-imagex_SOURCES += programs/imagex-win32.c      \
-                 programs/imagex-win32.h       \
-                 programs/wgetopt.c            \
-                 programs/wgetopt.h
+wimlib_imagex_SOURCES +=       \
+       programs/imagex-win32.c \
+       programs/imagex-win32.h \
+       programs/wgetopt.c      \
+       programs/wgetopt.h
 endif
 
-imagex_cmds =  append  \
-               apply   \
-               capture \
-               delete  \
-               dir     \
-               export  \
-               extract \
-               info    \
-               join    \
-               mount   \
-               mountrw \
-               optimize\
-               split   \
-               unmount \
-               update
+wimlib_imagex_CFLAGS = $(AM_CFLAGS) -Wno-deprecated-declarations
+
+wimlib_imagex_LDADD = $(top_builddir)/libwim.la
+
+wimlib_imagex_cmds =   \
+       append          \
+       apply           \
+       capture         \
+       delete          \
+       dir             \
+       export          \
+       extract         \
+       info            \
+       join            \
+       mount           \
+       mountrw         \
+       optimize        \
+       split           \
+       unmount         \
+       update          \
+       verify
+
+##############################################################################
+#                                Hooks                                      #
+##############################################################################
 
 install-exec-hook:
-       if [ "@IMAGEX_PROGNAME@" != imagex ]; then                          \
-               cd $(DESTDIR)$(bindir) && mv -f imagex "@IMAGEX_PROGNAME@"; \
-       fi
-       for cmd in $(imagex_cmds); do                           \
-               cd $(DESTDIR)$(bindir) &&                       \
-                       ln -f "@IMAGEX_PROGNAME@" wim$${cmd};   \
+       for cmd in $(wimlib_imagex_cmds); do                            \
+               cd $(DESTDIR)$(bindir) &&                               \
+                       ln -f wimlib-imagex wim$${cmd};                 \
        done
 
 install-data-hook:
-       for cmd in $(imagex_cmds); do                                       \
-               cd $(DESTDIR)$(mandir)/man1 &&                              \
-                       ln -sf "@IMAGEX_PROGNAME@-$${cmd}.1" wim$${cmd}.1;  \
+       for cmd in $(wimlib_imagex_cmds); do                            \
+               cd $(DESTDIR)$(mandir)/man1 &&                          \
+                       ln -sf wimlib-imagex-$${cmd}.1 wim$${cmd}.1;    \
        done
 
 uninstall-hook:
-       if [ "@IMAGEX_PROGNAME@" != imagex ]; then              \
-               rm -f $(DESTDIR)$(bindir)/"@IMAGEX_PROGNAME@";  \
-               rm -f $(DESTDIR)$(bindir)/imagex;               \
-       fi
-       for cmd in $(imagex_cmds); do                           \
-               rm -f $(DESTDIR)$(bindir)/wim$${cmd};           \
+       for cmd in $(wimlib_imagex_cmds); do                            \
+               rm -f $(DESTDIR)$(bindir)/wim$${cmd};                   \
+               rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;            \
        done
-       for cmd in $(imagex_cmds); do                           \
-               rm -f $(DESTDIR)$(mandir)/man1/wim$${cmd}.1;    \
-       done
-
-
-dist_bin_SCRIPTS = programs/mkwinpeimg
-
-include_HEADERS = include/wimlib.h
-
-EXTRA_DIST =                                   \
-       build-aux/strip_fPIC.sh                 \
-       archlinux                               \
-       debian                                  \
-       rpm                                     \
-       examples                                \
-       README.WINDOWS                          \
-       tests/common_tests.sh                   \
-       tests/tests-common.sh                   \
-       tests/security_descriptor_1.base64      \
-       tests/security_descriptor_1.bin         \
-       tests/security_descriptor_2.base64      \
-       tests/security_descriptor_2.bin
-
-pkgconfigdir   = @pkgconfigdir@
-pkgconfig_DATA = wimlib.pc
 
-$(pkgconfig_DATA): config.status
-
-wimlib_manpages =                              \
-       doc/@IMAGEX_PROGNAME@.1                 \
-       doc/@IMAGEX_PROGNAME@-append.1          \
-       doc/@IMAGEX_PROGNAME@-apply.1           \
-       doc/@IMAGEX_PROGNAME@-capture.1         \
-       doc/@IMAGEX_PROGNAME@-delete.1          \
-       doc/@IMAGEX_PROGNAME@-dir.1             \
-       doc/@IMAGEX_PROGNAME@-export.1          \
-       doc/@IMAGEX_PROGNAME@-extract.1         \
-       doc/@IMAGEX_PROGNAME@-info.1            \
-       doc/@IMAGEX_PROGNAME@-join.1            \
-       doc/@IMAGEX_PROGNAME@-mount.1           \
-       doc/@IMAGEX_PROGNAME@-mountrw.1         \
-       doc/@IMAGEX_PROGNAME@-optimize.1        \
-       doc/@IMAGEX_PROGNAME@-split.1           \
-       doc/@IMAGEX_PROGNAME@-unmount.1         \
-       doc/@IMAGEX_PROGNAME@-update.1          \
-       doc/mkwinpeimg.1
-
-man1_MANS = $(wimlib_manpages)
-DISTCLEANFILES = $(wimlib_manpages)
-
-$(man1_MANS): config.status
+##############################################################################
+#                              Documentation                                #
+##############################################################################
+
+man1_MANS =                                    \
+       doc/man1/wimlib-imagex.1                \
+       doc/man1/wimlib-imagex-append.1         \
+       doc/man1/wimlib-imagex-apply.1          \
+       doc/man1/wimlib-imagex-capture.1        \
+       doc/man1/wimlib-imagex-delete.1         \
+       doc/man1/wimlib-imagex-dir.1            \
+       doc/man1/wimlib-imagex-export.1         \
+       doc/man1/wimlib-imagex-extract.1        \
+       doc/man1/wimlib-imagex-info.1           \
+       doc/man1/wimlib-imagex-join.1           \
+       doc/man1/wimlib-imagex-mount.1          \
+       doc/man1/wimlib-imagex-mountrw.1        \
+       doc/man1/wimlib-imagex-optimize.1       \
+       doc/man1/wimlib-imagex-split.1          \
+       doc/man1/wimlib-imagex-unmount.1        \
+       doc/man1/wimlib-imagex-update.1         \
+       doc/man1/wimlib-imagex-verify.1         \
+       doc/man1/mkwinpeimg.1
+
+EXTRA_DIST += $(man1_MANS)
+
+##############################################################################
+#                                Tests                                      #
+##############################################################################
 
 check_PROGRAMS = tests/tree-cmp
 tests_tree_cmp_SOURCES = tests/tree-cmp.c
@@ -293,6 +324,14 @@ if WITH_NTFS_3G
 dist_check_SCRIPTS += tests/test-imagex-ntfs
 endif
 
+EXTRA_DIST +=                                  \
+       tests/common_tests.sh                   \
+       tests/test_utils.sh                     \
+       tests/security_descriptor_1.base64      \
+       tests/security_descriptor_1.bin         \
+       tests/security_descriptor_2.base64      \
+       tests/security_descriptor_2.bin
+
 if WINDOWS_NATIVE_BUILD
 # Tests are run manually for Windows builds.
 TESTS =
@@ -300,3 +339,4 @@ else
 TESTS = $(dist_check_SCRIPTS)
 endif
 
+##############################################################################