constants: CC: gcc CFLAGS: -std=c11 -pedantic -Wall -Werror -D_XOPEN_SOURCE=700 BIN: "cproj" BUILDDIR: build SOURCES: "{{joinlines (shell 'find . -name \"*.c\"')}}" OBJECTS: "{{re SOURCES '([^\\\\s ]*).c' (cat BUILDDIR '/' '$1.o')}}" jobs: builddir: outputs: "{{BUILDDIR}}" run: mkdir -vp {{BUILDDIR}} object: args: [path] requires: - job: builddir inputs: "{{path}}" outputs: "{{BUILDDIR}}/{{subst path '.c' '.o'}}" run: | echo "compiling." sleep 1 echo "compiling.." sleep 1 echo "compiling..." sleep 1 {{CC}} {{CFLAGS}} -c {{path}} -o "{{BUILDDIR}}/{{subst path '.c' '.o'}}" binary: requires: - job: object foreach: var: path in: "{{SOURCES}}" - job: builddir inputs: "{{OBJECTS}}" outputs: "{{BUILDDIR}}/{{BIN}}" run: | echo "linking." sleep 1 echo "linking.." sleep 1 echo "linking..." sleep 1 {{CC}} {{CFLAGS}} -o "{{BUILDDIR}}/{{BIN}}" {{OBJECTS}} clean: run: | rm -rf {{BUILDDIR}} rm -rf {{BIN}} default: requires: - job: binary