# Non-copyrightable material; adjust the following definition, to
# assign a common version number to each of the mingwrt and w32api
# MinGW System Library sub-packages.
-
+#
m4_define([__VERSION__],[5.0])
+# This is also a convenient place to specify the import library
+# associations, and DLLVERSION information for each DLL which may
+# be delivered by this package; each specification record takes
+# the form of three data fields, comprising:
+#
+# 1) A tag field, which maps the assignment to a makefile variable
+# substitution reference of the form @MAP_[TAG]_A_DLLVERSION@.
+#
+# 2) The name of the import library associated with the mapping.
+#
+# 3) The DLLVERSION for the corresponding DLL; this must be in the
+# libtool current:revision:age notation, and should be updated,
+# as required, in accordance with libtool conventions.
+#
+m4_define([MINGW_AC_ENUMERATE_DLLVERSION_SPECS],dnl
+[MINGW_AC_SET_DLLVERSION([LIBMINGWEX], [libmingwex.dll.a], [0:0:0])dnl
+])
+
# $RCSfile$: end of file
+2017-02-27 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ Support optional DLL builds from static libraries.
+
+ * aclocal.m4 (MINGW_AC_SET_DLLVERSION): New macro; define it, and...
+ * VERSION.m4: ...use it here, to enumerate the specifcations for...
+ (MINGW_AC_ENUMERATE_DLLVERSION_SPECS): ...this collection of DLL
+ version identification records.
+
+ * Makefile.in (DLLVERSION): New macro; define default, and capture
+ library specific variants, as generated by AC_SUBST output from...
+ (MINGW_AC_ENUMERATE_DLLVERSION_SPECS): ...this configuration macro.
+ (a2dll, dllname, dllsuffix): New macros; define them, together with
+ new pattern rule using them, to create DLLs and import libraries from
+ existing static object libraries; augment these with...
+ (optional_dll_version): ...this further new macro, used by...
+ (install-optional-dlls, install-mingwrt-optional-dlls)
+ (install-libmingwex-optional-dll): ...these new installation rules...
+ (uninstall-optional-dlls, uninstall-mingwrt-optional-dlls): ...and
+ counterpart rules, to uninstall all such optional DLL files.
+ (optional_dll_package): Further new macro; it is required by...
+ (optdist, mingwrt-optdist, mingwrt-libmingwex-optdist): ...these new
+ distribution rules; they create packages for optional DLLs.
+ (dist): Add optdist.
+
+ * configure.ac (MINGW_AC_ENUMERATE_DLLVERSION_SPECS): Invoke it.
+
2017-02-24 Keith Marshall <keithmarshall@users.sourceforge.net>
Make floating point environment more robust.
libgmon.a: $(addsuffix .$(OBJEXT), gmon mcount profil)
+# Optional DLL Generation Rules
+# -----------------------------
+#
+# The following rules are provided to accommodate optional delivery
+# of certain of the static libraries, generated as components of this
+# package, in the alternative form of DLLs, each with an accompanying
+# import library. Each such DLL should be versioned, ideally with an
+# explicitly specified version number, but we provide this fall back
+# as a catch-all default for any which is not so specified; (all such
+# version specifications should be in the "current:revision:age" form,
+# conforming to the GNU-libtool convention).
+#
+DLLVERSION = "0:0:0"
+
+# Generally, we should prefer to have explicit version specifications,
+# relating individually to each DLL; these are specified in VERSION.m4,
+# and propagated here via configure time substitution.
+#
+@MAP_LIBMINGWEX_A_DLLVERSION@
+
+# For convenience, we implement the DLL build rule in the form of a
+# generic pattern rule, invoked in the form of a request to build any
+# version-agnostic import library; the versioned DLL is then built as
+# a side effect of building the import library.
+#
+# Note that, in addition to the obvious dependency on the originating
+# static library, we also make this depend on configure; this ensures
+# that DLL version changes, specified in VERSION.m4, are propagated.
+#
+# Further note that we use an alternatively named reference link to
+# the originating static library, as code source for the DLL, rather
+# than the original name; this is to work around a limitation of the
+# handling of --whole-archive, by GNU-ld, which suppresses creation
+# of an exports table, in the event that the same static library is
+# named among GCC's implicit default libraries, after reverting to
+# --no-whole-archive operation.
+#
+%.dll.a: %.a configure
+ $(LN_S) -f $< tmp$<
+ $(CC) $(call a2dll,tmp$<,$(call dllname,$*)) -L. -Wl,--out-implib=$@
+ $(RM) tmp$<
+
+dllname = $1-$(dllsuffix).dll
+a2dll = -shared -o $2 -Wl,--whole-archive $1 -Wl,--no-whole-archive
+dllsuffix = `echo $(DLLVERSION) | awk -F: '{printf "%d",$$1-$$3}'`
+
+all-optional-dlls: all-mingwrt-optional-dlls
+all-mingwrt-optional-dlls: libmingwex.dll.a
+
+
# Installation Rules
# ------------------
#
$(call INSTALL_DATA,$^,${bindir})
$(if $(STRIP_DLL),$(call STRIP_DLL,$^))
+$(call optional_dll_version,libmingwex,@MAP_LIBMINGWEX_A_DLLVERSION@)
+optional_dll_version = $(shell echo '$2' | sed s,^[^:]*,install-$1-optional-dll,)
+
+install-optional-dlls: install-mingwrt-optional-dlls
+install-mingwrt-optional-dlls: install-libmingwex-optional-dll
+install-%-optional-dll: %.dll.a bindir libdir
+ $(call INSTALL_DATA,$<,${libdir})
+ $(call INSTALL_DATA,$(call dllname,$*),${bindir})
+ $(if $(STRIP_DLL),$(call STRIP_DLL,$(call dllname,$*)))
+ $(if $(STRIP_DATA),$(call STRIP_DATA,$<))
+
# Install manpages.
#
#
uninstall: uninstall-mingwrt
uninstall-bin uninstall-dll uninstall-mingwrt: uninstall-mingwrt-dll
+uninstall-optional-dlls uninstall-mingwrt: uninstall-mingwrt-optional-dlls
uninstall-mingwrt: uninstall-mingwrt-headers uninstall-mingwrt-libdir-libs
uninstall-mingwrt: uninstall-mingwrt-libdir-objects
done
$(call REMOVE_HEADERS,${includedir},${mingwrt_srcdir}/profile/*.h)
-uninstall-mingwrt-dll \
+uninstall-mingwrt-dll uninstall-mingwrt-optional-dlls \
uninstall-mingwrt-libdir-objects uninstall-mingwrt-libdir-libs: un%:
$(MAKE) --no-print-directory mkinstalldirs= \
INSTALL_DATA='cd $$2 && $(RM) $$1' $*
# ------------
#
.PHONY: dist
-dist: devdist dlldist licdist mandist srcdist
+dist: devdist dlldist licdist mandist optdist srcdist
$(RM) -r dist/mingwrt dist/w32api
mingwrt-dist-staged w32api-dist-staged: %-dist-staged:
xz -c > ../dist/$*-$(PACKAGE_RELEASE_TAG)-man.tar.xz
$(RM) -r tmp
+optdist: mingwrt-optdist
+mingwrt-optdist: mingwrt-libmingwex-optdist
+
+$(call optional_dll_package,libmingwex,@MAP_LIBMINGWEX_A_DLLVERSION@)
+optional_dll_package = $(shell echo '$2' | sed s,^[^:]*,mingwrt-$1-optdist)
+
+mingwrt-%-optdist:
+ $(RM) -r tmp
+ $(MAKE) --no-print-directory prefix=`pwd`/tmp install-$*-optional-dll
+ cd tmp && tar chf - --hard-dereference bin | \
+ xz -c > ../dist/$*-$(PACKAGE_RELEASE_TAG)-dll-$(dllsuffix).tar.xz
+ cd tmp && tar chf - --hard-dereference lib | \
+ xz -c > ../dist/$*-$(PACKAGE_RELEASE_TAG)-dev.tar.xz
+ $(RM) -r tmp
+
srcdist: mingwrt-srcdist
mingwrt-srcdist: mingwrt-srcdist-dir mingwrt-srcdist-files
cd dist && tar chf - $(PACKAGE_TARNAME)-$(PACKAGE_VERSION) | \