Makefile 如何通过premake生成虚假目标?
我已经用了一段时间了。当我必须运行小脚本或与构建阶段无关的东西(例如调试、打包、为外部库构建等等)时,我只使用Makefile项目来实现如下目的Makefile 如何通过premake生成虚假目标?,makefile,build,premake,Makefile,Build,Premake,我已经用了一段时间了。当我必须运行小脚本或与构建阶段无关的东西(例如调试、打包、为外部库构建等等)时,我只使用Makefile项目来实现如下目的 -- [[ X. External Makefile libraries ]] project "external" kind "Makefile" location "build" buildcommands { "cd ..; make -f Makefile" } cleanc
-- [[ X. External Makefile libraries ]]
project "external"
kind "Makefile"
location "build"
buildcommands {
"cd ..; make -f Makefile"
}
cleancommands {
"cd ..; make -f Makefile clean"
}
-- [[ X+1. Integration ]]
project "integration"
kind "Makefile"
location "build"
buildcommands {
-- PacketNgin Application Library
"ar x ../libc.a",
"ar x ../libm.a",
"ar x ../libtlsf.a",
"ar x ../libcore.a",
"ar x ../libexpat.a",
"ar rcs ../libpacketngin.a *.o",
"cp -rL ../core/include/* ../../include",
"cp -rL ../expat/include/* ../../include",
"cp -rL ../openssl/include/* ../../include",
"cp -rL ../zlib/*.h ../../include",
"rm ./*.o -rf",
-- Linux Application library
"ar x ../libtlsf.a ", -- Blank is added at the end on purpose
"ar x ../libcore_linux.a",
"ar rcs ../libumpn.a *.o",
"rm ./*.o -rf ", -- Blank is added at the end on purpose
}
cleancommands {
"rm *.o -rf",
"rm ../*.a -rf"
}
我意识到这种做法非常混乱,因为它并没有将真实的生成文件与虚假目标区分开来,甚至没有为生成生成生成不必要的生成文件。所以,我想通过premake找出生成虚假目标的方法
我考虑了newaction语法,但我发现它只是使premake脚本成为目标,而不是使文件成为目标
premake是否有生成虚假目标的最佳实践或方法?目前premake不支持创建任意虚假目标(尽管您可以自己创建或处理) 但是您可以使用Premake本身为您运行命令。下面是一个创建名为“集成”的新操作的简单示例: 一旦添加到项目脚本中,您可以像这样调用它:
$ premake5 integrate
$ premake5 integrate