PACKAGE_VERSION := @PACKAGE_VERSION@
# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
-# Copyright (C) 2014-2016, MinGW.org Project
+# Copyright (C) 2014-2017, MinGW.org Project
#
#
# Permission is hereby granted, free of charge, to any person obtaining a
# If configure itself needs to be updated, we must run autoconf in the
# top level source directory.
#
-vpath %.m4 ${top_srcdir}
vpath configure.ac ${top_srcdir}
+vpath %.m4 ${top_srcdir}/.. ${top_srcdir}
configure: configure.ac aclocal.m4 VERSION.m4
- cd ${top_srcdir}; autoconf
-
-${top_srcdir}/%: ${top_srcdir}/../%
- cd $(dir $@) && $(LN_S) -f ../$* .
+ cd ${top_srcdir}; autoconf -I ..
# Propagate package version, as configured, consistently throughout
# the package build.
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -D__CRTDLL__ -o $@ $<
# ...while, for the current build case, we need an explicit mapping
-# to identify the disparately named source file.
+# to identify the disparately named source file...
#
$(addsuffix .$(OBJEXT), crt2 dllcrt2): %2.$(OBJEXT): %1.c
$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
+# ...and for the pair of default FPU configuration selectors, we
+# need to pass the configuration specification to the compiler, when
+# compiling the common source for each of the two cases.
+#
+CRT_fp8.$(OBJEXT) CRT_fp10.$(OBJEXT): CRT_fp%.$(OBJEXT): CRT_fenv.c
+ $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -D_CRT_FE_DFL_ENV=$* -o $@ $<
+
# The initialization hook for profiling code is inherited from Cygwin,
# where it is built as gcrt0.$(OBJEXT); we build it, unmodified, as each
# of gcrt1.$(OBJEXT) and gcrt2.$(OBJEXT), to satisfy the differing GCC
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 $(LIBGCC_LINK_OPTION)
+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
+
+# In most optional DLL build cases, we should avoid creating any
+# unnecessary dependency on (known to be broken) -shared-libgcc
+#
+libmingwex.dll.a: LIBGCC_LINK_OPTION = -static-libgcc
+
+
# 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' $*
+# Test Suite
+# ----------
+#
+.PHONY: check-recursive
+check test tests: check-recursive
+check-recursive:
+ $(MAKE) -C tests $@
+
+
# Distribution
# ------------
#
.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) | \
$(RM) -r dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
$(call mkinstalldirs,,dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION))
-mingwrt-srcdist-files: mingwrt-srcdist-package-files
+mingwrt-srcdist-files: mingwrt-srcdist-config-files
mingwrt-srcdist-files: mingwrt-srcdist-testsuite-files
+mingwrt-srcdist-files: mingwrt-srcdist-package-files
+
+vpath install-sh ${top_srcdir}/.. ${top_srcdir}
+mingwrt-srcdist-config-files: aclocal.m4 VERSION.m4 install-sh
+ cp -p $^ dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
mingwrt-srcdist-package-files:
(cd ${mingwrt_srcdir} && tar chf - --hard-dereference $(notdir $^)) | \
mingwrt-srcdist-package-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 VERSION.m4 install-sh Makefile.in) \
- $(addprefix ${mingwrt_srcdir}/,TODO include man mingwex profile) \
- $(addprefix ${mingwrt_srcdir}/,msvcrt-xref crtdll.def) \
+ $(addprefix ${mingwrt_srcdir}/,include man mingwex msvcrt-xref profile) \
+ $(addprefix ${mingwrt_srcdir}/,TODO Makefile.in crtdll.def) \
$(wildcard ${mingwrt_srcdir}/*.txt)
mingwrt-srcdist-testsuite-files: $(wildcard ${mingwrt_srcdir}/tests/*.at)
clean mostlyclean distclean maintainer-clean: %clean: %clean-local
-# Testsuite
-# ---------
-#
-.PHONY: check-recursive
-check tests: check-recursive
-check-recursive:
- $(MAKE) -C tests $@
-
# $RCSfile$: end of file