/* Our program is: */
program = monopoly;

/* we are using GNU g++ */
cc = g++;
cc_flags = -g;

/* Obtain source files */
project_files = [collect aegis -l pf -terse -p [project] -c [change]];
change_files  = [collect aegis -l cf -terse -p [project] -c [change]];
source_files  = [sort [project_files] [change_files]];

/* derive object files from source files */
object_files  = [fromto %0%1.C %0%1.o [match_mask %0%1.C [source_files]]];

/* determine test files */
test_files = [match_mask test/%.C [source_files]];

/* Only merge baseline with development directory for development builds */
if [match_mask %1C%2 [version]] then
{
  baseline = [collect aegis -cd -bl -p [project]];
  search_list = . [baseline];
}

/* how to build monopoly */
[program]: main.o [object_files]
{
  [cc] -o [program] [resolve main.o [object_files]] 2>&1 | c++filt;
}

/* how to build the objects */
%0%1.o: %0%1.C: [collect c_incl -eia [prepost "-I" "" [search_list]] [resolve %0%1.C]]
{
  if [exists %0%1.o] then
     rm %0%1.o
        set clearstat;
  [cc] [cc_flags] [prepost "-I" "" [search_list]] -c [resolve %0%1.C] -o %0%1.o;
}

/* how to build main.C */
main.C: [test_files]
{
  rm -f main.C;
  /public/public/monopoly/buildmain [fromto test/%.C % [test_files]] > main.C;
  chmod -w main.C;
}
