First I made a decent Makefile system. I got it working on OSX, Linux, MinGW ... all but MSVC. Then I found myself wanting to build stuff with MSVC ... without making those stupid .vcproj files, or another NMAKE script, or rewriting everything. Because, if you have to rewrite everything, why use a one-platform tool to do it, like MSVC's stuff? So I found myself in need of a rewrite. Hence this simple build system.
It reads files labeled buildinfo.
Each buildinfo specifies the distribution name, type, and any dependencies.
They optionally can have a depends table that specifies the locations of all other dependent lmake-based projects.
More configuration information for the buildinfo can be found in the run.lua file.
If you want shell integration, make this file:
lmake:
#!/usr/bin/env sh
lua ~/path/to/make/run.lua "$@"
or for the windows users: lmake.bat:
@echo off
lua "C:\path\to\make\run.lua" %*
...with maybe an optional -lluarocks.require after lua depending on how your lua setup is.
and run it with the following arguments:
lmake clean= cleans objectslmake distclean= cleans executablelmake= builds default configurationlmake all= builds debug and releaselmake debug= builds debuglmake release= builds releaselmake distonly= builds dist from objs only
if you're lazy:
lua -lmake
and to clean ...
lua -lmake.clean
if you want to do more than one thing at once...
lua /path/to/lua/make/run.lua clean distclean all
if you want a custom platform:
lua platform $PLATFORM make.lua
where $PLATFORM can be:
osxlinuxclang_winmingwmsvc
distName= name of the projectdistType= type of the project. possible options are:'app'for applications / executables.
'lib'for libraries.
'inc'for include files (no code / nothing to build, but still used forbuildinfodependencies).
depends= table of paths to otherlmakeprojects that this is dependent upon.
env= reference back to the global environment object.home= home directory.platform= build platform.build='debug'or'release'.objSuffix= suffix of object file.'.o'on unix systems,'.obj'in M$ systems.libPrefix= prefix of library files.'lib'on unix systems.libSuffix= lib suffix.'.so','.dylib','.a','.lib','.dll', etc.appSuffix= executable suffix. empty on unix systems, '.exe' for M$.compiler= compiler binary name.'g++','clang++','cl.exe', etc...compileFlags= flags to pass to compiler.compileIncludeFlag= flag for include directory.compileMacroFlag= flag for C++ macros.compileOutputFlag= flag for output filename.compileGetIncludeFilesFlag= flag for getting include files referenced by this file.including= flag set if thisbuildinfois being interpreted from anotherbuildinfo.linker= linker binary name.linkLibPathFlag= flag for adding library search paths.linkLibFlag= flag for adding libraries.linkOutputFlag= flag for specifying the output filename.linkFlags= extra flags to send to the linkercppver= C++ version.include= table of include directories to forward to the C++ compiler.dependLibs= other luamake projects that the project is dependent upon (for executing recursive buildinfos).libs=-llibraries, be they static or dynamic, automatically detected by the compiler/linker.libpaths=-Lsearch paths forlibs.dynamicLibs- on linux this contains paths to explicit
.sofiles.
- on linux this contains paths to explicit
- on osx this is
.dylibfiles.
- on osx this is
- on windows this is
.libfiles associated with.dllfiles (as opposed to the.libfiles that are static libraries ... smh windows).
- on windows this is
objLogFile= filename to save output ofEnv:buildObj().distLogFile= filename to save output ofEnv:buildDist().pthread= set this flag when including pthread. Maps to-pthreadin GCC.fileCfgs[filename] = function(fileEnv)= per-file callback that can be registered to configure the per-file environment, in case any files need vars changed from the global env.
I'm using this in a few other places:
- cl-cpu
- ffi-c
- lua-include
- soon to be my CL library as I start to use SPIR-V more and more...
- ...and any other OpenCL project I have made based on that.