lcmk/README.md

51 lines
1.5 KiB
Markdown
Raw Normal View History

2018-11-13 19:12:28 +00:00
# what??
its a c build system. it is not the fastest nor the most extensible but damn me if it aint easy to use pardner.
please do not use this for any serious projects
# installation
```
chmod +x install.sh
./install.sh
```
or, if you want to use luajit:
```
./install.sh -luajit
```
depends on [luafilesystem](https://keplerproject.github.io/luafilesystem/) or [lua filesystem ffi](https://github.com/spacewander/luafilesystem) if using luajit
# usage
2018-11-13 19:28:53 +00:00
`lcmk` will look for a file `build.lua` in your current directory and execute it. this file may define the following global variables:
2018-11-13 19:12:28 +00:00
* `PROG` program name (for compilation output). REQUIRED
* `SRC` table containing source file paths (.c and .cpp); do not define or set to "\*.c" to let `lcmk` find them by itself
* `CC` the C compiler.
* `CFLAGS` string containing flags to be passed to the compiler
* `LINK` string containing libraries to link against
any of these variables might be provided through environment variables instead
then, you can invoke the program with `lcmk [options]`
options is an arbitrary list of strings stored in global table `opt` that the build file might use to change something in the build.
the clean option is builtin and will remove all \*.o files along with $PROG
an example build file could be:
```lua
SRC = {"main.c", "foo.c"}
PROG = "./foo"
CFLAGS = "-Wall"
LINK = "-lm"
if opt.debug then
CFLAGS = CFLAGS .. " -ggdb"
end
```
`lcmk` will handle everything else (object files, dependencies, etc)