OSDN Git Service

Eliminate redundant configuration files.
[mingw/mingw-org-wsl.git] / mingwrt / Makefile.in
1 # @configure_input@
2 # $Id$
3 #
4 # Makefile template for MinGW.org Runtime Library Package
5
6 PACKAGE_TARNAME := @PACKAGE_TARNAME@
7 PACKAGE_VERSION := @PACKAGE_VERSION@
8
9 # Written by Keith Marshall <keithmarshall@users.sourceforge.net>
10 # Copyright (C) 2014-2016, MinGW.org Project
11 #
12 #
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:
19 #
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
22 # Software.
23 #
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.
31
32
33 # The default target is "all"; declare it early, to avoid any possible
34 # inadvertent override from any included file.
35 #
36 all:
37 PACKAGE_RELEASE :=
38 PACKAGE_RELEASE_TAG := $(PACKAGE_VERSION)$(PACKAGE_RELEASE:%=-%)-mingw32
39
40 # Establish the minimum version of Windows which this build is required
41 # to support; note that we fix the default as WinNT4, but we define it in
42 # a manner which will allow a command line override, and may be adapted,
43 # ultimately, to support a configure time assignment.
44 #
45 NTDDI_VERSION := NTDDI_WINNT4
46 NTDDI_VERSION_SPEC := $(NTDDI_VERSION:%=-D NTDDI_VERSION=%)
47
48 # Build paths and macros.
49 #
50 srcdir = @srcdir@
51 top_srcdir = @top_srcdir@
52 mingwrt_srcdir = @srcdir@
53 w32api_srcdir = @w32api_srcdir@
54 abs_builddir = @abs_builddir@
55
56 CC = @CC@
57 CFLAGS = @CFLAGS@
58 CPPFLAGS = @CPPFLAGS@
59
60 OBJEXT = @OBJEXT@
61
62 AR = @AR@
63 ARFLAGS = @ARFLAGS@
64 RANLIB = @RANLIB@
65
66 AS = @AS@
67 COMPILE.sx = @COMPILE_SX@
68 DLLTOOL = @DLLTOOL@
69 STRIP = @STRIP@
70 NM = @NM@
71
72 all: @DEFAULT_MAKECMDGOALS@
73 all-mingwrt-stage-1-only: _mingw.h w32api.h
74 all-mingwrt-stage-1-only: all-mingwrt-objects all-mingwrt-libs
75 all-mingwrt-stage-1-and-2: all-mingwrt-stage-1-only all-mingwrt-dll
76 all-mingwrt: all-mingwrt-stage-1-and-2
77 all-gcc: all-mingwrt-stage-1-only
78
79 active_goals = $1-$2 $(if @include_deprecated@,$1-deprecated-$2)
80 all-deprecated-mingwrt-stage-1-only: all-deprecated-mingwrt
81
82 all-stage-1-only: $(call active_goals,all,mingwrt-stage-1-only)
83 all-stage-1-and-2: $(call active_goals,all,mingwrt)
84
85 # Installation paths and macros.
86 #
87 prefix = @prefix@
88 exec_prefix = @exec_prefix@
89 bindir = ${DESTDIR}@bindir@
90
91 datarootdir = @datarootdir@
92 docdir = ${DESTDIR}${datarootdir}/doc
93 includedir = ${DESTDIR}@includedir@
94 libdir = ${DESTDIR}@libdir@
95
96 htmldir = @htmldir@
97 pdfdir = @pdfdir@
98
99 mandir = ${DESTDIR}@mandir@
100 man3dir = ${mandir}/man$(man3ext)
101
102 man3ext = 3
103
104 INSTALL = @INSTALL@
105 INSTALL_DATA = @INSTALL_DATA@ $1 $2
106
107 mkinstalldirs = @MKDIR_P@ $(addprefix $1,$2)
108 LN_S = @LN_S@
109
110 # Keep the configuration in a consistent state.  Note that we assume
111 # that configure has been run initially, (otherwise we wouldn't have
112 # a Makefile to begin with); since this also creates config.status,
113 # we may normally assume that it is already available ...
114 #
115 vpath configure ${top_srcdir}
116 config.status: configure
117         $(SHELL) config.status --recheck
118
119 # ... in which case, updating Makefile should be a simple matter of
120 # running config.status ...
121 #
122 vpath Makefile.in ${top_srcdir}
123 requires_existing = $(if $(wildcard $1),$1,$1.missing)
124 Makefile: Makefile.in configure $(call requires_existing,config.status)
125         $(SHELL) config.status
126         $(RM) Makefile.stub
127
128 .PHONY: config.status.missing
129 # ... but, in the event that this may be missing, (e.g. because it
130 # has been manually removed, or removed by "make distclean"), suggest
131 # running configure, and bail out.
132 #
133 config.status.missing:
134         $(warning *** cannot execute config.status)
135         $(error please run ${top_srcdir}/configure to regenerate it.)
136
137 # If configure itself needs to be updated, we must run autoconf in the
138 # top level source directory.
139 #
140 vpath %.m4 ${top_srcdir}
141 vpath configure.ac ${top_srcdir}
142 configure: configure.ac aclocal.m4 VERSION.m4
143         cd ${top_srcdir}; autoconf
144
145 ${top_srcdir}/%: ${top_srcdir}/../%
146         cd $(dir $@) && $(LN_S) -f ../$* .
147
148 # Propagate package version, as configured, consistently throughout
149 # the package build.
150 #
151 vpath _mingw.h.in ${top_srcdir}/include
152 vpath w32api.h.in ${w32api_srcdir}/include
153
154 _mingw.h w32api.h: configure.ac
155
156 PACKAGE_VERSION_SCRIPT = sed \
157   -e s"`$(call PACKAGE_VERSION_FORMAT,LONG,%d,$$3+1000*($$2+1000*$$1))`" \
158   -e s"`$(call PACKAGE_VERSION_FORMAT,MAJOR,%7d,$$1)`" \
159   -e s"`$(call PACKAGE_VERSION_FORMAT,MINOR,%7d,$$2)`" \
160   -e s"`$(call PACKAGE_VERSION_FORMAT,PATCH,%7d,$$3)`"
161
162 PACKAGE_VERSION_FORMAT = echo $(PACKAGE_VERSION).0.0 | awk -F. '{ \
163   printf ",%%PACKAGE_VERSION_$1%%,$2,", $3; \
164 }'
165
166 _mingw.h w32api.h: %.h: %.h.in
167         $(PACKAGE_VERSION_SCRIPT) $< > $@
168
169 # Capture dependencies conveyed within source files, ensuring that
170 # header files are taken from our working source tree, and not from
171 # the build-time compiler's installation path.  (Note: we use -MD,
172 # and not -MMD in DEPFLAGS; since this package furnishes system
173 # headers, we need changes therein to trigger a rebuild).
174 #
175 sinclude *.d
176 DEPFLAGS = -MD -MP
177 INCLUDES = -nostdinc -I . -I ${top_srcdir}/include -I ${w32api_srcdir}/include \
178   -I ${top_srcdir} -I ${top_srcdir}/profile -iwithprefixbefore include
179
180 ALL_CFLAGS = $(CFLAGS) $(DEPFLAGS) $(INCLUDES) $(NTDDI_VERSION_SPEC)
181
182 # The general case, for compiling object files from C source,
183 # requires a small adjustment to the default implicit rule.
184 #
185 %.$(OBJEXT): %.c
186         $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
187
188 # In some cases, both ANSI and UTF-16LE enabled variants of object
189 # modules are compiled from a common source; the UTF-16LE variant is
190 # to be identified by prefixing a "w" to the object file name.
191 #
192 w%.$(OBJEXT): %.c
193         $(CC) -c -D UNICODE $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
194
195 # Compiling object files from *.sx sources: since GCC-4.3, these
196 # have been supported as a case agnostic alternative to *.S sources,
197 # for assembly language sources requiring initial interpretation by
198 # the C preprocessor; owing to the case-insensitive nature of file
199 # naming on MS-Windows, we should prefer these, but we must tell
200 # make how to compile them.
201 #
202 %.$(OBJEXT): %.sx
203         $(COMPILE.sx) $($*_cflags) -o $@ $<
204
205 # Several components of the distributable object code base are to
206 # be provided as free-standing object modules, (rather than being
207 # encapsulated within object libraries); we classify these within
208 # two distinct groups, for support of the current MSVCRT.DLL build
209 # case and the older CRTDLL build case, (noting that, ultimately,
210 # we may wish to deprecate this latter case).
211 #
212 all-mingwrt-objects: $(call active_goals,all,crt-objects)
213 all-deprecated-mingwrt-objects: all-deprecated-crt-objects
214
215 # Further note that, in addition to specifying the build time
216 # inventories for each of these object module categories, each
217 # module should be allocated to an associated installation group,
218 # whence it may be included in the eventual distribution, via a
219 # staged installation.
220 #
221 all-crt-objects install-crt-objects: $(addsuffix .$(OBJEXT), crt2 crtmt \
222   crtst dllcrt2 gcrt2 CRT_fp8 CRT_fp10 CRT_noglob binmode txtmode)
223
224 all-deprecated-crt-objects install-deprecated-crt-objects: \
225   $(addsuffix .$(OBJEXT), crt1 dllcrt1 gcrt1)
226
227 # The crt1.$(OBJEXT) and crt2.$(OBJEXT) modules, for the (deprecated)
228 # CRTDLL and the (current) MSVCRT build cases respectively, are built
229 # from a common crt1.c source.  Similarly, the dllcrt1.$(OBJEXT) and
230 # dllcrt2.$(OBJEXT) modules share the common dllcrt1.c source.
231 #
232 # Noting that the source files are named for the deprecated build
233 # case, but that we need to specify this while compiling, we need
234 # this explicit pattern rule...
235 #
236 vpath %.c ${mingwrt_srcdir}
237 $(addsuffix .$(OBJEXT), crt1 dllcrt1): %.$(OBJEXT): %.c
238         $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -D__CRTDLL__ -o $@ $<
239
240 # ...while, for the current build case, we need an explicit mapping
241 # to identify the disparately named source file.
242 #
243 $(addsuffix .$(OBJEXT), crt2 dllcrt2): %2.$(OBJEXT): %1.c
244         $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
245
246 # The initialization hook for profiling code is inherited from Cygwin,
247 # where it is built as gcrt0.$(OBJEXT); we build it, unmodified, as each
248 # of gcrt1.$(OBJEXT) and gcrt2.$(OBJEXT), to satisfy the differing GCC
249 # specs file dependencies for each of the (deprecated) CRTDLL build
250 # and (current) MSVCRT build cases, respectively.
251 #
252 vpath %.c ${mingwrt_srcdir}/profile
253 $(addsuffix .$(OBJEXT), gcrt0 gcrt1 gcrt2): %.$(OBJEXT): gcrt0.c
254         $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
255
256 # The primary runtime library is furnished by Microsoft, in the form
257 # of MSVCRT.DLL, as shipped with MS-Windows itself, or in any one of
258 # its versioned variants, as shipped with the MSVC compiler suite.
259 #
260 # We furnish the API for this runtime library, in the form of import
261 # libraries, for both release and debug DLL variants; furthermore,
262 # although we favour the freely available MSVCRT.DLL distributions,
263 # we also provide import libraries tailored to the non-free, and
264 # non-redistributable, MSVCRnn.DLL variants, corresponding to each
265 # of the following enumerated versions from the MSVC suite.
266 #
267 msvcrt_versions := 70 71 80 90 100
268 msvcrt_version_script = echo $1 | awk '\
269   { printf "0x%03d00000", gensub( "^[^1-9]*([0-9]*).*", "\\\\1", 1 ) \
270   }'
271
272 extra_objects_filter = $(filter %.$(OBJEXT),$1)
273 extra_objects_script = test -z "$(call extra_objects_filter,$2)" \
274   || { echo $(AR) $(ARFLAGS) $1 $(call extra_objects_filter,$2); \
275        $(AR) $(ARFLAGS) $1 $(call extra_objects_filter,$2); \
276      }
277
278 msvcrt_dllname_script = echo $1 | awk '\
279   /^c/{ print "crtdll.dll" } \
280   /^m/{ ext = gsub( "^.*d$$", "&" ) ? "d.dll" : ".dll"; \
281         printf "msvcr%s%s", gsub( "^[^1-9]*[0-9]+.*", "&" ) \
282           ? gensub( "^[^1-9]*([0-9]+).*", "\\\\1", 1 ) \
283           : "t", ext; \
284       }'
285
286 # We categorize our import libraries into "standard" (a.k.a. "release")
287 # versions, augmented by corresponding "debug" variants.
288 #
289 std_msvcrt := $(addprefix msvcr,t $(msvcrt_versions))
290 all_msvcrt := $(std_msvcrt) $(addsuffix d,$(std_msvcrt))
291
292 all-mingwrt-libs: $(call active_goals,all,libmsvcrt)
293 all-libmsvcrt install-mingwrt-libs: $(foreach name,$(all_msvcrt),lib$(name).a)
294 all-libcrtdll install-deprecated-mingwrt-libs: libcrtdll.a libcoldname.a
295 all-deprecated-mingwrt all-deprecated-libmsvcrt: all-libcrtdll
296
297 # For each import library to be built, we derive a tailored exports
298 # definition file, from a common source.
299 #
300 .SUFFIXES: .def.in .def
301 vpath %.def.in ${mingwrt_srcdir}/msvcrt-xref
302 $(addsuffix .def,$(all_msvcrt)): %.def: msvcrt.def.in
303         $(CC) -E -P -D__FILENAME__=$@ -D__DLLNAME__=$* \
304           -D__MSVCRT_VERSION__=`$(call msvcrt_version_script,$*)` \
305           -xc-header $< > $@
306
307 # To accommodate the __USE_MINGW_ANSI_STDIO feature, as specified
308 # in _mingw.h and stdio.h, while retaining a mechanism for accessing
309 # the MSVCRT.DLL functions which it replaces, we augment our import
310 # libraries with extra, alternatively named entry points, each of
311 # which implements a vectored jump to the regular entry point for
312 # the DLL implementation of its corresponding replaced function.
313 #
314 msvcrt_repl_prefix = __msvcrt
315 msvcrt_repl_funcs = printf fprintf sprintf vprintf vfprintf vsprintf
316
317 # This is kludgey, but dlltool lacks the selectivity to do the job
318 # well; (its --ext-prefix-alias option, which is what we would like
319 # to use, is rather like a chainsaw in the hands of a neurosurgeon,
320 # when he should have a scalpel).  We cannot selectively apply the
321 # prefix, to just the symbols of interest, so we end up by creating
322 # an initial copy of the import library, WITH the prefix applied to
323 # to EVERYTHING, (noting that, when we create this initial copy, we
324 # MUST specify the "--no-delete" option TWICE, to preserve temporary
325 # object files within the build tree); we then set this initial copy
326 # aside, and create a further copy WITHOUT the extra symbols, while
327 # duplicating the temporary object file name prefix retrieved from
328 # the initial copy, using this $(NM) lookup filter...
329 #
330 dlltool_temp_prefix = $(NM) $(1) | sed -n -e '/t.o:$$/{s///p;q' -e '}'
331
332 # ...after which, we apply the following $(NM) lookup filter to the
333 # initial copy of the import library file, to identify the specific
334 # temporary object files, defining the entry points to remap...
335 #
336 msvcrt_repl = $(call nmlookup,$1,$(msvcrt_repl_prefix)_,$(msvcrt_repl_funcs))
337 nmlookup = $(NM) $(1) | sed -n \
338   -e '/:$$/h;/^[0-7][0-7]*  *T  */{s///;H;g;s/\n//' \
339   $(foreach repl,$(3),-e 's/:_$(2)$(repl)$$//p') \
340   -e '}'
341
342 # ...and we add just that selection to the final copy of the import
343 # library, before explicitly deleting ALL temporary object files, and
344 # the (extended) initial copy of the import library.
345 #
346 vpath %.def ${mingwrt_srcdir}
347 $(foreach name,$(all_msvcrt) crtdll,lib$(name).a): lib%.a: %.def
348         $(DLLTOOL) --as $(AS) -k --input-def $< --no-delete --no-delete \
349           --dllname `$(call msvcrt_dllname_script,$*)` --output-lib $@  \
350           --ext-prefix-alias $(msvcrt_repl_prefix) && mv $@ lib$*-repl.a
351         $(DLLTOOL) --as $(AS) -k --input-def $< --output-lib $@ \
352           --temp-prefix `$(call dlltool_temp_prefix,lib$*-repl.a)` \
353           --dllname `$(DLLTOOL) --identify lib$*-repl.a`
354         $(AR) $(ARFLAGS) $@ `$(call msvcrt_repl,lib$*-repl.a)` \
355           $(filter %.$(OBJEXT),$^)
356         $(RM) lib$*-repl.a `$(call dlltool_temp_prefix,$@)`*
357
358 # Older versions of Microsoft's runtime libraries used a naming
359 # convention which is more consistent with POSIX, (and with other
360 # free software usage), than they currently employ; we support
361 # this earlier convention by mapping the old names to equivalent
362 # entry points in the current libraries, using libcoldname.a to
363 # map CRTDLL.DLL entries, and variants of libmoldname.a for each
364 # variant of MSVCRT.DLL
365 #
366 std_moldname := moldname $(addprefix moldname,$(msvcrt_versions))
367 all_moldname := $(std_moldname) $(addsuffix d,$(std_moldname))
368
369 all-mingwrt-libs: all-libmoldname
370 all-libmoldname install-mingwrt-libs: $(foreach name,$(all_moldname),lib$(name).a)
371 $(foreach name,coldname $(all_moldname),lib$(name).a): lib%.a: %.def
372         $(DLLTOOL) --as $(AS) -k -U --input-def $< --output-lib $@ \
373           --dllname `$(call msvcrt_dllname_script,$*)`
374         $(AR) $(ARFLAGS) $@ $(call extra_objects_filter,$^)
375
376 # The oldname libraries are also a convenient place to provide a
377 # few additional functions, with no direct implementation in the
378 # Microsoft DLLs, but which nevertheless are easily emulated.
379 #
380 $(foreach name,coldname $(all_moldname),lib$(name).a): $(addsuffix .$(OBJEXT), \
381   isascii iscsym iscsymf toascii)
382
383 # Selected versions of the oldname libraries also provide a
384 # convenient vehicle for delivery of stubs, emulating functions
385 # which appear in later MSVCRT versions, and which we also wish
386 # to support in conjunction with earlier versions.
387 #
388 $(foreach name,moldname $(addprefix moldname,70 71),lib$(name).a) \
389 $(foreach name,moldname $(addprefix moldname,70 71),lib$(name)d.a): \
390   strnlen.jmpstub.$(OBJEXT)
391
392 coldname.def: %.def: ${mingwrt_srcdir}/moldname.def.in
393         $(CC) -C -E -P -D__FILENAME__=$@ -D__CRTDLL__ -xc-header $< > $@
394
395 $(addsuffix .def,$(all_moldname)): %.def: ${mingwrt_srcdir}/moldname.def.in
396         $(CC) -C -E -P -D__FILENAME__=$@ -xc-header $< > $@
397
398 all-mingwrt-libs install-mingwrt-libs: libmingw32.a libmingwex.a
399 libmingw32.a: $(addsuffix .$(OBJEXT), CRTinit CRTglob setargv \
400   CRTfmode cpu_features CRT_fp10 txtmode main dllmain gccmain crtst \
401   tlsmcrt tlsmthread tlssup tlsthrd pseudo-reloc pseudo-reloc-list)
402
403 libmingw32.a libmingwex.a libm.a libmingwthrd.a libgmon.a:
404         $(AR) $(ARFLAGS) $@ $?
405
406 # Complex math objects, to be included in libmingwex.a
407 # (FIXME: consider whether these might be more suitably
408 # delivered in libm.a; ISO-C99 says they belong in the
409 # math library, which by POSIX convention, is libm.a)
410 #
411 vpath %.c ${mingwrt_srcdir}/mingwex
412 vpath %.c ${mingwrt_srcdir}/mingwex/complex
413 libmingwex.a: $(addsuffix .$(OBJEXT), cabs cabsf cabsl cacos cacosf \
414   cacosh cacoshf cacoshl cacosl casin casinf casinh casinhf casinhl casinl \
415   catan catanf catanh catanhf catanhl catanl ccos ccosf ccosh ccoshf ccoshl \
416   ccosl cexp cexpf cexpl clog clogf clogl cpow cpowf cpowl cproj cprojf \
417   cprojl csin csinf csinh csinhf csinhl csinl csqrt csqrtf csqrtl \
418   ctan ctanf ctanh ctanhf ctanhl ctanl)
419
420 libmingwex.a: $(addsuffix .$(OBJEXT), isblank iswblank)
421
422 # Floating point environment control, in libmingwex.a
423 # (FIXME: once again, maybe better delivered in libm.a)
424 #
425 libmingwex.a: $(addsuffix .$(OBJEXT), fegetenv fesetenv feupdateenv \
426   feclearexcept feraiseexcept fetestexcept feholdexcept fegetexceptflag \
427   fesetexceptflag fegetround fesetround)
428
429 # David Gay's "gdtoa" API, provided in libmingwex.a, and used
430 # by MinGW's ISO-C conforming printf() routines for formatting
431 # floating point output.
432 #
433 vpath %.c ${mingwrt_srcdir}/mingwex/gdtoa
434 libmingwex.a: $(addsuffix .$(OBJEXT), g__fmt gethex strtopx g_dfmt gdtoa \
435   gmisc smisc sum g_ffmt hd_init strtodg ulp dmisc g_xfmt hexnan strtodnrp \
436   dtoa misc strtof)
437
438 # "inttypes" conversion routines, provided in libmingwex.a
439 #
440 libmingwex.a: $(addsuffix .$(OBJEXT), \
441   imaxdiv strtoimax strtoumax wcstoimax wcstoumax)
442
443 # Additional math functions, augmenting Microsoft's paltry
444 # selection, also delivered in libmingwex.a, (FIXME: and yet
445 # again, perhaps libm.a would be a better fit)
446 #
447 vpath %.c ${mingwrt_srcdir}/mingwex/math
448 vpath %.s ${mingwrt_srcdir}/mingwex/math
449 libmingwex.a: $(addsuffix .$(OBJEXT), cosf cosl acosf acosl sinf sinl asinf \
450   asinl tanf tanl atanf atanl atan2f atan2l coshf coshl acosh acoshf acoshl \
451   sinhf sinhl asinh asinhf asinhl tanhf tanhl atanh atanhf atanhl cbrt cbrtf \
452   cbrtl ceilf ceill copysign copysignf copysignl erfl s_erf sf_erf expf expl \
453   exp2 exp2f exp2l expm1 expm1f expm1l fabs fabsf fabsl fdim fdimf fdiml \
454   floorf floorl fma fmaf fmal fmax fmaxf fmaxl fmin fminf fminl fmodf fmodl \
455   fp_consts fp_constsf fp_constsl fpclassify fpclassifyf fpclassifyl frexpf \
456   frexpl fucom hypotf hypotl ilogb ilogbf ilogbl isnan isnanf isnanl ldexpf \
457   ldexpl lgamma lgammaf lgammal llrint llrintf llrintl log10f log10l log1p \
458   log1pf log1pl log2 log2f log2l logb logbf logbl logf logl lrint lrintf \
459   lrintl llround llroundf llroundl lround lroundf lroundl modff modfl \
460   nearbyint nearbyintf nearbyintl nextafterf nextafterl nexttoward nexttowardf \
461   powf powl powi powif powil remainder remainderf remainderl remquo remquof \
462   remquol rint rintf rintl round roundf roundl scalbn scalbnf scalbnl signbit \
463   signbitf signbitl sqrtf sqrtl tgamma tgammaf tgammal trunc truncf truncl)
464
465 # Replacement I/O functions in libmingwex.a, providing better POSIX
466 # compatibility than their Microsoft equivalents.
467 #
468 vpath %.c ${mingwrt_srcdir}/mingwex/stdio
469 libmingwex.a: $(addsuffix .$(OBJEXT), btowc fprintf fseeko64 ofmtctl pformat \
470   printf snprintf snwprintf sprintf vfprintf vfscanf vfwscanf vprintf vscanf \
471   vsnprintf vsnwprintf vsprintf vsscanf vswscanf vwscanf)
472
473 # pformat.$(OBJEXT) needs an explicit build rule, since we need to
474 # specify an additional header file path.
475 #
476 PFORMAT_CFLAGS = -I ${mingwrt_srcdir}/mingwex/gdtoa
477 pformat.$(OBJEXT): %.$(OBJEXT): %.c
478         $(CC) -c $(ALL_CFLAGS) $(PFORMAT_CFLAGS) $< -o $@
479
480 # To support Microsoft's DLL version specific exponent digits control,
481 # and "%n" format availability control APIs, in a DLL version agnostic
482 # manner, we also provide the following set of wrapper functions:
483 #
484 libmingwex.a: $(addsuffix fmt.$(OBJEXT),varo crto geto seto crtn getn setn)
485 $(addsuffix fmt.$(OBJEXT),varo crto geto seto crtn getn setn): %.$(OBJEXT): ofmt.c
486         $(CC) -c $(ALL_CFLAGS) -D__$*__ -fno-align-functions -o $@ $<
487
488 # Some additional miscellaneous functions, in libmingwex.a
489 #
490 #libmingwex.a: $(addsuffix .$(OBJEXT), glob membarrier)
491 libmingwex.a: $(addsuffix .$(OBJEXT), mingw-aligned-malloc mingw-fseek)
492 libmingwex.a: $(addsuffix .$(OBJEXT), glob getopt basename dirname nsleep)
493 libmingwex.a: $(addsuffix .$(OBJEXT), mkstemp mkdtemp cryptnam)
494
495 libmingwex.a: $(addsuffix .$(OBJEXT), tdelete tfind tsearch twalk)
496
497 libmingwex.a: gettimeofday.$(OBJEXT)
498 libmingwex.a: $(addsuffix .$(OBJEXT), dirent wdirent dlfcn)
499
500 vpath %.s ${mingwrt_srcdir}/mingwex
501 libmingwex.a: $(addsuffix .$(OBJEXT), fwide mbrtowc mbsinit strnlen wcrtomb \
502   wcstof wcstold wctob wmemchr wmemcmp wmemcpy wmemmove wmemset)
503
504 libmingwex.a: $(addsuffix .$(OBJEXT), wctrans wctype)
505
506 # For the math sources, we support the convention that a single
507 # quux_generic.c source file will produce three objects: quux.o,
508 # quuxf.o, and quuxl.o; since a change in the common source file
509 # will require all three objects to be recompiled, we may handle
510 # this with a single, multiple target, pattern rule.
511 #
512 $(addsuffix .$(OBJEXT), % %f %l): %_generic.c
513         $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $*.$(OBJEXT) $<
514         $(CC) -c -D FUNCTION=$*f $(CPPFLAGS) $(ALL_CFLAGS) -o $*f.$(OBJEXT) $<
515         $(CC) -c -D FUNCTION=$*l $(CPPFLAGS) $(ALL_CFLAGS) -o $*l.$(OBJEXT) $<
516
517 # The llround.o, llroundf.o, and llroundl.o variants are a special
518 # case of the preceding rule; (the source is lround_generic.c rather
519 # than llround_generic.c).  We can handle this using the following
520 # static pattern rule, (compiling each object individually).
521 #
522 $(addsuffix .$(OBJEXT), llround llroundf llroundl): %.$(OBJEXT): lround_generic.c
523         $(CC) -c -D FUNCTION=$* $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
524
525 # Historically, MinGW.org's libm.a has been a dummy, delivering
526 # nothing of value; FIXME: IMO, this sucks; it should deliver the
527 # non-MSVCRT.DLL math functions, as noted above.
528 #
529 all-mingwrt-libs install-mingwrt-libs: libm.a
530 libm.a: libm_dummy.$(OBJEXT)
531 libm_dummy.c: Makefile
532         echo "static int __mingw_libm_dummy;" > $@
533
534 # The mingwrt headers define a number of functions which are normally
535 # expected to be compiled as inline code.  Each such function must also
536 # be provided with an externally visible entry point; we provide such
537 # entry points as stubs in libmingwex.a, via the following rules:
538 #
539 sinclude Makefile.stub
540 vpath jmpstub.sx ${mingwrt_srcdir}/mingwex
541 libstub_refnames = grep -lr '__$1.*FUNCTION *=' ${mingwrt_srcdir}
542 jmpstub_prerequisites := $(shell $(call libstub_refnames,JMPSTUB)/include)
543 libimpl_prerequisites := $(shell $(call libstub_refnames,LIBIMPL)/include)
544 Makefile.stub: Makefile $(jmpstub_prerequisites) $(libimpl_prerequisites)
545         echo "# $@: automatically generated file -- do not edit!" > $@
546         $(call jmpstub_awk_script,$(jmpstub_prerequisites)) >> $@
547         $(call libimpl_awk_script,$(libimpl_prerequisites)) >> $@
548         echo "# $@: end of file" >> $@
549
550 # Stubs are categorized into either of JMPSTUB or LIBIMPL classes;
551 # the rules for building the JMPSTUP inplementations are written to
552 # Makefile.stub, by processing each of their defining header files
553 # through the following awk script...
554 #
555 jmpstub_awk_script = test -z "$1" || awk '\
556   BEGIN { \
557     symbol = "([A-Z_a-z][A-Z_a-z0-9]*)"; \
558     fmt = "\nlib%s.a: %s\n%s: jmpstub.sx\n\t$$(COMPILE.sx) %s -o $$@ $$^\n"; \
559   } \
560   /__JMPSTUB(__)? *[(].*FUNCTION/ { \
561     FUNCTION = gensub( ".*[ ,(:]FUNCTION *= *"symbol".*", "\\1", 1 ); \
562     LIB = match( $$0, ".*[ ,(:]LIB *= *"symbol, altlib ) ? altlib[1] : "mingwex"; \
563     OBJNAME = gensub( "_*(.*)_*", "\\1", 1, FUNCTION )".jmpstub.$$(OBJEXT)"; \
564     OBJNAME_CFLAGS = "-D FUNCTION="FUNCTION; \
565     if( match( $$0, ".*[ ,(:]REMAPPED *= *"symbol, alias ) ) \
566       OBJNAME_CFLAGS = OBJNAME_CFLAGS" -D REMAPPED="alias[1]; \
567     printf fmt, LIB, OBJNAME, OBJNAME, OBJNAME_CFLAGS; \
568   } \
569   END { \
570     printf "\n"; \
571   }' $1
572
573 # ...while this establishes the dependencies which apply for each
574 # of those in the LIBIMPL class.
575 #
576 libimpl_awk_script = test -z "$1" || awk '\
577   BEGIN { \
578     symbol = "([A-Z_a-z][A-Z_a-z0-9]*)"; \
579     fmt = "\nlib%s.a: %s\n%s.libimpl: %s\n"; \
580   } \
581   /__LIBIMPL(__)? *[(].*FUNCTION/ { \
582     FUNCTION = gensub( ".*[ ,(:]FUNCTION *= *"symbol".*", "\\1", 1 ); \
583     LIB = match( $$0, ".*[ ,(:]LIB *= *"symbol, altlib ) ? altlib[1] : "mingwex"; \
584     OBJNAME = gensub( "_*(.*)_*", "\\1", 1, FUNCTION )".libimpl.$$(OBJEXT)"; \
585     printf fmt, LIB, OBJNAME, FUNCTION, FILENAME; \
586   } \
587   END { \
588     printf "\n"; \
589   }' $1
590
591 # In contrast to JMPSTUB implementations, which are best handled
592 # by individual compilation rules in Makefile.stub, generic rules
593 # are sufficient for all LIBIMPL implementations; in each case, we
594 # filter the static attribute from each defined implementation, in
595 # its defining header file, to create an intermediate C source for
596 # each individual function; (note that we also remove any pragma
597 # which identifies the originating file as a system header).
598 #
599 libimpl_sed_script = sed \
600   -e '/pragma .* system_header/d' \
601   -e '/__CRT_INLINE  *__LIBIMPL.*FUNCTION *= *$1[ ,)].*)/d' \
602   -e 's/__LIBIMPL.*ALIAS *= *$1[ ,)].*)/__attribute__((__alias__("$1")))/' \
603   -e '/__CRT_ALIAS  *__LIBIMPL.*FUNCTION *= *$1[ ,)].*)/d'
604
605 LIBIMPL_CFLAGS = $(CFLAGS) $(INCLUDES) $(LIBIMPL_EXTRA_CFLAGS)
606 LIBIMPL_EXTRA_CFLAGS = -fno-align-functions -Wno-deprecated-declarations
607
608 # LIBIMPL dependencies are tracked using zero sized name.libimpl
609 # files; the intermediate C files are generated as a side effect
610 # of resolving these dependencies...
611 #
612 %.libimpl:
613         $(call libimpl_sed_script,$*) $< > $@.c
614         > $@
615
616 # ...and ultimately discarded, after the requisite object file
617 # has been compiled; (note that this creates a vulnerability due
618 # to possible loss of the object file, while the tracking file is
619 # still in place; to circumvent this, we must be able to force a
620 # remake of the tracking file, so also regenerating the .c file,
621 # before it is compiled).
622 #
623 libimpl_remake = { $(RM) $1; $(MAKE) --no-print-directory $1; }
624 %.libimpl.$(OBJEXT): %.libimpl
625         test -f $<.c || $(call libimpl_remake,$<)
626         $(CC) -c $(CPPFLAGS) $(LIBIMPL_CFLAGS) -o $@ $<.c
627         $(RM) $<.c
628
629 # Thread support libraries.
630 #
631 all-mingwrt-libs install-mingwrt-libs: libmingwthrd.a libmingwthrd_old.a
632 libmingwthrd.a libmingwthrd_old.a: crtmt.$(OBJEXT)
633 mingwthrd_old.def mingwm10.dll: $(addsuffix .$(OBJEXT), mthr mthr_init)
634 mingwthrd_old.def:
635         $(DLLTOOL) --as $(AS) --output-def $@ $^
636
637 libmingwthrd_old.a: lib%.a: %.def
638         $(DLLTOOL) --as $(AS) --input-def $< --dllname mingwm10.dll --output-lib $@
639         $(AR) $(ARFLAGS) $@ $(call extra_objects_filter,$^)
640
641 all-mingwrt-dll install-mingwrt-dll-files: mingwm10.dll
642 mingwm10.dll: mingwthrd_old.def
643         $(CC) -shared -o $@ -Wl,--image-base,0x6FBC0000 \
644           -Wl,--entry,_DllMainCRTStartup@12 $^
645
646 # Code profiling support, using the GNU profiling library; (note
647 # that applications using this library MUST be licensed to comply
648 # with the GNU General Public License).
649 #
650 all-mingwrt-libs install-mingwrt-libs: libgmon.a
651 libgmon.a: $(addsuffix .$(OBJEXT), gmon mcount profil)
652
653
654 # Installation Rules
655 # ------------------
656 #
657 # Users may expect to be able to specify DESTDIR, to stage the
658 # following stock installation directories outside of the regular
659 # "as configured" installation tree; unfortunately, this expectation
660 # MUST fail, when the stock path is in MS-Windows absolute format, so
661 # we provide an exception mechanism to forbid such usage, and we
662 # proceed to create the directories only when the exception is
663 # NOT triggered.
664 #
665 .PHONY: DESTDIR-UNSUPPORTED
666 bindir docdir includedir libdir mandir htmldir pdfdir:
667         @test -z "$(strip ${DESTDIR})" || case $($@) in ${DESTDIR}?:*) \
668           $(MAKE) --no-print-directory reject=$@ DESTDIR-UNSUPPORTED;; \
669           esac
670         $(call mkinstalldirs,,$($@))
671
672 # Note: we MUST use a recursive make invocation here, as the
673 # "error" function within the accompanying diagnostics would be
674 # triggered, irrespective of its placement in an unexecuted
675 # branch of the above exception trapping shell code.
676 #
677 DESTDIR-UNSUPPORTED:
678         $(call MSG_DESTDIR_FORBIDDEN,$(reject),$($(reject):${DESTDIR}%=%))
679
680 # The following macros, which rely heavily on GNU make's "call"
681 # function, define the diagnostics to be emitted, when the DESTDIR
682 # exception is triggered.
683 #
684 QUOTE = `$1'#'`
685 MSG_DESTDIR_FORBIDDEN = \
686   $(warning *** $(call MSG_DESTDIR_PATH_CONFLICT,$1,Win32,$2);) \
687   $(error try $(call QUOTE,$(call MSG_DESTDIR_ALTERNATIVE,$1,$2)) instead)
688 MSG_DESTDIR_BAD_PATH = DESTDIR is not supported when $1 contains $2 path $3
689 MSG_DESTDIR_PATH_CONFLICT = $(call MSG_DESTDIR_BAD_PATH,$1,$2,$(call QUOTE,$3))
690 MSG_DESTDIR_ALTERNATIVE = make install $1="$(call MSG_DESTDIR_TRANSFORM,$2)"
691 MSG_DESTDIR_TRANSFORM = ${DESTDIR}$(shell echo $1 | sed 's/^.://')
692
693 # Install everything.
694 #
695 install: inst@DEFAULT_MAKECMDGOALS@
696 install-stage-1-only: install-headers install-libdir-objects install-libs
697 install-stage-1-and-2: install-stage-1-only install-bin
698 install-gcc: install-stage-1-only
699
700 install-strip: install-strip-mingwrt
701 install-strip-%:
702         $(MAKE) --no-print-directory \
703           STRIP_DATA='cd ${libdir}; $(STRIP) --strip-unneeded $$1' \
704           STRIP_DLL='cd ${bindir}; $(STRIP) $$1' install-$*
705
706 # Install licence files.
707 #
708 install-license: install-mingwrt-license
709 install-licence install-mingwrt-licence: %-licence: %-license
710
711 vpath DISCLAIMER ${mingwrt_srcdir}
712 vpath COPYING ${mingwrt_srcdir}/profile
713 vpath CYGWIN_LICENSE ${mingwrt_srcdir}/profile
714 mingwrt-license-files: COPYING CYGWIN_LICENSE DISCLAIMER
715
716 # FIXME: The following rule is generalized, such that it may accommodate
717 # both mingwrt and w32api, (and other packages); thus, it should ideally
718 # be relocated into a common (shared) Makefile fragment.
719 #
720 install-mingwrt-license install-w32api-license: install-%: docdir %-files
721 %-license-files:
722         $(call mkinstalldirs,,${docdir}/$*/$(PACKAGE_VERSION))
723         $(call INSTALL_DATA,$^,${docdir}/$*/$(PACKAGE_VERSION))
724
725 # Install headers associated with the MinGW runtime libraries.
726 #
727 includedirs: mingwrt-includedirs
728 install-headers install-mingwrt: install-mingwrt-headers
729
730 mingwrt-includedirs: includedir $(eval mingwrt_include_subdirs=sys parts)
731         $(call mkinstalldirs,${includedir}/,$(mingwrt_include_subdirs))
732
733 SUB_HEADERS_PRESENT = echo $1/include/$2/*.h | grep -v '[*]' > /dev/null
734 INSTALL_SUB_HEADERS = $(call INSTALL_DATA,$1/include/$2/*.h,${includedir}/$2)
735
736 install-mingwrt-headers: _mingw.h mingwrt-includedirs
737         $(call INSTALL_DATA,_mingw.h,${includedir})
738         $(call INSTALL_DATA,${mingwrt_srcdir}/include/*.h,${includedir})
739         for dir in $(mingwrt_include_subdirs); do \
740           if $(call SUB_HEADERS_PRESENT,${mingwrt_srcdir},$$dir); then \
741             $(call INSTALL_SUB_HEADERS,${mingwrt_srcdir},$$dir); \
742             fi; \
743           done
744         $(call INSTALL_DATA,${mingwrt_srcdir}/profile/*.h,${includedir})
745
746 # Install libraries, and supporting free standing object files.
747 #
748 install-libs install-mingwrt: install-mingwrt-libdir-libs
749 install-libdir-objects install-mingwrt: install-mingwrt-libdir-objects
750
751 install-mingwrt-libdir-libs: libdir $(call active_goals,install,mingwrt-libs)
752 install-mingwrt-libdir-objects: libdir $(call active_goals,install,crt-objects)
753
754 install-crt-objects install-deprecated-crt-objects \
755 install-mingwrt-libs install-deprecated-mingwrt-libs:
756         $(call INSTALL_DATA,$^,${libdir})
757         $(if $(STRIP_DATA),$(call STRIP_DATA,$^))
758
759
760 # Install DLLs.
761 #
762 install-mingwrt: install-mingwrt-dll
763 install-bin install-dll: install-mingwrt-dll
764 install-mingwrt-bin install-w32api-bin: install-%-bin: install-%-dll
765 install-mingwrt-dll install-w32api-dll: install-%-dll: bindir install-%-dll-files
766 install-%-dll-files:
767         $(call INSTALL_DATA,$^,${bindir})
768         $(if $(STRIP_DLL),$(call STRIP_DLL,$^))
769
770
771 # Install manpages.
772 #
773 vpath %.man ${mingwrt_srcdir}/man
774 install-man install-manpages: install-mingwrt-manpages
775 mingwrt-man$(man3ext): $(addsuffix .$(man3ext),basename dirname)
776 install-mingwrt-manpages: mandir mingwrt-man3
777
778 mingwrt-man%:
779         $(call mkinstalldirs,,${man$*dir})
780         $(call INSTALL_DATA,$^,${man$*dir})
781         $(RM) $^
782
783 %: %.man
784         $(call format_manpage,$(basename $*),$(suffix $*),$<) $< > $@
785
786 format_manpage = sed \
787   -e "s/%PAGEREF%/`echo $1 | tr a-z A-Z` $(2:.%=%) `date -r $3 +%d-%b-%Y`/"
788
789 basename.$(man3ext): export reference_manpage = dirname.$(man3ext).man
790 basename.$(man3ext): %: %.mancopy-recursive
791
792 %.mancopy-recursive:
793         $(MAKE) --no-print-directory $*.mancopy
794
795 %.mancopy: $(reference_manpage)
796         $(call format_manpage,$(basename $*),$(suffix $*),$<) $< > $*
797
798
799 # Undo Installation
800 # -----------------
801 #
802 uninstall: uninstall-mingwrt
803 uninstall-bin uninstall-dll uninstall-mingwrt: uninstall-mingwrt-dll
804 uninstall-mingwrt: uninstall-mingwrt-headers uninstall-mingwrt-libdir-libs
805 uninstall-mingwrt: uninstall-mingwrt-libdir-objects
806
807 REMOVE_HEADERS = cd $1 && $(RM) $(notdir $(wildcard $2))
808
809 uninstall-mingwrt-headers:
810         $(call REMOVE_HEADERS,${includedir},${mingwrt_srcdir}/include/*.h)
811         for dir in $(mingwrt_include_subdirs); do \
812           files=`cd ${mingwrt_srcdir}/include/$$dir && echo *.h`; \
813           (cd ${includedir}/$$dir && $(RM) $$files); \
814           done
815         $(call REMOVE_HEADERS,${includedir},${mingwrt_srcdir}/profile/*.h)
816
817 uninstall-mingwrt-dll \
818 uninstall-mingwrt-libdir-objects uninstall-mingwrt-libdir-libs: un%:
819         $(MAKE) --no-print-directory mkinstalldirs= \
820           INSTALL_DATA='cd $$2 && $(RM) $$1' $*
821
822
823 # Distribution
824 # ------------
825 #
826 .PHONY: dist
827 dist: devdist dlldist licdist mandist srcdist
828         $(RM) -r dist/mingwrt dist/w32api
829
830 mingwrt-dist-staged w32api-dist-staged: %-dist-staged:
831         $(RM) -r dist/$*
832         $(MAKE) --no-print-directory prefix=`pwd`/dist/$* install-strip-$*
833
834 devdist: mingwrt-devdist
835 mingwrt_devdist_objects = dist/mingwrt/lib/*.$(OBJEXT)
836 mingwrt-devdist w32api-devdist: %-devdist: %-dist-staged
837         cd dist/$* && tar chf - --hard-dereference include lib | \
838           xz -c > ../$*-$(PACKAGE_RELEASE_TAG)-dev.tar.xz
839
840 dlldist: mingwrt-dlldist
841 mingwrt-dlldist: %-dlldist: %-dist-staged
842         cd dist/$* && tar chf - --hard-dereference bin | \
843           xz -c > ../$*-$(PACKAGE_RELEASE_TAG)-dll.tar.xz
844
845 licdist: mingwrt-licdist
846 mingwrt-licdist w32api-licdist: %-licdist:
847         $(RM) -r tmp
848         $(MAKE) --no-print-directory prefix=`pwd`/tmp install-$*-licence
849         cd tmp && tar chf - --hard-dereference * | \
850           xz -c > ../dist/$*-$(PACKAGE_RELEASE_TAG)-lic.tar.xz
851         $(RM) -r tmp
852
853 mandist: mingwrt-mandist
854 mingwrt-mandist: %-mandist:
855         $(RM) -r tmp
856         $(MAKE) --no-print-directory prefix=`pwd`/tmp install-$*-manpages
857         cd tmp && tar chf - --hard-dereference share | \
858           xz -c > ../dist/$*-$(PACKAGE_RELEASE_TAG)-man.tar.xz
859         $(RM) -r tmp
860
861 srcdist: mingwrt-srcdist
862 mingwrt-srcdist: mingwrt-srcdist-dir mingwrt-srcdist-files
863         cd dist && tar chf - $(PACKAGE_TARNAME)-$(PACKAGE_VERSION) | \
864           xz -c > $(PACKAGE_TARNAME)-$(PACKAGE_RELEASE_TAG)-src.tar.xz
865         $(RM) -r dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
866
867 mingwrt-srcdist-dir:
868         $(RM) -r dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
869         $(call mkinstalldirs,,dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION))
870
871 mingwrt-srcdist-files:
872         (cd ${mingwrt_srcdir} && tar chf - --hard-dereference $(notdir $^)) | \
873           (cd dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) && tar xf -)
874
875 mingwrt-srcdist-files: $(wildcard ${mingwrt_srcdir}/*.[chs]) \
876   $(addprefix ${mingwrt_srcdir}/,ChangeLog CONTRIBUTORS DISCLAIMER README) \
877   $(wildcard ${mingwrt_srcdir}/*.def.in) $(wildcard ${mingwrt_srcdir}/config*) \
878   $(addprefix ${mingwrt_srcdir}/,aclocal.m4 VERSION.m4 install-sh Makefile.in) \
879   $(addprefix ${mingwrt_srcdir}/,TODO include man mingwex profile) \
880   $(addprefix ${mingwrt_srcdir}/,msvcrt-xref crtdll.def) \
881   $(wildcard ${mingwrt_srcdir}/*.txt)
882
883 install-html install-pdf: install-%: %dir mingwrt-man$(man3ext)
884         $(MAKE) --no-print-directory install-$*-files
885
886 install-html-files install-pdf-files: install-%-files: \
887   $(addsuffix .%,$(wildcard ${man3dir}/*.$(man3ext)))
888
889 %.$(man3ext).html: %.$(man3ext)
890         man2html $< | sed -e '1,/^<!DOCTYPE/{/^<!/p;d' -e '}' > ${htmldir}/$(notdir $@)
891         chmod 644 ${htmldir}/$(notdir $@)
892
893 %.$(man3ext).pdf: %.$(man3ext)
894         man -t $< | ps2pdf - > ${pdfdir}/$(notdir $@)
895         chmod 644 ${pdfdir}/$(notdir $@)
896
897 html-docdist pdf-docdist: %-docdist:
898         $(RM) -r tmp
899         $(MAKE) --no-print-directory prefix=`pwd`/tmp install-$*
900         $(RM) -r tmp/share/man
901         cd tmp && tar chf - --hard-dereference share | \
902           xz -c > ../dist/mingwrt-doc-$(PACKAGE_RELEASE_TAG)-$*.tar.xz
903         $(RM) -r tmp
904
905
906 # Clean-up Rules
907 # --------------
908 #
909 clean-local: mostlyclean-local
910         $(RM) msvcr*.def moldname*.def mingw*.def lib*.a *.dll
911
912 mostlyclean-local:
913         $(RM) *.d *.$(OBJEXT) Makefile.stub *.libimpl
914
915 distclean-local: clean-local
916         $(RM) config.log config.status libm_dummy.c
917
918 maintainer-clean-warning:
919         $(warning $(MAKE) $(@:%-warning=%))
920         $(warning This command should be used by package maintainers only;)
921         $(warning it deletes files which may require special tools to rebuild.)
922
923 maintainer-clean-local: maintainer-clean-warning distclean-local
924         $(RM) -r ${mingwrt_srcdir}/autom4te.cache
925
926 clean mostlyclean distclean maintainer-clean: %clean: %clean-local
927
928 # $RCSfile$: end of file