-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile
62 lines (46 loc) · 1.53 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
59
60
61
62
CXX ?= g++
r: libminisat.so libminicard.so
d: libminisat.so libminicard.so
r: CFLAGS+=-fpic -D NDEBUG -O3 -Wall -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wno-parentheses -Wextra
d: CFLAGS+=-fpic -D DEBUG -O0 -ggdb -Wall -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wno-parentheses -Wextra
OS=$(shell uname -s)
ifeq ($(OS), Darwin)
SHARED=-dynamiclib
else
SHARED=-shared
endif
SATINC=minisat/
CARDINC=minicard/
libminisat.so: minisat.o satSolver.o satSystem.o
$(CXX) $(SHARED) $(CFLAGS) -o $@ $^
minisat.o: minisat.cpp
$(CXX) -c $(CFLAGS) -I $(SATINC) -o $@ $^
satSolver.o: minisat/minisat/core/Solver.cc
$(CXX) -c $(CFLAGS) -I $(SATINC) -o $@ $^
satSystem.o: minisat/minisat/utils/System.cc
$(CXX) -c $(CFLAGS) -I $(SATINC) -o $@ $^
libminicard.so: minicard.o cardSolver.o cardSystem.o
$(CXX) $(SHARED) $(CFLAGS) -o $@ $^
minicard.o: minicard.cpp
$(CXX) -c $(CFLAGS) -I $(CARDINC) -o $@ $^
cardSolver.o: minicard/minicard/Solver.cc
$(CXX) -c $(CFLAGS) -I $(CARDINC) -o $@ $^
cardSystem.o: minicard/utils/System.cc
$(CXX) -c $(CFLAGS) -I $(CARDINC) -o $@ $^
clean:
rm -f *.so *.o
# check for existence of python versions to control tests
PYTHON2 := $(shell command -v python 2> /dev/null || command -v python2 2> /dev/null)
PYTHON3 := $(shell command -v python3 2> /dev/null)
test:
ifdef PYTHON2
${PYTHON2} test_minisolvers.py
${PYTHON2} -m doctest minisolvers.py
endif
ifdef PYTHON3
${PYTHON3} test_minisolvers.py
${PYTHON3} -m doctest minisolvers.py
endif
@echo
@echo "[32mAll tests passed.[m"
.PHONY: clean test