OSDN Git Service

Adjust repository version following WSL-5.3.1 release.
[mingw/mingw-org-wsl.git] / Makefile.comm
1 # Makefile.comm
2 #
3 # Common elements, shared by the subpackage makefiles for each of the
4 # MinGW.org Runtime Library and Windows-32 API packages.
5 #
6 # $Id$
7 #
8 # Written by Keith Marshall <keith@users.osdn.me>
9 # Copyright (C) 2017, 2019, MinGW.org Project
10 #
11 #
12 # Permission is hereby granted, free of charge, to any person obtaining a
13 # copy of this software and associated documentation files (the "Software"),
14 # to deal in the Software without restriction, including without limitation
15 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 # and/or sell copies of the Software, and to permit persons to whom the
17 # Software is furnished to do so, subject to the following conditions:
18 #
19 # The above copyright notice and this permission notice (including the next
20 # paragraph) shall be included in all copies or substantial portions of the
21 # Software.
22 #
23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 # AUTHORS OR THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 # DEALINGS IN THE SOFTWARE.
30
31
32 # Note whence we are reading this makefile fragment, so that we may
33 # access it again, for inclusion in source distributions.
34 #
35 COMMON_MAKEFILE := $(lastword $(MAKEFILE_LIST))
36
37 # Configuration
38 # -------------
39 #
40 # Keep the configuration in a consistent state.  Note that we assume
41 # that configure has been run initially, (otherwise we wouldn't have
42 # a Makefile to begin with); since this also creates config.status,
43 # we may normally assume that it is already available ...
44 #
45 vpath configure ${top_srcdir}
46 config.status: configure
47         $(SHELL) config.status --recheck
48
49 # ... in which case, updating Makefile should be a simple matter of
50 # running config.status ...
51 #
52 vpath Makefile.in ${top_srcdir}
53 requires_existing = $(if $(wildcard $1),$1,$1.missing)
54 Makefile: Makefile.in configure $(call requires_existing,config.status)
55         $(SHELL) config.status
56         $(RM) Makefile.stub
57
58 .PHONY: config.status.missing
59 # ... but, in the event that this may be missing, (e.g. because it
60 # has been manually removed, or removed by "make distclean"), suggest
61 # running configure, and bail out.
62 #
63 config.status.missing:
64         $(warning *** cannot execute config.status)
65         $(error please run ${top_srcdir}/configure to regenerate it.)
66
67 # If configure itself needs to be updated, we must run autoconf in the
68 # respective top level source directory.
69 #
70 vpath configure.ac ${top_srcdir}
71 vpath %.m4 ${top_srcdir}/.. ${top_srcdir}
72 configure: configure.ac aclocal.m4 VERSION.m4
73         cd ${top_srcdir}; autoconf -I ..
74
75 # Propagate package version, as configured, consistently throughout
76 # the package build; in particular, we must generate the _mingw.h and
77 # w32api.h header files, from their respective templates with each of
78 # the package version macro definitions completed.
79 #
80 vpath %.h.in ${mingwrt_srcdir}/include ${w32api_srcdir}/include
81
82 _mingw.h w32api.h: %.h: %.h.in VERSION.m4
83         $(PACKAGE_VERSION_SCRIPT) $< > $@
84
85 # _mingw.h wants to include <features.h>, which is nominally a user
86 # supplied header; for our build-time requirements, an empty file is
87 # sufficient, as _mingw.h provides suitable fall-back definitions.
88 #
89 _mingw.h: features.h
90 features.h:
91         > $@
92
93 PACKAGE_VERSION_SCRIPT = sed \
94   -e s"`$(call PACKAGE_VERSION_FORMAT,LONG,%d,$$3+1000*($$2+1000*$$1))`" \
95   -e s"`$(call PACKAGE_VERSION_FORMAT,MAJOR,%7d,$$1)`" \
96   -e s"`$(call PACKAGE_VERSION_FORMAT,MINOR,%7d,$$2)`" \
97   -e s"`$(call PACKAGE_VERSION_FORMAT,PATCH,%7d,$$3)`"
98
99 PACKAGE_VERSION_FORMAT = echo $(PACKAGE_VERSION).0.0 | awk -F. '{ \
100   printf ",%%PACKAGE_VERSION_$1%%,$2,", $3; \
101 }'
102
103
104 # Distribution
105 # ------------
106 #
107 # Propagate common source files to individual subpackage source
108 # distribution tarballs.
109 #
110 vpath install-sh ${top_srcdir}/.. ${top_srcdir}
111 %-srcdist-common-files: $(COMMON_MAKEFILE) VERSION.m4 aclocal.m4 install-sh
112         cp -p $^ dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
113
114 # $RCSfile$: end of file