-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (24 loc) · 722 Bytes
/
Copy pathMakefile
File metadata and controls
33 lines (24 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
OCAMLC := ocamlc
OCAMLFLAGS :=
ENCODER := sudoku2cnf
DECODER := sol2grid
CHECKER := check_sudoku
.PHONY: all make run check clean
# Default build target
all: $(ENCODER) $(DECODER) $(CHECKER)
make: all
$(ENCODER): sudoku2cnf.ml
$(OCAMLC) $(OCAMLFLAGS) -o $@ $<
$(DECODER): sol2grid.ml
$(OCAMLC) $(OCAMLFLAGS) -o $@ $<
$(CHECKER): check_sudoku.ml
$(OCAMLC) $(OCAMLFLAGS) -o $@ $<
run: all
./$(ENCODER) input.txt > problem.cnf
z3 -dimacs problem.cnf > sat_output.txt
./$(DECODER) sat_output.txt > output.txt
# Validate solved grid against original puzzle.
check: run $(CHECKER)
./$(CHECKER) output.txt input.txt
clean:
rm -f $(ENCODER) $(DECODER) $(CHECKER) *.cmi *.cmo problem.cnf sat_output.txt output.txt