sat-solver/makefile

89 lines
1.4 KiB
Makefile

# vim: noexpandtab tabstop=4 :
buildtype ?= release
buildtype_options = buildtypes/${buildtype}.txt
prefix = bin/${buildtype}-buildtype
objs = $(patsubst %.cpp,${prefix}/%.o,$(srcs))
default: ${prefix}/sat-solver
srclist.mk:
find -name '*.cpp' -! -path '*/junk/*' | sed 's/^/srcs += /' | sort -V > $@
include srclist.mk
.PRECIOUS: %/
%/:
@mkdir -p $@
${prefix}/sat-solver: ${buildtype_options} ${objs} | ${prefix}/
@echo "${buildtype}: linking ${@} ..."
@gcc @${buildtype_options} ${objs} -o $@ -lstdc++ -static-libasan
${prefix}/%.o ${prefix}/%.d: %.cpp ${buildtype_options} | ${prefix}/%/
@echo "${buildtype}: compiling ${*}.cpp ..."
@gcc -c @${buildtype_options} $< -MD -MF ${prefix}/${*}.d -o ${prefix}/${*}.o
args += -d
args += -v
args += -V
#args += -i ./inputs/0.txt
#args += -i ./inputs/1.txt
#args += -i ./inputs/2.txt
#args += -i ./inputs/3.txt
#args += -i ./inputs/all.txt
#args += -i ./inputs/none.txt
args += -i ./satlib/uf20-91/uf20-01.cnf
run: ${prefix}/sat-solver
${env} $< ${args}
time-run: ${prefix}/sat-solver
bash -c "time ${env} $< ${args}"
gdbrun: ${prefix}/sat-solver
gdb --args $< ${args}
valrun: ${prefix}/sat-solver
valgrind --gen-suppressions=yes -- $< ${args}
valrun-leak: ${prefix}/sat-solver
valgrind --leak-check=full --gen-suppressions=yes -- $< ${args}
test: ${prefix}/sat-solver
./test.py ${<} ${targs}
include $(patsubst %.cpp,${prefix}/%.d,$(srcs))