# This is a build file for libbu++

default action: check "libbu++.a"
"tests" action: check /tests\/.*/
"clean" action: clean /.*/
"all" action: check /.*/

create file "libbu++.a" from files in src using rule lib

for directories matching /src\/test\/(.*)/ in src/test ...
	create file "tests/{re:1}" from files in "{match}" using rule exe

set CXXFLAGS += "-ggdb"
set CXXFLAGS += "-Isrc -fPIC"

for targets matching /tests\/.*/ set LDFLAGS += "-L. -lbu++"
for testes/plugin set LDFLAGS += "-ldl"

/(.*)\.o$/ requires from command "g++ {CXXFLAGS} -M {re:1}.c*"
/tests\/.*/ requires "libbu++.a"

rule lib matches all /(.*)\.o$/ perform command ...
	"ar cr {target} {match}"

rule cpp matches one /(.*)\.c(pp)?$/ produces "{re:1}.o" perform command ...
	"g++ {CXXFLAGS} -c -o {target} {match}"

rule exe matches all /(.*)\.o$/ perform command ...
	"g++ -o {target} {match} {LDFLAGS}"