为什么没有在 premake4 中添加动作?

Why isn't an action being added in premake4?

我正在尝试使用 premake4 添加名为 "dummy" 的操作。

这是我的 premake4 lua 脚本:

-- For reference, please refer to the premake wiki:
-- https://github.com/premake/premake-core/wiki

-- Demonstrates creating new actions:
-- dummy

--#!lua

-- A solution contains projects,
-- and defines the available configurations
solution "hello-world"
   configurations { "Debug", "Release" }

   -- A project defines one build target
   project "hello-world"
      kind "ConsoleApp"
      language "C++"
      files { "**.h", "**.cpp" }

      configuration "Debug"
         defines { "DEBUG" }
         flags { "Symbols" }

      configuration "Release"
         defines { "NDEBUG" }
         flags { "Optimize" }


premake.dummy = {}

-- Register the "runmakefile" action.
newaction
{
   trigger = "dummy",
   description = "dummy",
   execute = function()
     print("** dummy")
   end
}


我已经生成了 makefile,但它不包含任何名为 "dummy".

的操作

我做错了什么,我真的应该做什么?

newaction 向 Premake 添加一个操作,而不是生成的项目文件。您将在命令提示符下通过 运行 执行您的操作:

premake4 dummy

Premake4 不提供将自定义目标添加到生成的 Makefile 的方法。 Premake5 provides makesettings 向 makefile 添加任意规则。