4 # Makefile template for MinGW.org composite System Libraries Packages
6 PACKAGE_TARNAME := @PACKAGE_TARNAME@
7 PACKAGE_VERSION := @PACKAGE_VERSION@
9 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
10 # Copyright (C) 2016, 2019, MinGW.org Project
13 # Permission is hereby granted, free of charge, to any person obtaining a
14 # copy of this software and associated documentation files (the "Software"),
15 # to deal in the Software without restriction, including without limitation
16 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 # and/or sell copies of the Software, and to permit persons to whom the
18 # Software is furnished to do so, subject to the following conditions:
20 # The above copyright notice and this permission notice (including the next
21 # paragraph) shall be included in all copies or substantial portions of the
24 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 # AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 # DEALINGS IN THE SOFTWARE.
33 # The default target is "all"; declare it early, to avoid any possible
34 # inadvertent override from any included file.
38 # Offer users the opportunity to assign boolean build-time options, from
39 # the command line, in the form 'option=NAME', or 'options="NAME ..."'
41 $(foreach opt,$(option) $(options),$(eval $(opt) = true))
48 top_srcdir = @top_srcdir@
50 # Keep the configuration in a consistent state. Note that we assume
51 # that configure has been run initially, (otherwise we wouldn't have
52 # a Makefile to begin with); since this also creates config.status,
53 # we may normally assume that it is already available ...
55 vpath configure ${top_srcdir}
56 config.status: configure
57 $(SHELL) config.status --recheck
59 # ... in which case, updating Makefile should be a simple matter of
60 # running config.status ...
62 vpath Makefile.in ${top_srcdir}
63 requires_existing = $(if $(wildcard $1),$1,$1.missing)
64 Makefile: Makefile.in configure $(call requires_existing,config.status)
65 $(SHELL) config.status
67 .PHONY: config.status.missing
68 # ... but, in the event that this may be missing, (e.g. because it
69 # has been manually removed, or removed by "make distclean"), suggest
70 # running configure, and bail out.
72 config.status.missing:
73 $(warning *** cannot execute config.status)
74 $(error please run ${top_srcdir}/configure to regenerate it.)
76 # If configure itself needs to be updated, we must run autoconf in the
77 # top level source directory.
79 vpath %.m4 ${top_srcdir}
80 vpath configure.ac ${top_srcdir}
81 configure: configure.ac aclocal.m4 VERSION.m4
82 cd ${top_srcdir}; autoconf
85 # Rules to Build and Install Both Sub-Packages
86 # --------------------------------------------
88 all install install-headers install-strip uninstall: %: %-subdirs
91 %-subdirs:; $(foreach dir,${subdirs},$(MAKE) -C ${dir} $*;)
97 .PHONY: check-recursive
98 check test tests: check-recursive
99 check-recursive: %: %-subdirs
108 dist: dist-subdirs dist-extra
109 $(RM) -r $@; $(MKDIR_P) $@
110 for file in $(addsuffix /$@/*,${subdirs}); do \
111 test -f $$file && $(LN) $$file $@; done
114 LUACMD = $(if $(LUA),$(LUA) -e,false)
116 WSL_TMPDIR = $(CURDIR)/dist/var/lib/wsl
117 FEATURES_CFG = wsl-features-$(TODAY)-$(ISSUE)-mingw32-cfg.tar.xz
119 TODAY = $(shell date +%Y%m%d)
120 ISSUE = $(if $(wildcard $@),$(shell awk '\
121 { if( $$1 == $(TODAY) ) print $$2 + 1; else print 1; exit; \
124 dist-extra: $(if $(FEATURES),features.stamp)
125 features.unsupported:
126 $(warning Lua does not appear to be installed on your system;)
127 $(warning it is required to support the FEATURES distribution option.)
129 vpath features.lua ${srcdir}/var
130 features.stamp: features.$(if $(LUA),lua,unsupported)
131 $(RM) -r dist/var dist/include
132 $(MKDIR_P) dist/include $(WSL_TMPDIR)/include && $(LN) $^ $(WSL_TMPDIR)
133 MINGW32_SYSROOT=$(WSL_TMPDIR) $(LUACMD) '$(FEATURES_H_INITIALIZE)'
134 cd dist && tar cf - var include | xz -c > $(FEATURES_CFG)
135 echo $(TODAY) $(ISSUE) > $@
136 $(RM) -r dist/var dist/include
138 FEATURES_H_INITIALIZE = \
139 sysroot = os.getenv( "MINGW32_SYSROOT" ) \
141 package.path = sysroot.."/?.lua;"..package.path \
142 have_features, config = pcall( require, "features" ) \
143 if have_features then \
144 config.initialize( io.open( config.pathname(), "w" )) \
151 clean mostlyclean distclean: %: %-subdirs
152 maintainer-clean: maintainer-clean-warning maintainer-clean-local
154 maintainer-clean-warning:
155 $(warning $(MAKE) $(@:%-warning=%))
156 $(warning This command should be used by package maintainers only;)
157 $(warning it deletes files which may require special tools to rebuild.)
159 maintainer-clean-local: %: %-subdirs
160 $(RM) -r ${srcdir}/autom4te.cache
162 # $RCSfile$: end of file