From 16e8d3b92b5e35a5eaee40a7b7fc0279c342886a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 Jan 2017 01:33:24 -0500 Subject: (libretools) Fix bugs in autothing. Some of these are that I hadn't originally designed autothing v3 to work with --warn-undefined-variables. Others are just straight-up bugs from inadequate testing. --- build-aux/Makefile.head.mk | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'build-aux/Makefile.head.mk') diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index f4eb51d..6ac3d49 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -32,17 +32,19 @@ _at.relbase = $(strip \ _at.relto = $(strip \ $(if $(call _at.is_subdir,$1,$2), \ $(patsubst %/.,%,$(patsubst $(abspath $1)/%,%,$(abspath $2)/.)), \ - ../$(call _at.relto,$(dir $1),$2))) + ../$(call _at.relto,$(dir $(abspath $1)),$2))) # These 3 functions only take one operand; we define public multi-operand # versions below. -_at.path = $(strip \ - $(if $(call _at.is_subdir,$(topoutdir),$1), \ - $(patsubst %/.,%,$(topoutdir)/$(call _at.relto,.,$1)), \ - $(if $(call _at.is_subdir,$(topsrcdir),$1), \ - $(patsubst %/.,%,$(topsrcdir)/$(call _at.relto,$(topsrcdir),$1)), \ - $(abspath $1)))) -_at.out2src = $(call _at.path,$(if $(call _at.is_subdir,$(topoutdir),$1),$(topsrcdir)/$(call _at.path,$1),$1)) +_at.path = $(strip $(or \ + $(if $(call _at.is_subdir, . ,$1), $(call _at.relto, . ,$1) ), \ + $(if $(call _at.is_subdir,$(topoutdir),$1),$(patsubst %/.,%,$(topoutdir)/$(call _at.relto,$(topoutdir),$1))), \ + $(if $(call _at.is_subdir,$(topsrcdir),$1),$(patsubst %/.,%,$(topsrcdir)/$(call _at.relto,$(topsrcdir),$1))), \ + $(abspath $1))) +_at.out2src = $(call _at.path,$(strip \ + $(if $(call _at.is_subdir,$(topoutdir),$1), \ + $(topsrcdir)/$(call _at.relto,$(topoutdir),$1), \ + $1))) _at.addprefix = $(call _at.path,$(if $(filter-out /%,$2),$1/$2,$2)) _at.rest = $(wordlist 2,$(words $1),$1) @@ -103,9 +105,7 @@ ifeq ($(call _at.is_subdir,$(topoutdir),$(outdir)),) $(error Autothing: not a subdirectory of topoutdir=$(topoutdir): $(outdir)) endif -# Don't use at.out2src because we *know* that $(outdir) is inside $(topoutdir), -# and has already had $(_at.path) called on it. -srcdir := $(call _at.path,$(topsrcdir)/$(outdir)) +srcdir := $(call _at.out2src,$(outdir)) ifeq ($(call _at.is_subdir,$(topsrcdir),$(srcdir)),) $(error Autothing: not a subdirectory of topsrcdir=$(topsrcdir): $(srcdir)) endif -- cgit v1.2.2