action "default" { build: ["src/version.h", "stage"]; } target "src/version.h" { input ".git"; profile "build" { fh = open("src/version.h.tmp", "w"); fh.write( "#ifndef VERSION_H\n" "#define VERSION_H\n" "\n" "#define VERSION \"$(git describe --abbrev=0)\"\n" "#define FULLVER \"$(git describe)\"\n" "#define SHAVER \"$(git log -n1 --pretty=format:%H)\"\n" "#define TIMEVER \"$(git log -n1 --pretty=format:%aD)\"\n" "\n" "#endif"); fh.close(); if "$(cmp src/version.h.tmp src/version.h 2>&1)" == "" then { execute("rm src/version.h.tmp"); } else { execute("mv src/version.h.tmp src/version.h"); } } } CC="g++"; target "stage" { rule "exe"; input files("src/*.y", "src/*.l", "src/*.cpp", "src/version.h"); CXXFLAGS="-ggdb"; CFLAGS="-ggdb"; FLEXFLAGS="-osrc/parser.yy.c --header-file=src/parser.yy.h"; BISONFLAGS="-d"; LDFLAGS += "-lbu++"; } /* rule "bison" { input "*.y"; output [INPUT.regex("\\.y$", ".tab.c"), INPUT.regex("\\.y$", ".tab.h")]; profile "build" { DIR=INPUT.dirName(); FILE=INPUT.fileName(); execute("cd ${DIR}; bison -d ${FILE}"); } } */