env_pre.mk: Check in, at bare minimum, the needed pieces to point people in the right direction as far as the make 3.81 requirement is concerned.
functions.mk: Add some make 3.80 compatibility functions.
Makefile: Remove make 3.81-ism's.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
diff --git a/Makefile b/Makefile
index 9bbf231..bb6dc70 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,10 @@
 INSTALL_TARGETS		:= doc
 endif
 
+define target_to_dir_dep_mapping
+$(1): | $$(abs_top_builddir)/$(patsubst %-,%,$(1))
+endef
+
 COMMON_TARGETS		+= testcases tools
 INSTALL_TARGETS		+= $(COMMON_TARGETS) runtest
 CLEAN_TARGETS		+= $(COMMON_TARGETS) lib include runtest
@@ -96,7 +100,7 @@
 $(MAKE_TARGETS): lib-install
 
 .PHONY: include-all include-install
-include-install: include/config.h include/mk/config.mk include-all
+include-install: $(top_builddir)/include/config.h include/mk/config.mk include-all
 
 INSTALL_DIR		:= $(DESTDIR)/$(prefix)
 
@@ -109,14 +113,14 @@
 
 lib-install: lib-all
 
-.SECONDEXPANSION:
-$(MAKE_TARGETS) include-all lib-all: %-all: $(abs_top_builddir)/$$*
-	$(MAKE) -C $* -f "$(abs_top_srcdir)/$*/Makefile" all 
+$(MAKE_TARGETS) include-all lib-all:
+	$(MAKE) -C "$(subst -all,,$@)" \
+		-f "$(abs_top_srcdir)/$(subst -all,,$@)/Makefile" all
 
 # Let's not conflict with ac-clean, maintainer-clean, etc, so.
-.SECONDEXPANSION:
-$(filter-out include-clean,$(CLEAN_TARGETS)):: %-clean: $(abs_top_builddir)/$$*
-	-$(MAKE) -C $* -f "$(abs_top_srcdir)/$*/Makefile" clean
+$(filter-out include-clean,$(CLEAN_TARGETS))::
+	-$(MAKE) -C "$(subst -clean,,$@)" \
+		 -f "$(abs_top_srcdir)/$(subst -clean,,$@)/Makefile" clean 
 
 # Just like everything depends on include-all / -install, we need to get rid
 # of include last to ensure that things won't be monkey screwed up. Only do
@@ -133,14 +137,14 @@
 INCLUDE_CLEAN_RDEPS		:= $(filter-out include-clean,\
 						$(INCLUDE_CLEAN_RDEP_SUBJECT))
 
-include-clean:: $(INCLUDE_CLEAN_RDEPS) $(abs_top_builddir)/include
+include-clean:: $(INCLUDE_CLEAN_RDEPS) | $(abs_top_builddir)/include
 	-$(MAKE) -C include -f "$(abs_top_srcdir)/include/Makefile" clean
 
 # include-install is separate to avoid creating a circular dependency below in
 # the install target.
-.SECONDEXPANSION:
-$(INSTALL_TARGETS) include-install lib-install: %-install: $(abs_top_builddir)/$$*
-	$(MAKE) -C $* -f "$(abs_top_srcdir)/$*/Makefile" install 
+$(INSTALL_TARGETS) include-install lib-install:
+	$(MAKE) -C "$(subst -install,,$@)" \
+		-f "$(abs_top_srcdir)/$(subst -install,,$@)/Makefile" all
 
 # Just in case configure hasn't been run yet, let's not overambitiously remove
 # the $(INSTALL_DIR).
@@ -148,6 +152,10 @@
 	$(RM) -f Version
 	$(if $(DESTDIR)$(prefix),-$(RM) -Rf "$(INSTALL_DIR)")
 
+$(foreach tgt,$(eval $(call target_to_dir_dep_mapping,$(tgt))),\
+	$(MAKE_TARGETS) include-all lib-all $(CLEAN_TARGETS) \
+	$(INSTALL_TARGETS) include-install lib-install)
+
 SRCDIR_INSTALL_SCRIPTS	:= execltp IDcheck.sh runalltests.sh runltp runltplite.sh ver_linux
 SRCDIR_INSTALL_READONLY	:= Version
 SRCDIR_INSTALL_TARGETS	:= $(SRCDIR_INSTALL_SCRIPTS) $(SRCDIR_INSTALL_READONLY)
diff --git a/include/mk/env_pre.mk b/include/mk/env_pre.mk
index fa7f9b9..3e57f1d 100644
--- a/include/mk/env_pre.mk
+++ b/include/mk/env_pre.mk
@@ -27,11 +27,34 @@
 ifndef ENV_PRE_LOADED
 ENV_PRE_LOADED = 1
 
+ifndef MAKE_VERSION_CHECK
+export MAKE_VERSION_CHECK = 1
+ifneq ($(MAKE_VERSION),3.81)
+$(error Only make 3.81 is supported at this time. Please read the Requirements section in INSTALL)
+endif
+# XXX (garrcoop): Junk for later...
+#ifneq ($(firstword $(sort 3.80 $(MAKE_VERSION))),3.80)
+#$(error Your version of make $(MAKE_VERSION) is too old. Upgrade to at least 3.80 (3.81+ preferred))
+#else
+#ifeq ($(MAKE_VERSION),3.80)
+#$(warning make 3.80 is not currently supported in LTP)
+#$(error I apologize for the inconvenience, but I am working on it as quickly as I can! -Garrett)
+#export MAKE_3_80_COMPAT	:= 1
+#endif # make 3.80?
+#endif # At least make 3.80?
+endif # MAKE_VERSION_CHECK
+
 # Get the absolute path for the source directory.
 top_srcdir			?= $(error You must define top_srcdir before including this file)
 
