h1. Why There is a reasonable question. Why do we need yet another build system when there are other nice like CMake, Automake etc. It's very simple. During the start of a large project hierarchy of units continually changing. And every time to change the relevant configs assembly is time consuming. SMake can perform these operations in a fraction of a second. The developer does not need to be distracted from its primary mission. He just put _smake.sh_ in a console and it automatically recreates Makefile with all parameters saved in it on last SMake execution. For me it was easy to create Makefile-s for all my old program in one second by one command
for dir in projects/* ; do cd $dir && target=`ls main.{c,cpp} *.{c,cpp} 2>/dev/null | head -n1` && smake.sh -t ${target%.*} && cd - ; done
It really saved my time ;-) Other reason for this project are explicit source dependencies. Have you heard the phrase among developers "make clean"? ;-) With strong explicit dependencies no need to clean the build. It saves time on building when develop any project. h1. Keys h3. -S [SRC], --sources [SRC] Set SRC as path for search sources (ex: -S/home/user/src). h3. -P [PKG], --package [PKG] Set PKG as used package (ex: -Pglib-2.0). h3. -I [INC], --include [INC] Set INC as system include path (ex: -I/usr/include/glib-2.0). h3. -l [LIB], --libs [LIB] Set LIB as libraries that must be linked with (ex: -lglib-2.0). h3. -c [CC], --cc [CC] Use CC as C compiler (ex: -cgcc). h3. -x [CXX], --cxx [CXX] Use CXX as C++ compiler (ex: -xg++). h3. -t [TGT], --target [TGT] Set TGT as target name (ex: -tmain). h1. Examples This command tries to create Makefile for program.c main project source file with _main ()_ function and warn about not found sources.
smake.sh -t program
Next command creates Makefile for main.c with custom sources in _~/inc_ and _../include_ directories and headers (without sources) in _/usr/local/include_. Also it creates appropriate rules to build with _glu_ package and custom user _mylib_ library.
smake.sh -t main -S~/inc -S../include -I/usr/local/include -Pglu -lmylib -cicc -xg++
h1. Runing make When You debug your project it is enouth to tap.
make
It activates _debug_ mode by default. To speed up building _--jobs_ option for _make_ specified.
make -j5
To profile your code need to set _mode_ variable.
make mode=profile
When you give your compiled source to your colleguies developers you can sed _develop_ mode.
make mode=develop
And finally when release is ready it is prefer to set _release_ mode or write appropriate CMake or Automake configs.
make mode=release
Also several options can be specified through environment variables. Examples:
# CFLAGS="-O2 -march=core2 -mtune=core2 -msse4.1 -mfpmath=sse -fomit-frame-pointer -pipe" LDFLAGS="-Wl,-O1" make mode=develop
# CFLAGS="-O2 -march=amdfam10 -mtune=amdfam10 -msse4a --mfpmath=sse -fomit-frame-pointer -pipe" LDFLAGS="-Wl,-O1" make mode=profile
# CFLAGS="-O2 -march=k6-2 -mtune=k6-2 -m3dnow --mfpmath=387 -fomit-frame-pointer -pipe" LDFLAGS="-Wl,-O1" make mode=release