From bc71ad0d9e540de0d924ad523391e8a5af857e0f Mon Sep 17 00:00:00 2001 From: thomas desveaux Date: Mon, 2 Apr 2018 20:25:57 +0200 Subject: [PATCH 1/3] Gmake2: Fix callArray calls --- modules/gmake2/gmake2_makefile.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/gmake2/gmake2_makefile.lua b/modules/gmake2/gmake2_makefile.lua index cf70535c..577e083e 100644 --- a/modules/gmake2/gmake2_makefile.lua +++ b/modules/gmake2/gmake2_makefile.lua @@ -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 From dbf36a5f97c33bd367dceaccdc2819d47ea72521 Mon Sep 17 00:00:00 2001 From: thomas desveaux Date: Mon, 2 Apr 2018 21:15:24 +0200 Subject: [PATCH 2/3] Gmake2: Add tests for Makefile project kind --- modules/gmake2/tests/_tests.lua | 1 + modules/gmake2/tests/test_gmake2_makefile.lua | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 modules/gmake2/tests/test_gmake2_makefile.lua diff --git a/modules/gmake2/tests/_tests.lua b/modules/gmake2/tests/_tests.lua index 0cb4a3ae..448be95d 100644 --- a/modules/gmake2/tests/_tests.lua +++ b/modules/gmake2/tests/_tests.lua @@ -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", diff --git a/modules/gmake2/tests/test_gmake2_makefile.lua b/modules/gmake2/tests/test_gmake2_makefile.lua new file mode 100644 index 00000000..fb32ae08 --- /dev/null +++ b/modules/gmake2/tests/test_gmake2_makefile.lua @@ -0,0 +1,109 @@ +-- +-- 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() + end + + local function prepare() + local cfg = test.getconfig(prj, "Debug") + kind "Makefile" + gmake2.cpp.allRules(cfg) + end + + +-- +-- Check rules for Makefile projects. +-- + + function suite.makefile_configs_empty() + kind "Makefile" + + prj = test.getproject(wks, 1) + gmake2.makefile.configs(prj) + 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() + kind "Makefile" + + prj = test.getproject(wks, 1) + + buildcommands { + "touch source" + } + + cleancommands { + "rm -f source" + } + + + gmake2.makefile.configs(prj) + 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 From 04f22eead125105a80cef9fd75c916fbbd5ee90d Mon Sep 17 00:00:00 2001 From: thomas desveaux Date: Mon, 2 Apr 2018 21:18:40 +0200 Subject: [PATCH 3/3] Gmake2: Clean Makefile tests --- modules/gmake2/tests/test_gmake2_makefile.lua | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/modules/gmake2/tests/test_gmake2_makefile.lua b/modules/gmake2/tests/test_gmake2_makefile.lua index fb32ae08..1174a881 100644 --- a/modules/gmake2/tests/test_gmake2_makefile.lua +++ b/modules/gmake2/tests/test_gmake2_makefile.lua @@ -21,12 +21,12 @@ function suite.setup() wks, prj = test.createWorkspace() + kind "Makefile" end local function prepare() - local cfg = test.getconfig(prj, "Debug") - kind "Makefile" - gmake2.cpp.allRules(cfg) + prj = test.getproject(wks, 1) + gmake2.makefile.configs(prj) end @@ -35,10 +35,7 @@ -- function suite.makefile_configs_empty() - kind "Makefile" - - prj = test.getproject(wks, 1) - gmake2.makefile.configs(prj) + prepare() test.capture [[ ifeq ($(config),debug) TARGETDIR = bin/Debug @@ -63,10 +60,6 @@ endif end function suite.makefile_configs_commands() - kind "Makefile" - - prj = test.getproject(wks, 1) - buildcommands { "touch source" } @@ -75,8 +68,7 @@ endif "rm -f source" } - - gmake2.makefile.configs(prj) + prepare() test.capture [[ ifeq ($(config),debug) TARGETDIR = bin/Debug