+include $(top_srcdir)/include/mk/functions.mk
+
 # Where's the root source directory?
+ifdef MAKE_3_80_COMPAT
+abs_top_srcdir			:= $(call MAKE_3_80_abspath,$(top_srcdir))
+else
 abs_top_srcdir			:= $(abspath $(top_srcdir))
+endif
 
 #
 # Where's the root object directory?
@@ -42,20 +65,34 @@
 top_builddir			?= $(top_srcdir)
 
 # We need the absolute path...
+ifdef MAKE_3_80_COMPAT
+abs_top_builddir		:= $(call MAKE_3_80_abspath,$(top_builddir))
+else
 abs_top_builddir		:= $(abspath $(top_builddir))
+endif
 
 # Where's the root object directory?
 builddir			:= .
 
 abs_builddir			:= $(CURDIR)
 
-# Where's the source located at? Squish all of the / away by using abspath...
-abs_srcdir			:= $(abspath $(abs_top_srcdir)/$(subst $(abs_top_builddir),,$(abs_builddir)))
+cwd_rel_from_top		:= $(subst $(abs_top_builddir),,$(abs_builddir))
 
-srcdir				:= $(or $(subst $(abs_top_srcdir)/,,$(abs_srcdir)),.)
+# Where's the source located at? Squish all of the / away by using abspath...
+ifdef MAKE_3_80_COMPAT
+abs_srcdir			:= $(call MAKE_3_80_abspath,$(abs_top_srcdir)/$(cwd_rel_from_top))
+else
+abs_srcdir			:= $(abspath $(abs_top_srcdir)/$(cwd_rel_from_top))
+endif
+
+srcdir				:= $(strip $(subst $(abs_top_srcdir)/,,$(abs_srcdir)))
+
+ifeq ($(srcdir),)
+srcdir				:= .
+endif
 
 ifneq ($(abs_builddir),$(abs_srcdir))
-export OUT_OF_BUILD_TREE	:= 1
+OUT_OF_BUILD_TREE		:= 1
 endif
 
 # We can piece together where we're located in the source and object trees with
diff --git a/include/mk/functions.mk b/include/mk/functions.mk
index 8b7d446..7885db5 100644
--- a/include/mk/functions.mk
+++ b/include/mk/functions.mk
@@ -20,6 +20,12 @@
 # Garrett Cooper, July 2009
 #
 
+SQUOTE			:= '
+
+# ' # to keep colorized editors from going nuts
+
+MAKE_3_80_abspath	= $(shell readlink -f '$(subst $(SQUOTE),\\$(SQUOTE),$(1))')
+
 #
 # Generate the directory install dependency separate from generate_install_rule
 # to avoid noise from Make about redefining existing targets, for good reason.
@@ -30,10 +36,13 @@
 #      likely be `empty'.
 #
 define generate_install_rule_dir_dep
-
-$$(abspath $(DESTDIR)/$(1)/$(2)):
+ifdef MAKE_3_80_COMPAT
+DIR	:= $$(call MAKE_3_80_abspath,$(DESTDIR)/$(1)/$(2))
+else
+DIR	:= $$(abspath $(DESTDIR)/$(1)/$(2))
+endif
+$$(DIR):
 	mkdir -p "$$@"
-
 endef
 
 #
@@ -50,9 +59,20 @@
 # This doesn't do Jack currently, as per the $(MAKECMDGOALS) check in
 # env_post.mk. I can revisit this `enhancement' later.
 #CLEAN_TARGETS		+= $$(INSTALL_FILE)
-INSTALL_FILES		+= $$(abspath $(DESTDIR)/$(3)/$(1))
 
-$$(abspath $(DESTDIR)/$(3)/$(1)): $$(abspath $$(dir $(DESTDIR)/$(3)/$(1)))
+ifdef MAKE_3_80_COMPAT
+INSTALL_FILES		+= $$(call MAKE_3_80_abspath,$(DESTDIR)/$(3)/$(1))
+else
+INSTALL_FILES		+= $$(abspath $(DESTDIR)/$(3)/$(1))
+endif # MAKE_3_80_COMPAT
+
+ifdef MAKE_3_80_COMPAT
+$$(call MAKE_3_80_abspath,$(DESTDIR)/$(3)/$(1)): \
+    $$(call MAKE_3_80_abspath,$$(dir $(DESTDIR)/$(3)/$(1)))
+else
+$$(abspath $(DESTDIR)/$(3)/$(1)): \
+    $$(abspath $$(dir $(DESTDIR)/$(3)/$(1)))
+endif # MAKE_3_80_COMPAT
 ifdef INSTALL_PRE
 	@echo "Executing preinstall command."
 	$$(INSTALL_PRE)
@@ -71,7 +91,15 @@
 # 2 -> search directory. Defaults to $(abs_srcdir) if not specified.
 # 
 define generate_vpath_rule
+ifdef MAKE_3_80_COMPAT
+ifeq ($$(strip $(2)),)
+vpath %.$(1)	$(abs_srcdir)
+else
+vpath %.$(1)	$(2)
+endif # End $$(strip $(2))
+else
 vpath %.$(1)	$$(if $(2),$(2),$(abs_srcdir))
+endif # End ifdef MAKE_3_80_COMPAT
 endef
 
 #