-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
58 lines (43 loc) · 1.76 KB
/
makefile
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
CFLAGS = -std=c++20 -g -Wall -Wextra -Wshadow -Wpedantic -O3
CC = g++
LINK = g++
$(shell mkdir -p bin obj)
help:
@echo "\"make all\" to compile all executables"
@echo "\"make run in=<filename> [out=<filename>]\" to compile and run on a"\
"given file, optionally specifying the output file"
@echo "\"make debug in=<filename> [out=<filename>]\" to compile with debugging"\
"and run on a given file, optionally specifying the output file"
@echo "\"make batch in=<foldername> out=<foldername>\" to compile and run"\
"on all files in a given folder, placing all solutions in a second"\
"given folder"
@echo "\"make puzzles\" to compile and run on all puzzles in \"Puzzles\" folder"
@echo "\"make clean\" to remove all generated binary files"
@echo "\"make clear_puzzles\" to remove all solution image files from \"Puzzles\" folder"
all: bin/solve bin/solveDebug bin/batch_solve
run: bin/solve
./bin/solve $(in) $(out)
batch: bin/batch_solve
./bin/batch_solve $(in) $(out)
time: bin/solve
time -f "\nreal: %E\nuser: %U" ./bin/solve $(in) $(out)
debug: bin/solveDebug
./bin/solveDebug $(in) $(out)
bin/solve: obj/nonagram.o obj/bmp.o obj/solver.o
bin/solveDebug: obj/nonagramDebug.o obj/bmp.o obj/solver.o
bin/%:
$(LINK) -o $@ $^
bin/batch_solve: obj/nonagram.o obj/bmp.o obj/batch_solver.o
$(LINK) -pthread -o $@ $^
obj/bmp.o: src/bmp.cpp src/bmp.hpp
obj/nonagram.o: src/nonagram.cpp src/nonagram.hpp
obj/solver.o: src/solver.cpp src/bmp.hpp src/nonagram.hpp
obj/batch_solver.o: src/batch_solver.cpp src/bmp.hpp src/nonagram.hpp
obj/%.o:
$(CC) $(CFLAGS) -c $< -o $@
obj/nonagramDebug.o: src/nonagram.cpp src/nonagram.hpp
$(CC) $(CFLAGS) -D CPUZZLE_DEBUG -c $< -o $@
clean:
rm -f bin/* obj/*
puzzles: bin/batch_solve
./bin/batch_solve puzzles solutions