-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
43 lines (31 loc) · 845 Bytes
/
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
CC = gcc
CFLAGS = -Wall
INSTALL = install -D
INSTALL_PROGRAM = $(INSTALL)
debug =
ifeq ($(debug), 1)
CFLAGS += -Wextra -DDEBUG_PRINT=1 -DDEBUG_LOG=1 -g -O0
else
CFLAGS += -DDEBUG_PRINT=0 -DDEBUG_LOG=0 -O2
endif
SRC := $(wildcard ./*.c)
TARGET = sudoku_solver sudoku2str
.PHONY: all clean
all: $(TARGET)
sudoku_solver: sudoku_solver.o dlx.o dlx_sudoku.o
test:: $(TARGET)
./sudoku_solver -v hardest_sudoku.txt
install: sudoku_solver sudoku2str
$(INSTALL_PROGRAM) sudoku_solver /usr/local/bin/sudoku_solver
$(INSTALL_PROGRAM) sudoku2str /usr/local/bin/sudoku2str
uninstall:
rm /usr/local/bin/sudoku2str
rm /usr/local/bin/sudoku_solver
sinclude $(SRC:.c=.d)
%.d: %.c
@set -e; rm -f $@; \
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\(.*\)\.o[:]*,\1.o $@:,' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
-rm -f *.o *.d $(TARGET)