OSDN Git Service

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