# @configure_input@
# $Id$
#
-# Makefile template for MinGW.org MS-Windows API Package
+# Makefile template for MinGW.OSDN MS-Windows API Package
PACKAGE_TARNAME := @PACKAGE_TARNAME@
PACKAGE_VERSION := @PACKAGE_VERSION@
-# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
-# Copyright (C) 2014-2016, MinGW.org Project
+# Written by Keith Marshall <keith@users.osdn.me>
+# Copyright (C) 2014-2017, 2021, 2022, MinGW.OSDN Project
#
#
# Permission is hereby granted, free of charge, to any person obtaining a
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
-# a Makefile to begin with); since this also creates config.status,
-# we may normally assume that it is already available ...
+# Include the makefile content which is common to both the mingwrt,
+# and the w32api packages; this may be included within the top level
+# source directory for each package individually, but we must also
+# be prepared to find it in their common parent directory.
#
-vpath configure ${top_srcdir}
-config.status: configure
- $(SHELL) config.status --recheck
-
-# ... in which case, updating Makefile should be a simple matter of
-# running config.status ...
-#
-vpath Makefile.in ${top_srcdir}
-requires_existing = $(if $(wildcard $1),$1,$1.missing)
-Makefile: Makefile.in configure $(call requires_existing,config.status)
- $(SHELL) config.status
-
-.PHONY: config.status.missing
-# ... but, in the event that this may be missing, (e.g. because it
-# has been manually removed, or removed by "make distclean"), suggest
-# running configure, and bail out.
-#
-config.status.missing:
- $(warning *** cannot execute config.status)
- $(error please run ${top_srcdir}/configure to regenerate it.)
-
-# 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}
-configure: configure.ac aclocal.m4 VERSION.m4
- cd ${top_srcdir}; autoconf
-
-# Propagate package version, as configured, consistently throughout
-# the package build.
-#
-vpath w32api.h.in ${top_srcdir}/include
-vpath _mingw.h.in ${mingwrt_srcdir}/include
-
-w32api.h _mingw.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; \
-}'
-
-w32api.h _mingw.h: %.h: %.h.in
- $(PACKAGE_VERSION_SCRIPT) $< > $@
+shared_include_file = $1$(if $(wildcard $1/$2),,/..)/$2
+include $(call shared_include_file,${top_srcdir},Makefile.comm)
# Capture dependencies conveyed within source files, ensuring that
# header files are taken from our working source tree, and not from
$(if $(filter-out $<,$^),$(AR) $(ARFLAGS) $@ $(filter-out $<,$^))
vpath %.c ${srcdir}/lib
+libkernel32.a: $(addsuffix .$(OBJEXT),k32entry bound osvercmp)
+
+NO_ALIGN_FLAGS := -fno-align-jumps -fno-align-functions
+bound.$(OBJEXT) unbound.$(OBJEXT): %.$(OBJEXT): availapi.c
+ $(CC) -c $(ALL_CFLAGS) $(NO_ALIGN_FLAGS) -D_$* $< -o $@
+
+bound_dll_api_list := k32entry
+$(addsuffix .$(OBJEXT),$(bound_dll_api_list)): %.$(OBJEXT): availapi.c
+ $(CC) -c $(ALL_CFLAGS) $(NO_ALIGN_FLAGS) -D_bound -D_lib=$* $< -o $@
+
libuuid.a: ativscp-uuid.$(OBJEXT) cguid-uuid.$(OBJEXT)
libuuid.a: comcat-uuid.$(OBJEXT) devguid.$(OBJEXT) docobj-uuid.$(OBJEXT)
libuuid.a: exdisp-uuid.$(OBJEXT) extras-uuid.$(OBJEXT) hlguids-uuid.$(OBJEXT)
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
$(if $(STRIP_LIBS),$(call STRIP_LIBS,$(filter-out w32api-lib-reqs,$^)))
install-strip-w32api-libs:
- $(MAKE) --no-print-directory $(MAKEFLAGS) \
+ $(MAKE) --no-print-directory \
STRIP_LIBS='cd ${libdir}; $(STRIP) --strip-unneeded $$1' \
install-w32api-libs
done
uninstall-w32api-libs: un%:
- $(MAKE) --no-print-directory $(MAKEFLAGS) mkinstalldirs= \
+ $(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
# ------------
#
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-common-files
+w32api-srcdist-files: w32api-srcdist-testsuite-files
+w32api-srcdist-files: w32api-srcdist-package-files
+
+%-srcdist-package-files:
(cd ${$*_srcdir} && tar chf - --hard-dereference $(notdir $^)) | \
(cd dist/$*-$(PACKAGE_VERSION) && tar xf -)
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,config.guess config.sub install-sh)
-$(call SRCDIST_ADD,w32api,include lib)
-
+$(call SRCDIST_ADD,w32api,configure configure.ac Makefile.in include lib)
# Clean-up Rules
# --------------
$(RM) *.d *.$(OBJEXT)
distclean-local: clean-local
- $(RM) config.log config.status
+ $(RM) config.log config.status _mingw.h w32api.h
maintainer-clean-warning:
$(warning $(MAKE) $(@:%-warning=%))