]> wimlib.net Git - wimlib/blob - tools/windeps/Makefile
Use native Windows threads on Windows
[wimlib] / tools / windeps / Makefile
1 #
2 # This Makefile builds the third-party libraries needed to build a standalone
3 # libwim.dll for Windows.  We build these third-party libraries ourselves mainly
4 # to cut down on bloat.  They are automatically downloaded from the URLs
5 # declared below and verified against the checksums given in the 'sha256sums'
6 # file.
7 #
8 # This Makefile requires a GNU toolchain with MinGW-w64 (i686 and x86_64
9 # versions).
10 #
11
12 ARCHITECTURES           := i686 x86_64
13
14 LIBXML2_VERSION         := 2.10.3
15 LIBXML_URL              := https://download.gnome.org/sources/libxml2/2.10/libxml2-$(LIBXML2_VERSION).tar.xz
16 LIBXML_SRCDIR           := libxml2-$(LIBXML2_VERSION)
17 LIBXML_DIST             := $(LIBXML_SRCDIR).tar.xz
18 SRCDIR_TARGETS          += $(LIBXML_SRCDIR)
19 DIST_TARGETS            += $(LIBXML_DIST)
20 $(LIBXML_DIST):
21         wget $(LIBXML_URL)
22 $(LIBXML_SRCDIR):$(LIBXML_DIST) checksums_verified
23         tar xvf $<
24         cp $@/Copyright COPYING.libxml2
25 MAKE_CLEAN_FILES += $(LIBXML_SRCDIR) COPYING.libxml2
26
27 checksums_verified:$(DIST_TARGETS)
28         sha256sum -c sha256sums
29
30 #
31 # declare_libxml_target(arch)
32 #
33 define declare_libxml_target
34 libxml_$(1):$(LIBXML_SRCDIR)
35         builddir=build_libxml_$(1);                             \
36         rm -rf $$$$builddir;                                    \
37         mkdir $$$$builddir;                                     \
38         cd $$$$builddir;                                        \
39         ../$(LIBXML_SRCDIR)/configure                           \
40                 --host=$(1)-w64-mingw32                         \
41                 --enable-static                                 \
42                 --disable-shared                                \
43                 --prefix=$$$$PWD/../sysroot_$(1)                \
44                 CFLAGS=-Os                                      \
45                 --with-minimum                                  \
46                 --without-lzma                                  \
47                 --with-tree                                     \
48                 --with-writer;                                  \
49         $(MAKE) install;                                        \
50         rm -f ../sysroot_$(1)/lib/libxml2.la;
51
52 $(1)_BUILD_TARGETS += libxml_$(1)
53 MAKE_CLEAN_FILES += build_libxml_$(1)
54 endef
55
56 #
57 # declare_arch_targets(arch)
58 #
59 define declare_arch_targets
60 $(eval $(call declare_libxml_target,$(1)))
61
62 sysroot_$(1): $($(1)_BUILD_TARGETS)
63
64 ALL_SYSROOTS += sysroot_$(1)
65 MAKE_CLEAN_FILES += sysroot_$(1)
66 endef
67
68 $(foreach arch,$(ARCHITECTURES),$(eval $(call declare_arch_targets,$(arch))))
69
70 all: $(ALL_SYSROOTS)
71
72 clean:
73         rm -rf $(MAKE_CLEAN_FILES) $(DIST_TARGETS)
74
75 .PHONY: all clean $(SRCDIR_TARGETS) checksums_verified
76
77 .DEFAULT_GOAL = all