PACKAGE_VERSION := @PACKAGE_VERSION@
# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
-# Copyright (C) 2014, 2015, MinGW.org Project
+# Copyright (C) 2014-2016, MinGW.org Project
#
#
# Permission is hereby granted, free of charge, to any person obtaining a
NM = @NM@
all: @DEFAULT_MAKECMDGOALS@
+all-mingwrt-stage-1-only: _mingw.h w32api.h
all-mingwrt-stage-1-only: all-mingwrt-objects all-mingwrt-libs
all-mingwrt-stage-1-and-2: all-mingwrt-stage-1-only all-mingwrt-dll
all-mingwrt: all-mingwrt-stage-1-and-2
INSTALL_DATA = @INSTALL_DATA@ $1 $2
mkinstalldirs = @MKDIR_P@ $(addprefix $1,$2)
+LN_S = @LN_S@
# Keep the configuration in a consistent state. Note that we assume
# that configure has been run initially, (otherwise we wouldn't have
#
vpath %.m4 ${top_srcdir}
vpath configure.ac ${top_srcdir}
-configure: configure.ac aclocal.m4
+configure: configure.ac aclocal.m4 VERSION.m4
cd ${top_srcdir}; autoconf
+${top_srcdir}/%: ${top_srcdir}/../%
+ cd $(dir $@) && $(LN_S) -f ../$* .
+
+# Propagate package version, as configured, consistently throughout
+# the package build.
+#
+vpath _mingw.h.in ${top_srcdir}/include
+vpath w32api.h.in ${w32api_srcdir}/include
+
+_mingw.h w32api.h: configure.ac
+
+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; \
+}'
+
+_mingw.h w32api.h: %.h: %.h.in
+ $(PACKAGE_VERSION_SCRIPT) $< > $@
+
# Capture dependencies conveyed within source files, ensuring that
# header files are taken from our working source tree, and not from
# the build-time compiler's installation path. (Note: we use -MD,
$(foreach name,coldname $(all_moldname),lib$(name).a): $(addsuffix .$(OBJEXT), \
isascii iscsym iscsymf toascii)
+# Selected versions of the oldname libraries also provide a
+# convenient vehicle for delivery of stubs, emulating functions
+# which appear in later MSVCRT versions, and which we also wish
+# to support in conjunction with earlier versions.
+#
+$(foreach name,moldname $(addprefix moldname,70 71),lib$(name).a) \
+$(foreach name,moldname $(addprefix moldname,70 71),lib$(name)d.a): \
+ strnlen.jmpstub.$(OBJEXT)
+
coldname.def: %.def: ${mingwrt_srcdir}/moldname.def.in
$(CC) -C -E -P -D__FILENAME__=$@ -D__CRTDLL__ -xc-header $< > $@
fmt = "\nlib%s.a: %s\n%s: jmpstub.sx\n\t$$(COMPILE.sx) %s -o $$@ $$^\n"; \
} \
/__JMPSTUB(__)? *[(].*FUNCTION/ { \
- LIB = "mingwex"; \
FUNCTION = gensub( ".*[ ,(:]FUNCTION *= *"symbol".*", "\\1", 1 ); \
+ LIB = match( $$0, ".*[ ,(:]LIB *= *"symbol, altlib ) ? altlib[1] : "mingwex"; \
OBJNAME = gensub( "_*(.*)_*", "\\1", 1, FUNCTION )".jmpstub.$$(OBJEXT)"; \
OBJNAME_CFLAGS = "-D FUNCTION="FUNCTION; \
if( match( $$0, ".*[ ,(:]REMAPPED *= *"symbol, alias ) ) \
fmt = "\nlib%s.a: %s\n%s.libimpl: %s\n"; \
} \
/__LIBIMPL(__)? *[(].*FUNCTION/ { \
- LIB = "mingwex"; \
FUNCTION = gensub( ".*[ ,(:]FUNCTION *= *"symbol".*", "\\1", 1 ); \
+ LIB = match( $$0, ".*[ ,(:]LIB *= *"symbol, altlib ) ? altlib[1] : "mingwex"; \
OBJNAME = gensub( "_*(.*)_*", "\\1", 1, FUNCTION )".libimpl.$$(OBJEXT)"; \
printf fmt, LIB, OBJNAME, FUNCTION, FILENAME; \
} \
install-strip: install-strip-mingwrt
install-strip-%:
- $(MAKE) --no-print-directory $(MAKEFLAGS) \
+ $(MAKE) --no-print-directory \
STRIP_DATA='cd ${libdir}; $(STRIP) --strip-unneeded $$1' \
STRIP_DLL='cd ${bindir}; $(STRIP) $$1' install-$*
SUB_HEADERS_PRESENT = echo $1/include/$2/*.h | grep -v '[*]' > /dev/null
INSTALL_SUB_HEADERS = $(call INSTALL_DATA,$1/include/$2/*.h,${includedir}/$2)
-install-mingwrt-headers: mingwrt-includedirs
+install-mingwrt-headers: _mingw.h mingwrt-includedirs
+ $(call INSTALL_DATA,_mingw.h,${includedir})
$(call INSTALL_DATA,${mingwrt_srcdir}/include/*.h,${includedir})
for dir in $(mingwrt_include_subdirs); do \
if $(call SUB_HEADERS_PRESENT,${mingwrt_srcdir},$$dir); then \
uninstall-mingwrt-dll \
uninstall-mingwrt-libdir-objects uninstall-mingwrt-libdir-libs: un%:
- $(MAKE) --no-print-directory $(MAKEFLAGS) mkinstalldirs= \
+ $(MAKE) --no-print-directory mkinstalldirs= \
INSTALL_DATA='cd $$2 && $(RM) $$1' $*
mingwrt-srcdist-files: $(wildcard ${mingwrt_srcdir}/*.[chs]) \
$(addprefix ${mingwrt_srcdir}/,ChangeLog CONTRIBUTORS DISCLAIMER README) \
$(wildcard ${mingwrt_srcdir}/*.def.in) $(wildcard ${mingwrt_srcdir}/config*) \
- $(addprefix ${mingwrt_srcdir}/,aclocal.m4 install-sh Makefile.in TODO) \
- $(addprefix ${mingwrt_srcdir}/,include man mingwex profile) \
- $(addprefix ${mingwrt_srcdir}/,crtdll.def) \
+ $(addprefix ${mingwrt_srcdir}/,aclocal.m4 VERSION.m4 install-sh Makefile.in) \
+ $(addprefix ${mingwrt_srcdir}/,TODO include man mingwex profile) \
+ $(addprefix ${mingwrt_srcdir}/,msvcrt-xref crtdll.def) \
$(wildcard ${mingwrt_srcdir}/*.txt)
install-html install-pdf: install-%: %dir mingwrt-man$(man3ext)