-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
154 lines (122 loc) · 3.27 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# DBG=1
# Choose solver (MiniSat or Glucose)
USE_GL=1
# Choose version (minisat_simp, glucose_parallel for USE_SIMP=0)
USE_SIMP=1
CSRCS = $(wildcard ./src/*.cc)
NSRCS = $(wildcard *.nw)
YACC = $(wildcard *.y)
LEX = $(wildcard *.l)
COBJS = $(CSRCS:.cc=.o) $(YACC:.y=.tab.o) $(LEX:.l=.o)
DEPENDS = ${COBJS:.o=.d}
PDFS = $(NSRCS:.nw=.pdf)
LIBD =
LIBS =
EXE = claussat
CXX?=g++
CC=g++
CFLAGS+=-I.
ifdef PROF
CFLAGS+=-fprofile-arcs -ftest-coverage
CFLAGS+=-pg
CFLAGS+=-g
LNFLAGS+=-fprofile-arcs
LNFLAGS+=-pg
LNFLAGS+=-g
endif
ifdef DBG
CFLAGS+=-O0
CFLAGS+=-ggdb
CFLAGS+=-DDBG
CFLAGS+=-g3
MSAT=libd
else
CFLAGS+=-DNDEBUG
CFLAGS+=-O3
MSAT=libr
endif
ifdef NOO
CFLAGS+=-O0
endif
CFLAGS += -Wall -DBUILDDATE='"$(BUILDDATE)"' -DDISTDATE='"$(DISTDATE)"'
CFLAGS += -DCHANGESET='"$(CHANGESET)"' -DRELDATE='"$(RELDATE)"'
CFLAGS+=-D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wno-parentheses -Wno-deprecated -Wno-misleading-indentation -D _MSC_VER
#CFLAGS+=-std=c++11
CFLAGS+=-std=c++0x
CFLAGS+=-MMD
LIBS+=-lz
# Glucose: No core version after glucose 4.0
ifdef USE_GL
EXTERNAL+=gl
CFLAGS+=-I./src/glucose-4.1/
LIBD+=-L./src/glucose-4.1/simp
LIBD+=-L./src/glucose-4.1/parallel
LIBS+=-lglucose_simp
LIBS+=-lglucose_parallel
CFLAGS+=-DUSE_GL
else
EXTERNAL+=m
LIBS+=-lminisat
LIBS+=-lminisat_simp
LIBD+=-L./src/minisat/core
LIBD+=-L./src/minisat/simp
CFLAGS+=-I./src/minisat/
endif
ifdef EXPERT # allow using giving options, without options the solver's fairly dumb
CFLAGS+=-DEXPERT
endif
ifdef STATIC
CFLAGS+=-static
LNFLAGS+=-static
endif
ifdef USE_SIMP
CFLAGS+=-DUSE_SIMP
endif
ifdef NON_INCR
CFLAGS+=-DNON_INCR
endif
## Filter used to typeset C++
NW_FILTER=-filter C++.filter
.PHONY: m gl all doc
all:
make $(EXE)
$(EXE): $(COBJS) $(EXTERNAL)
@echo Linking: $@
@$(CXX) -o $@ $(COBJS) $(LNFLAGS) $(LIBD) $(LIBS)
m:
@export MROOT=`pwd`/src/minisat ; cd ./src/minisat/core; make CXX=$(CXX) LIB=minisat $(MSAT)
@export MROOT=`pwd`/src/minisat ; cd ./src/minisat/simp; make CXX=$(CXX) LIB=minisat_simp $(MSAT)
gl:
@export MROOT=`pwd`/src/glucose-4.1 ; cd ./src/glucose-4.1/simp; make CXX=$(CXX) LIB=glucose_simp $(MSAT)
@export MROOT=`pwd`/src/glucose-4.1 ; cd ./src/glucose-4.1/parallel; make CXX=$(CXX) LIB=glucose_parallel $(MSAT)
sources: $(GENF)
main.o: main.cc
%.o: %.cc
@echo Compiling: $@
@$(CXX) $(CFLAGS) -c -o $@ $<
%.o: %.c Makefile
@echo Compiling: $@
@$(CXX) $(CFLAGS) -c -o $@ $<
%.tab.h %.tab.c: %.y
@echo Generating: $*
@bison $<
%.c: %.l Makefile
@echo Generating: $*
@flex -o$@ $<
./src/Options.hh ./src/Options.cc: src/option_generation
@echo Generating: $@
./src/option_generation >./src/Options.hh 2>./src/Options.cc
clean:
@rm -f $(DEPENDS)
@rm -f $(GENF)
@rm -f $(EXE) $(EXE).exe $(COBJS) *.tab.[ch]
@export MROOT=`pwd`/src/minisat ; cd ./src/minisat/core; make CXX=$(CXX) clean
@export MROOT=`pwd`/src/minisat ; cd ./src/minisat/simp; make CXX=$(CXX) clean
@export MROOT=`pwd`/src/glucose-4.1 ; cd ./src/glucose-4.1/simp ; make CXX=$(CXX) clean
@export MROOT=`pwd`/src/glucose-4.1 ; cd ./src/glucose-4.1/parallel; make CXX=$(CXX) clean
doc: $(PDFS)
%.pdf: doc/%.tex
@latexmk -pdf $<
doc/%.tex: doc/%.nw doc/texheader.tex Makefile
@noweave -x $(NW_FILTER) $< | sed 's/\\begin{document}/\\input{doc/texheader.tex}\\begin{document}/' >$@
-include ${DEPENDS}