ackbuilder rules files now require absolute paths in external variables

(otherwise commands which change directory don't work).
This commit is contained in:
David Given 2016-07-18 23:16:27 +02:00
parent 523374c36b
commit 2d2497c318
4 changed files with 13 additions and 11 deletions

View file

@ -39,11 +39,11 @@ CC = gcc
# You shouldn't need to change anything below this point unless you are # You shouldn't need to change anything below this point unless you are
# actually developing ACK. # actually developing ACK.
OBJDIR = $(BUILDDIR)/obj OBJDIR = $(abspath $(BUILDDIR)/obj)
BINDIR = $(BUILDDIR)/bin BINDIR = $(abspath $(BUILDDIR)/bin)
LIBDIR = $(BUILDDIR)/lib LIBDIR = $(abspath $(BUILDDIR)/lib)
INCDIR = $(BUILDDIR)/include INCDIR = $(abspath $(BUILDDIR)/include)
INSDIR = $(BUILDDIR)/staging INSDIR = $(abspath $(BUILDDIR)/staging)
PLATIND = $(INSDIR)/share/ack PLATIND = $(INSDIR)/share/ack
PLATDEP = $(INSDIR)/lib/ack PLATDEP = $(INSDIR)/lib/ack
@ -91,11 +91,11 @@ endif
$(BUILDDIR)/rules.ninja: first/ackbuilder.lua $(BUILD_FILES) $(BUILDDIR)/rules.ninja: first/ackbuilder.lua $(BUILD_FILES)
@mkdir -p $(BUILDDIR) @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) $(BUILDDIR)/rules.mk: first/ackbuilder.lua $(BUILD_FILES)
@mkdir -p $(BUILDDIR) @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: clean:
@rm -rf $(BUILDDIR) @rm -rf $(BUILDDIR)

View file

@ -65,7 +65,7 @@ end
local function concatpath(...) local function concatpath(...)
local p = table.concat({...}, "/") local p = table.concat({...}, "/")
return p:gsub("/+", "/"):gsub("^%./", ""):gsub("/%./", "/") return (p:gsub("/+", "/"):gsub("^%./", ""):gsub("/%./", "/"))
end end
local function filenamesof(targets, pattern) local function filenamesof(targets, pattern)
@ -153,7 +153,7 @@ local function abspath(collection)
end end
) )
end end
local function basename(collection) local function basename(collection)
return dotocollection(collection, return dotocollection(collection,
function(filename) function(filename)
@ -648,6 +648,8 @@ local function parse_arguments(argmap, arg)
end end
globals = { globals = {
posix = posix,
abspath = abspath, abspath = abspath,
asstring = asstring, asstring = asstring,
basename = basename, basename = basename,

View file

@ -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 = {} local str_targets = {}
for _, f in ipairs(str_files) do for _, f in ipairs(str_files) do

View file

@ -6,7 +6,7 @@ cprogram {
-- do this. -- do this.
srcs = { "./src/*.c" }, srcs = { "./src/*.c" },
cflags = { "-DLIBDIR=\\\""..abspath("util/LLgen/lib").."\\\"", "-DNON_CORRECTING" }, cflags = { "-DLIBDIR=\\\""..posix.getcwd().."/"..cwd().."/lib\\\"", "-DNON_CORRECTING" },
} }
definerule("llgen", definerule("llgen",