forked from arminbiere/cadical
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.in
106 lines (73 loc) · 3.39 KB
/
makefile.in
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
#==========================================================================#
# This is a 'makefile.in' template with '@CXX@' and '@CXXFLAGS@' parameters.
# This makefile requires GNU make.
#==========================================================================#
# The '../scripts/make-build-header.sh' script searches for the next two
# lines to figure out the compiler and compilation flags. This information
# is then used to generate corresponding macros in 'build.hpp'.
CXX=@CXX@
CXXFLAGS=@CXXFLAGS@
LIBS=@LIBS@
ROOT=@ROOT@
CONTRIB=@CONTRIB@
############################################################################
# It is usually not necessary to change anything below this line! #
############################################################################
SRC_APP=src/cadical.cpp src/mobical.cpp
SRC_SOLVER=$(subst $(ROOT)/,,$(sort $(wildcard $(ROOT)/src/*.cpp)))
SRC_CONTRIB=$(subst $(ROOT)/,,$(sort $(wildcard $(ROOT)/contrib/*.cpp)))
FILT_SOLVER=$(filter-out $(SRC_APP),$(SRC_SOLVER))
FILT_CONTRIB=$(if $(filter-out no,$(CONTRIB)),$(SRC_CONTRIB),)
OBJ_SOLVER=$(FILT_SOLVER:.cpp=.o)
OBJ_CONTRIB=$(FILT_CONTRIB:.cpp=.o)
# Include for current build directory is required for including the
# generated build header build.hpp.
DIR=../$(shell pwd|sed -e 's,.*/,,')
COMPILE=$(CXX) $(CXXFLAGS) -I$(DIR) -I$(ROOT)/src
#--------------------------------------------------------------------------#
all: libcadical.a cadical mobical
#--------------------------------------------------------------------------#
.SUFFIXES: .cpp .o
src/%.o: $(ROOT)/src/%.cpp $(ROOT)/src/*.hpp makefile
@mkdir -p $(dir $@)
$(COMPILE) -c $< -o $@
contrib/%.o: $(ROOT)/contrib/%.cpp $(ROOT)/contrib/%.hpp $(ROOT)/src/*.hpp makefile
@mkdir -p $(dir $@)
$(COMPILE) -c $< -o $@
#--------------------------------------------------------------------------#
# Application binaries (the stand alone solver 'cadical' and the model based
# tester 'mobical') and the library are the main build targets.
cadical: src/cadical.o libcadical.a makefile
$(COMPILE) -o $@ $< -L. -lcadical $(LIBS)
mobical: src/mobical.o libcadical.a makefile $(LIBS)
$(COMPILE) -o $@ $< -L. -lcadical
libcadical.a: $(OBJ_SOLVER) $(OBJ_CONTRIB) makefile
ar rc $@ $(OBJ_SOLVER) $(OBJ_CONTRIB)
#--------------------------------------------------------------------------#
# Note that 'build.hpp' is generated and resides in the build directory.
build.hpp: always
$(ROOT)/scripts/make-build-header.sh > build.hpp
src/version.o: build.hpp
update:
$(ROOT)/scripts/update-version.sh
#--------------------------------------------------------------------------#
# These two 'C' interfaces include '.h' headers and thus require explicitly
# defined additional dependencies.
ccadical.o: $(ROOT)/src/ccadical.h
ipasir.o: $(ROOT)/src/ipasir.h $(ROOT)/src/ccadical.h
#--------------------------------------------------------------------------#
analyze: all
$(COMPILE) --analyze $(ROOT)/src/*.cpp
$(COMPILE) --analyze $(ROOT)/contrib/*.cpp
format:
clang-format -i $(ROOT)/*/*.[ch]pp
clang-format -i $(ROOT)/*/*.[ch]
clang-format -i $(ROOT)/test/*/*.[ch]pp
clang-format -i $(ROOT)/test/*/*.[ch]
clean:
rm -f *.o *.a cadical mobical makefile build.hpp
rm -f *.gcda *.gcno *.gcov gmon.out
test: all
CADICALBUILD="$(DIR)" $(MAKE) -j1 -C $(ROOT)/test
#--------------------------------------------------------------------------#
.PHONY: all always analyze clean test update format