diff --git a/Makefile.config.in b/Makefile.config.in index 9c655067..2492f63b 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -5,8 +5,15 @@ SHELL = @SHELL@ -top_srcdir = $(path_to_top)/@top_srcdir@ -srcdir = $(top_srcdir)/$(shell pwd | sed 's!.*/\($(shell echo $(path_to_top) | sed 's!\.\.![^/]*!')\)$$!\1!') +CURPATH = $(shell pwd) +TOPPATH = $(shell cd $(path_to_top) && pwd) +RELPATH = $(shell echo '$(CURPATH)' | sed 's,$(TOPPATH),,;s,^/,,;s,\([a-z0-9]\)$$,\1/,') + +PATHSCRIPT = case '@top_srcdir@' in /*) ;; *) echo $(path_to_top)/;; esac +PATHPREFIX = $(shell $(PATHSCRIPT)) + +top_srcdir = $(PATHPREFIX)@top_srcdir@ +srcdir = $(top_srcdir)/$(RELPATH) top_builddir = $(path_to_top) prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -56,7 +63,7 @@ LIBDIR = @LIBDIR@ LOCALEDIR = @LOCALEDIR@ LUA_CFLAGS = @LUA_CFLAGS@ LUA_LIBS = @LUA_LIBS@ -MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ +MKINSTALLDIRS = $(PATHPREFIX)@MKINSTALLDIRS@ MSGFMT = @MSGFMT@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ PACKAGE = @PACKAGE@ diff --git a/Makefile.lib b/Makefile.lib index 609a36cf..a0fda102 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -14,10 +14,6 @@ else mquiet = quiet_ endif -CURPATH = $(shell pwd) -TOPPATH = $(shell cd $(path_to_top) && pwd) -RELPATH = $(shell echo '$(CURPATH)' | sed 's,$(TOPPATH),,;s,^/,,;s,\([a-z0-9]\)$$,\1/,') - # Show the command (quiet or non-quiet version based on the assignment # just above) and then execute it. ncmd = $(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))