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