From 2d2497c318cd1870a57dbfdd7ad8eed838a1b56e Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 18 Jul 2016 23:16:27 +0200 Subject: [PATCH] ackbuilder rules files now require absolute paths in external variables (otherwise commands which change directory don't work). --- Makefile | 14 +++++++------- first/ackbuilder.lua | 6 ++++-- lang/cem/cemcom.ansi/build.lua | 2 +- util/LLgen/build.lua | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 4cdb47e92..7cc12c271 100644 --- a/Makefile +++ b/Makefile @@ -39,11 +39,11 @@ CC = gcc # You shouldn't need to change anything below this point unless you are # actually developing ACK. -OBJDIR = $(BUILDDIR)/obj -BINDIR = $(BUILDDIR)/bin -LIBDIR = $(BUILDDIR)/lib -INCDIR = $(BUILDDIR)/include -INSDIR = $(BUILDDIR)/staging +OBJDIR = $(abspath $(BUILDDIR)/obj) +BINDIR = $(abspath $(BUILDDIR)/bin) +LIBDIR = $(abspath $(BUILDDIR)/lib) +INCDIR = $(abspath $(BUILDDIR)/include) +INSDIR = $(abspath $(BUILDDIR)/staging) PLATIND = $(INSDIR)/share/ack PLATDEP = $(INSDIR)/lib/ack @@ -91,11 +91,11 @@ endif $(BUILDDIR)/rules.ninja: first/ackbuilder.lua $(BUILD_FILES) @mkdir -p $(BUILDDIR) - lua5.2 first/ackbuilder.lua first/build.lua build.lua --ninja > $(BUILDDIR)/rules.ninja + @lua5.2 first/ackbuilder.lua first/build.lua build.lua --ninja > $(BUILDDIR)/rules.ninja $(BUILDDIR)/rules.mk: first/ackbuilder.lua $(BUILD_FILES) @mkdir -p $(BUILDDIR) - lua5.2 first/ackbuilder.lua first/build.lua build.lua --make > $(BUILDDIR)/rules.mk + @lua5.2 first/ackbuilder.lua first/build.lua build.lua --make > $(BUILDDIR)/rules.mk clean: @rm -rf $(BUILDDIR) diff --git a/first/ackbuilder.lua b/first/ackbuilder.lua index 935346c74..a799c8a4b 100644 --- a/first/ackbuilder.lua +++ b/first/ackbuilder.lua @@ -65,7 +65,7 @@ end local function concatpath(...) local p = table.concat({...}, "/") - return p:gsub("/+", "/"):gsub("^%./", ""):gsub("/%./", "/") + return (p:gsub("/+", "/"):gsub("^%./", ""):gsub("/%./", "/")) end local function filenamesof(targets, pattern) @@ -153,7 +153,7 @@ local function abspath(collection) end ) end - + local function basename(collection) return dotocollection(collection, function(filename) @@ -648,6 +648,8 @@ local function parse_arguments(argmap, arg) end globals = { + posix = posix, + abspath = abspath, asstring = asstring, basename = basename, diff --git a/lang/cem/cemcom.ansi/build.lua b/lang/cem/cemcom.ansi/build.lua index 8dfd6ab7c..5f8476ad3 100644 --- a/lang/cem/cemcom.ansi/build.lua +++ b/lang/cem/cemcom.ansi/build.lua @@ -13,7 +13,7 @@ normalrule { } } -local str_files = basename(posix.glob("lang/cem/cemcom.ansi/*.str")) +local str_files = basename(posix.glob(cwd().."/*.str")) local str_targets = {} for _, f in ipairs(str_files) do diff --git a/util/LLgen/build.lua b/util/LLgen/build.lua index 0a2c29f6f..ff0b7f638 100644 --- a/util/LLgen/build.lua +++ b/util/LLgen/build.lua @@ -6,7 +6,7 @@ cprogram { -- do this. srcs = { "./src/*.c" }, - cflags = { "-DLIBDIR=\\\""..abspath("util/LLgen/lib").."\\\"", "-DNON_CORRECTING" }, + cflags = { "-DLIBDIR=\\\""..posix.getcwd().."/"..cwd().."/lib\\\"", "-DNON_CORRECTING" }, } definerule("llgen",