OSDN Git Service

Extend basic test suite infrastructure to w32api.
[mingw/mingw-org-wsl.git] / w32api / Makefile.in
index d534c97..b6d7b83 100644 (file)
@@ -7,7 +7,7 @@ PACKAGE_TARNAME := @PACKAGE_TARNAME@
 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
@@ -78,6 +78,7 @@ mkinstalldirs = @MKDIR_P@ $(addprefix $1,$2)
 
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@ $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
@@ -108,16 +109,15 @@ config.status.missing:
 # 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
+       cd ${top_srcdir}; autoconf -I ..
 
 # Propagate package version, as configured, consistently throughout
 # the package build.
 #
-vpath w32api.h.in ${top_srcdir}/include
-vpath _mingw.h.in ${mingwrt_srcdir}/include
+vpath %.h.in ${top_srcdir}/include ${mingwrt_srcdir}/include
 
 w32api.h _mingw.h: configure.ac
 
@@ -260,8 +260,28 @@ w32api-include-dirs: includedir
 w32api-lib-dirs: libdir
 
 install-headers: install-w32api-headers
-install-w32api-headers: w32api.h w32api-include-dirs
-       $(call INSTALL_DATA,w32api.h ${srcdir}/include/*.h,${includedir})
+
+obsolete_headers := winable.h pbt.h
+winable.h pbt.h: replacement = winuser.h
+
+$(obsolete_headers): %.h: obsolete.h.in
+       $(if $(subst ./,,$(dir $@)),mkdir -p $(@D))
+       $(obsolete_header_script) $< > $@
+
+obsolete_header_script = sed -e 's,%HEADER%,$@,' \
+  -e "s,%PACKAGE%,$(call macro_name,$(PACKAGE_TARNAME))," \
+  -e 's,<REPLACEMENT>,$(call replace_header,$(replacement)),' \
+  -e "s,%GUARD_MACRO%,$(call macro_name,$@)," \
+  -e 's,%REPLACEMENT%,$(replacement),'
+
+replace_header = $(if $(subst ./,,$(dir $1)),<$1>,"$1")
+macro_name = `echo $1 | tr .a-z- _A-Z_`
+
+w32api_generated_headers := w32api.h $(obsolete_headers)
+w32api_dist_headers := $(w32api_generated_headers) ${srcdir}/include/*.h
+
+install-w32api-headers: $(w32api_dist_headers)  w32api-include-dirs
+       $(call INSTALL_DATA,$(w32api_dist_headers),${includedir})
        for dir in $(w32api_extra_include_dirs); do \
          $(call INSTALL_DATA,${srcdir}/include/$$dir/*.h,${includedir}); \
          done
@@ -297,6 +317,16 @@ uninstall-w32api-libs: un%:
        $(MAKE) --no-print-directory mkinstalldirs= \
          INSTALL_DATA='cd $$2 && rm -f $$1' $*
 
+
+# Test Suite
+# ----------
+#
+.PHONY: check-recursive
+check test tests: check-recursive
+check-recursive:
+       $(MAKE) -C tests $@
+
+
 # Distribution
 # ------------
 #
@@ -325,11 +355,24 @@ mingwrt-srcdist w32api-srcdist: %-srcdist: %-srcdist-dir %-srcdist-files
          xz -c > $*-$(PACKAGE_RELEASE_TAG)-src.tar.xz
        $(RM) -r dist/$*-$(PACKAGE_VERSION)
 
+w32api-srcdist-testsuite-files: $(wildcard ${w32api_srcdir}/tests/*.at)
+w32api-srcdist-testsuite-files: $(wildcard ${w32api_srcdir}/tests/*.in)
+       (cd ${w32api_srcdir} && tar chf - $(addprefix tests/,$(notdir $^))) | \
+         (cd dist/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) && tar xf -)
+
 mingwrt-srcdist-dir w32api-srcdist-dir: %-srcdist-dir:
        $(RM) -r dist/$*-$(PACKAGE_VERSION)
        $(call mkinstalldirs,,dist/$*-$(PACKAGE_VERSION))
 
-mingwrt-srcdist-files w32api-srcdist-files: %-srcdist-files:
+w32api-srcdist-files: w32api-srcdist-config-files
+w32api-srcdist-files: w32api-srcdist-testsuite-files
+w32api-srcdist-files: w32api-srcdist-package-files
+
+vpath install-sh ${top_srcdir}/.. ${top_srcdir}
+%-srcdist-config-files: aclocal.m4 VERSION.m4 install-sh
+         cp -p $^ dist/$*-$(PACKAGE_VERSION)
+
+%-srcdist-package-files:
        (cd ${$*_srcdir} && tar chf - --hard-dereference $(notdir $^)) | \
          (cd dist/$*-$(PACKAGE_VERSION) && tar xf -)
 
@@ -337,12 +380,10 @@ mingwrt-devdist w32api-devdist: %-devdist: %-dist-staged
        cd dist/$* && tar chf - --hard-dereference include lib | \
          xz -c > ../$*-$(PACKAGE_RELEASE_TAG)-dev.tar.xz
 
-SRCDIST_ADD = $1-srcdist-files: $(addprefix ${$1_srcdir}/,$2)
+SRCDIST_ADD = $1-srcdist-package-files: $(addprefix ${$1_srcdir}/,$2)
 
 $(call SRCDIST_ADD,w32api,ChangeLog CONTRIBUTIONS README.w32api TODO)
-$(call SRCDIST_ADD,w32api,configure configure.ac aclocal.m4 Makefile.in)
-$(call SRCDIST_ADD,w32api,install-sh include lib)
-
+$(call SRCDIST_ADD,w32api,configure configure.ac Makefile.in include lib)
 
 # Clean-up Rules
 # --------------