Merge pull request #1031 from tdesveauxPKFX/fix-gmake2-callarray

Fix gmake2 Makefile projects callArray
This commit is contained in:
Tom van Dijck 2018-04-05 12:38:18 +02:00 committed by GitHub
commit d094923538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 105 additions and 3 deletions

View File

@ -15,7 +15,7 @@
local fileconfig = p.fileconfig
---
-- Add namespace for element definition lists for p.callarray()
-- Add namespace for element definition lists for p.callArray()
---
makefile.elements = {}
@ -34,7 +34,7 @@
function makefile.generate(prj)
p.eol("\n")
p.callarray(make, makefile.elements.makefile, prj)
p.callArray(makefile.elements.makefile, prj)
end
@ -64,7 +64,7 @@
_x('else ifeq ($(config),%s)', cfg.shortname)
end
p.callarray(make, makefile.elements.configuration, cfg, toolset)
p.callArray(makefile.elements.configuration, cfg, toolset)
_p('')
end

View File

@ -7,6 +7,7 @@ return {
"test_gmake2_flags.lua",
"test_gmake2_ldflags.lua",
"test_gmake2_linking.lua",
"test_gmake2_makefile.lua",
"test_gmake2_objects.lua",
"test_gmake2_pch.lua",
"test_gmake2_perfile_flags.lua",

View File

@ -0,0 +1,101 @@
--
-- test_gmake2_makefile.lua
-- Validate the makefile projects.
-- (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
--
local p = premake
local suite = test.declare("gmake2_makefile")
local p = premake
local gmake2 = p.modules.gmake2
local project = p.project
--
-- Setup
--
local wks, prj
function suite.setup()
wks, prj = test.createWorkspace()
kind "Makefile"
end
local function prepare()
prj = test.getproject(wks, 1)
gmake2.makefile.configs(prj)
end
--
-- Check rules for Makefile projects.
--
function suite.makefile_configs_empty()
prepare()
test.capture [[
ifeq ($(config),debug)
TARGETDIR = bin/Debug
TARGET = $(TARGETDIR)/MyProject
define BUILDCMDS
endef
define CLEANCMDS
endef
else ifeq ($(config),release)
TARGETDIR = bin/Release
TARGET = $(TARGETDIR)/MyProject
define BUILDCMDS
endef
define CLEANCMDS
endef
else
$(error "invalid configuration $(config)")
endif
]]
end
function suite.makefile_configs_commands()
buildcommands {
"touch source"
}
cleancommands {
"rm -f source"
}
prepare()
test.capture [[
ifeq ($(config),debug)
TARGETDIR = bin/Debug
TARGET = $(TARGETDIR)/MyProject
define BUILDCMDS
@echo Running build commands
touch source
endef
define CLEANCMDS
@echo Running clean commands
rm -f source
endef
else ifeq ($(config),release)
TARGETDIR = bin/Release
TARGET = $(TARGETDIR)/MyProject
define BUILDCMDS
@echo Running build commands
touch source
endef
define CLEANCMDS
@echo Running clean commands
rm -f source
endef
else
$(error "invalid configuration $(config)")
endif
]]
end