In the previous article, premake created a simple C ++ project in the Ubuntu and GCC environments. Although it can work, it is not very familiar with it. Later, I spent some time reading lua's syntax and thought I understood it. Later I looked back and found that I still did not understand it. Now I understand that although premake is based on lua, it also has its own syntax. The standard lua syntax is certainly usable in premake. Now let's take a closer look at the script in the original example. [Plain] -- A solution contains projects, and defines the available deployments solution "Hello1" deployments {"Debug ", "Release"} -- A project defines one build target project "Hello1" kind "leleapp" language "C ++" files {"**. h ","**. cpp "} configuration" Debug "defines {" DEBUG "} flags {" Symbols "} configuration" Release "defines {" NDEBUG "} flags {" Optimize "} Note: 1. these solution, co Nfigurations and so on are all functions. They are not variables. Here they are different from the standard lua syntax (standard writing is also acceptable). Instead, they use premake custom rules, including spaces and. 2. solution can contain multiple projects. For more information about the syntax, see http://industriousone.com/solutionand solutionmanage multiple projects. This design is very complicated. 3. The parameters accepted by tolerations are the configuration names of each segment. You should define the corresponding configuration settings in each project. The invocations must be called before all project definitions. 4. The parameters of the configurations function are placed at the beginning, which means that in the *. make file that will be generated in the future, Debug will be used as the default setting. If you put Release at the beginning, after the make file is generated, you will see: [plain] ifndef config = release endif when make does not pass the parameter, the release configuration will be used by default. 5. configuration can be used in the project. The document: http://industriousone.com/project contains the following error: solution plain] solution "MySolution" configuration {"Debug", "Release"} // shocould be deployed ations project "MyProject" 6. note that kind can be used in configuration or project. Document: http://industriousone.com/kind7. configuration is the configuration function corresponding to 3. Note that you can use wildcards, such as "* Lib" or "* DLL", to match parameters in deployments. All configurations after the configuration function belong to this configuration until the next configuration is encountered. In my example, only the defines and flags functions are available. Document: http://industriousone.com/configuration8. defines is used to add preprocessing or compilation symbols to a project. The previous two configurations are used to define each time. Let's take a look: [plain] configuration "Debug" defines {"DEBUG"} and [plain] configuration "Release" defines {"NDEBUG"} results are in the generated Hello1.make file, we can see that the corresponding gmake commands are generated:-DDEBUG and-DNDEBUG [plain] ifeq ($ (config), debug) OBJDIR = obj/Debug TARGETDIR =. TARGET = $(TARGETDIR)/Hello1 DEFINES + =-DDEBUG and [plain] ifeq ($ (config), release) OBJDIR = obj/Release TARGETDIR =. TARGET = $ (TARGETDIR)/El Lo1 DEFINES + =-DNDEBUG 9. flags is used to specify the identifier during the compilation or link process. For more information, see the document http://industriousone.com/flagswhich is the most common. "Symbols" allows compilation of debugging information, "Optimize" Compilation optimization, and is generally prepared for Release. 10. the premake command can be simplified to [plain] premake4 -- file = config. lua gmake's original [plain] premake4 -- file = config. lua -- OS = linux -- platform = x64 gmake has side effects. In particular, -- platform = x64 may cause the generated make files to have debug64 and release64 configurations. It is better to control it by yourself. 11. Finally, we will introduce how to add files and directories and even exclude some files. Reference: callback.