# vim: noexpandtab tabstop=4 : buildtype ?= release optionset = buildtypes/${buildtype}.txt prefix = bin/${buildtype}-buildtype default: ${prefix}/12 .PRECIOUS: %/ %/: @mkdir -p $@ srclist.mk: find -name '*.c' -! -path '*/junk/*' | sed "s/^/srcs += /" | sort -V > ${@} include srclist.mk ${prefix}/%.o ${prefix}/%.d: %.c ${optionset} | ${prefix}/%/ @echo "compiling (${buildtype}) ${<} ..." @gcc -c @${optionset} $< -MD -MF ${prefix}/${*}.d -o ${prefix}/${*}.o # || (gedit $<; false) objs = $(patsubst %.c,${prefix}/%.o,${srcs}) ${prefix}/12: ${objs} ${optionset} | ${prefix}/${1}/ @echo "linking (${buildtype}) ${1}" @gcc @${optionset} ${objs} -o ${@} #args += --garbage-collection-minimum 100B #args += --garbage-collection-run-every 100B #args += --garbage-collection-process-limit 200B #args += --garbage-collection-dotout /tmp/ #args += --macro-expansion-dotout /tmp/ #args += --evaluation-dotout /tmp/ args += --verbose args += ./examples/sandbox.txt run: ${prefix}/12 $< ${args} valrun: ${prefix}/12 valgrind --exit-on-first-error=yes --error-exitcode=1 -- $< ${args} valrun-leak: ${prefix}/12 valgrind --exit-on-first-error=yes --error-exitcode=1 --leak-check=full -- $< ${args} include $(patsubst %.c,${prefix}/%.d,${srcs})