Skip to content
This repository
Newer
Older
100644 215 lines (173 sloc) 9.504 kb
dd1b19f9 »
2011-01-24 Some fixes to the build system mostly related to dynamic linking.
1 ###################################################################################################
bf3176cf »
2010-12-18 Initial support for build configuration.
2
ed456c5d »
2011-01-13 Add install-bin target to Makefile.
3 .PHONY: r d p sh cr cd cp csh lr ld lp lsh config all install install-headers install-lib\
4 install-bin clean distclean
bf3176cf »
2010-12-18 Initial support for build configuration.
5 all: r lr lsh
6
7 ## Load Previous Configuration ####################################################################
8
9 -include config.mk
10
1328a8db »
2010-12-10 Refactoring + new GNU Make system
11 ## Configurable options ###########################################################################
12
13 # Directory to store object files, libraries, executables, and dependencies:
bf3176cf »
2010-12-18 Initial support for build configuration.
14 BUILD_DIR ?= build
1328a8db »
2010-12-10 Refactoring + new GNU Make system
15
16 # Include debug-symbols in release builds
bf3176cf »
2010-12-18 Initial support for build configuration.
17 MINISAT_RELSYM ?= -g
1328a8db »
2010-12-10 Refactoring + new GNU Make system
18
19 # Sets of compile flags for different build types
bf3176cf »
2010-12-18 Initial support for build configuration.
20 MINISAT_REL ?= -O3 -D NDEBUG
21 MINISAT_DEB ?= -O0 -D DEBUG
22 MINISAT_PRF ?= -O3 -D NDEBUG
23 MINISAT_FPIC ?= -fpic
1328a8db »
2010-12-10 Refactoring + new GNU Make system
24
b6474591 »
2011-01-03 Add install target to Makefile.
25 # GNU Standard Install Prefix
26 prefix ?= /usr/local
bf3176cf »
2010-12-18 Initial support for build configuration.
27
28 ## Write Configuration ###########################################################################
29
30 config:
6736d2f9 »
2011-01-10 More build system clean ups.
31 @( echo 'BUILD_DIR?=$(BUILD_DIR)' ; \
32 echo 'MINISAT_RELSYM?=$(MINISAT_RELSYM)' ; \
33 echo 'MINISAT_REL?=$(MINISAT_REL)' ; \
34 echo 'MINISAT_DEB?=$(MINISAT_DEB)' ; \
35 echo 'MINISAT_PRF?=$(MINISAT_PRF)' ; \
36 echo 'MINISAT_FPIC?=$(MINISAT_FPIC)' ; \
37 echo 'prefix?=$(prefix)' ) > config.mk
1328a8db »
2010-12-10 Refactoring + new GNU Make system
38
39 ## Configurable options end #######################################################################
40
b6474591 »
2011-01-03 Add install target to Makefile.
41 INSTALL ?= install
42
43 # GNU Standard Install Variables
44 exec_prefix ?= $(prefix)
45 includedir ?= $(prefix)/include
46 bindir ?= $(exec_prefix)/bin
47 libdir ?= $(exec_prefix)/lib
48 datarootdir ?= $(prefix)/share
49 mandir ?= $(datarootdir)/man
50
51 # Target file names
52 MINISAT = minisat# Name of MiniSat main executable.
53 MINISAT_CORE = minisat_core# Name of simplified MiniSat executable (only core solver support).
dd1b19f9 »
2011-01-24 Some fixes to the build system mostly related to dynamic linking.
54 MINISAT_SLIB = lib$(MINISAT).a# Name of MiniSat static library.
55 MINISAT_DLIB = lib$(MINISAT).so# Name of MiniSat shared library.
b6474591 »
2011-01-03 Add install target to Makefile.
56
57 # Shared Library Version
4e6288dd »
2010-12-16 First attempt at shared library support.
58 SOMAJOR=2
dd1b19f9 »
2011-01-24 Some fixes to the build system mostly related to dynamic linking.
59 SOMINOR=1
6736d2f9 »
2011-01-10 More build system clean ups.
60 SORELEASE?=.0# Declare empty to leave out from library file name.
4e6288dd »
2010-12-16 First attempt at shared library support.
61
36ca1c7b »
2011-01-07 More buildsystem work.
62 MINISAT_CXXFLAGS = -I. -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wall -Wno-parentheses -Wextra
bf3176cf »
2010-12-18 Initial support for build configuration.
63 MINISAT_LDFLAGS = -Wall -lz
1328a8db »
2010-12-10 Refactoring + new GNU Make system
64
be233888 »
2011-02-07 More minor build system tweaks.
65 ECHO=@echo
36ca1c7b »
2011-01-07 More buildsystem work.
66 ifeq ($(VERB),)
67 VERB=@
68 else
69 VERB=
70 endif
71
b6474591 »
2011-01-03 Add install target to Makefile.
72 SRCS = $(wildcard minisat/core/*.cc) $(wildcard minisat/simp/*.cc) $(wildcard minisat/utils/*.cc)
73 HDRS = $(wildcard minisat/mtl/*.h) $(wildcard minisat/core/*.h) $(wildcard minisat/simp/*.h) $(wildcard minisat/utils/*.h)
74 OBJS = $(filter-out %Main.o, $(SRCS:.cc=.o))
1328a8db »
2010-12-10 Refactoring + new GNU Make system
75
76 r: $(BUILD_DIR)/release/bin/$(MINISAT)
77 d: $(BUILD_DIR)/debug/bin/$(MINISAT)
78 p: $(BUILD_DIR)/profile/bin/$(MINISAT)
4e6288dd »
2010-12-16 First attempt at shared library support.
79 sh: $(BUILD_DIR)/dynamic/bin/$(MINISAT)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
80
81 cr: $(BUILD_DIR)/release/bin/$(MINISAT_CORE)
82 cd: $(BUILD_DIR)/debug/bin/$(MINISAT_CORE)
83 cp: $(BUILD_DIR)/profile/bin/$(MINISAT_CORE)
4e6288dd »
2010-12-16 First attempt at shared library support.
84 csh: $(BUILD_DIR)/dynamic/bin/$(MINISAT_CORE)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
85
86 lr: $(BUILD_DIR)/release/lib/$(MINISAT_SLIB)
87 ld: $(BUILD_DIR)/debug/lib/$(MINISAT_SLIB)
88 lp: $(BUILD_DIR)/profile/lib/$(MINISAT_SLIB)
6736d2f9 »
2011-01-10 More build system clean ups.
89 lsh: $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
90
91 ## Build-type Compile-flags:
bf3176cf »
2010-12-18 Initial support for build configuration.
92 $(BUILD_DIR)/release/%.o: MINISAT_CXXFLAGS +=$(MINISAT_REL) $(MINISAT_RELSYM)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
93 $(BUILD_DIR)/debug/%.o: MINISAT_CXXFLAGS +=$(MINISAT_DEB) -g
94 $(BUILD_DIR)/profile/%.o: MINISAT_CXXFLAGS +=$(MINISAT_PRF) -pg
4e6288dd »
2010-12-16 First attempt at shared library support.
95 $(BUILD_DIR)/dynamic/%.o: MINISAT_CXXFLAGS +=$(MINISAT_REL) $(MINISAT_FPIC)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
96
97 ## Build-type Link-flags:
98 $(BUILD_DIR)/profile/bin/$(MINISAT): MINISAT_LDFLAGS += -pg
bf3176cf »
2010-12-18 Initial support for build configuration.
99 $(BUILD_DIR)/release/bin/$(MINISAT): MINISAT_LDFLAGS += --static $(MINISAT_RELSYM)
5ae731c0 »
2011-02-01 Minor fix to build core executable in static and profile versions.
100 $(BUILD_DIR)/profile/bin/$(MINISAT_CORE): MINISAT_LDFLAGS += -pg
101 $(BUILD_DIR)/release/bin/$(MINISAT_CORE): MINISAT_LDFLAGS += --static $(MINISAT_RELSYM)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
102
103 ## Executable dependencies
104 $(BUILD_DIR)/release/bin/$(MINISAT): $(BUILD_DIR)/release/minisat/simp/Main.o $(BUILD_DIR)/release/lib/$(MINISAT_SLIB)
105 $(BUILD_DIR)/debug/bin/$(MINISAT): $(BUILD_DIR)/debug/minisat/simp/Main.o $(BUILD_DIR)/debug/lib/$(MINISAT_SLIB)
106 $(BUILD_DIR)/profile/bin/$(MINISAT): $(BUILD_DIR)/profile/minisat/simp/Main.o $(BUILD_DIR)/profile/lib/$(MINISAT_SLIB)
4e6288dd »
2010-12-16 First attempt at shared library support.
107 # need the main-file be compiled with fpic?
108 $(BUILD_DIR)/dynamic/bin/$(MINISAT): $(BUILD_DIR)/dynamic/minisat/simp/Main.o $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
109
110 ## Executable dependencies (core-version)
111 $(BUILD_DIR)/release/bin/$(MINISAT_CORE): $(BUILD_DIR)/release/minisat/core/Main.o $(BUILD_DIR)/release/lib/$(MINISAT_SLIB)
112 $(BUILD_DIR)/debug/bin/$(MINISAT_CORE): $(BUILD_DIR)/debug/minisat/core/Main.o $(BUILD_DIR)/debug/lib/$(MINISAT_SLIB)
113 $(BUILD_DIR)/profile/bin/$(MINISAT_CORE): $(BUILD_DIR)/profile/minisat/core/Main.o $(BUILD_DIR)/profile/lib/$(MINISAT_SLIB)
4e6288dd »
2010-12-16 First attempt at shared library support.
114 # need the main-file be compiled with fpic?
115 $(BUILD_DIR)/dynamic/bin/$(MINISAT_CORE): $(BUILD_DIR)/dynamic/minisat/core/Main.o $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB)
1328a8db »
2010-12-10 Refactoring + new GNU Make system
116
117 ## Library dependencies
118 $(BUILD_DIR)/release/lib/$(MINISAT_SLIB): $(foreach o,$(OBJS),$(BUILD_DIR)/release/$(o))
119 $(BUILD_DIR)/debug/lib/$(MINISAT_SLIB): $(foreach o,$(OBJS),$(BUILD_DIR)/debug/$(o))
120 $(BUILD_DIR)/profile/lib/$(MINISAT_SLIB): $(foreach o,$(OBJS),$(BUILD_DIR)/profile/$(o))
2e80302a »
2011-01-27 Fix dependencies for shared library links in build system.
121 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)\
122 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR)\
123 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB): $(foreach o,$(OBJS),$(BUILD_DIR)/dynamic/$(o))
1328a8db »
2010-12-10 Refactoring + new GNU Make system
124
36ca1c7b »
2011-01-07 More buildsystem work.
125 ## Compile rules (these should be unified, buit I have not yet found a way which works in GNU Make)
126 $(BUILD_DIR)/release/%.o: %.cc
be233888 »
2011-02-07 More minor build system tweaks.
127 $(ECHO) Compiling: $@
9e993015 »
2011-02-21 Buildsystem: fix dependency generation to separate build-types.
128 $(VERB) mkdir -p $(dir $@)
129 $(VERB) $(CXX) $(MINISAT_CXXFLAGS) $(CXXFLAGS) -c -o $@ $< -MMD -MF $(BUILD_DIR)/release/$*.d
36ca1c7b »
2011-01-07 More buildsystem work.
130
cf613209 »
2011-01-07 Adding clean target to build system.
131 $(BUILD_DIR)/profile/%.o: %.cc
be233888 »
2011-02-07 More minor build system tweaks.
132 $(ECHO) Compiling: $@
9e993015 »
2011-02-21 Buildsystem: fix dependency generation to separate build-types.
133 $(VERB) mkdir -p $(dir $@)
134 $(VERB) $(CXX) $(MINISAT_CXXFLAGS) $(CXXFLAGS) -c -o $@ $< -MMD -MF $(BUILD_DIR)/profile/$*.d
36ca1c7b »
2011-01-07 More buildsystem work.
135
136 $(BUILD_DIR)/debug/%.o: %.cc
be233888 »
2011-02-07 More minor build system tweaks.
137 $(ECHO) Compiling: $@
9e993015 »
2011-02-21 Buildsystem: fix dependency generation to separate build-types.
138 $(VERB) mkdir -p $(dir $@)
139 $(VERB) $(CXX) $(MINISAT_CXXFLAGS) $(CXXFLAGS) -c -o $@ $< -MMD -MF $(BUILD_DIR)/debug/$*.d
36ca1c7b »
2011-01-07 More buildsystem work.
140
141 $(BUILD_DIR)/dynamic/%.o: %.cc
be233888 »
2011-02-07 More minor build system tweaks.
142 $(ECHO) Compiling: $@
9e993015 »
2011-02-21 Buildsystem: fix dependency generation to separate build-types.
143 $(VERB) mkdir -p $(dir $@)
144 $(VERB) $(CXX) $(MINISAT_CXXFLAGS) $(CXXFLAGS) -c -o $@ $< -MMD -MF $(BUILD_DIR)/dynamic/$*.d
1328a8db »
2010-12-10 Refactoring + new GNU Make system
145
4e6288dd »
2010-12-16 First attempt at shared library support.
146 ## Linking rule
147 $(BUILD_DIR)/release/bin/$(MINISAT) $(BUILD_DIR)/debug/bin/$(MINISAT) $(BUILD_DIR)/profile/bin/$(MINISAT) $(BUILD_DIR)/dynamic/bin/$(MINISAT)\
148 $(BUILD_DIR)/release/bin/$(MINISAT_CORE) $(BUILD_DIR)/debug/bin/$(MINISAT_CORE) $(BUILD_DIR)/profile/bin/$(MINISAT_CORE) $(BUILD_DIR)/dynamic/bin/$(MINISAT_CORE):
be233888 »
2011-02-07 More minor build system tweaks.
149 $(ECHO) Linking Binary: $@
6736d2f9 »
2011-01-10 More build system clean ups.
150 $(VERB) mkdir -p $(dir $@)
151 $(VERB) $(CXX) $^ $(MINISAT_LDFLAGS) $(LDFLAGS) -o $@
1328a8db »
2010-12-10 Refactoring + new GNU Make system
152
4e6288dd »
2010-12-16 First attempt at shared library support.
153 ## Static Library rule
154 %/lib/$(MINISAT_SLIB):
be233888 »
2011-02-07 More minor build system tweaks.
155 $(ECHO) Linking Static Library: $@
6736d2f9 »
2011-01-10 More build system clean ups.
156 $(VERB) mkdir -p $(dir $@)
157 $(VERB) $(AR) -rcs $@ $^
1328a8db »
2010-12-10 Refactoring + new GNU Make system
158
4e6288dd »
2010-12-16 First attempt at shared library support.
159 ## Shared Library rule
dd1b19f9 »
2011-01-24 Some fixes to the build system mostly related to dynamic linking.
160 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)\
161 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR)\
162 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB):
be233888 »
2011-02-07 More minor build system tweaks.
163 $(ECHO) Linking Shared Library: $@
6736d2f9 »
2011-01-10 More build system clean ups.
164 $(VERB) mkdir -p $(dir $@)
71875c16 »
2011-02-07 Also use LDFLAGS when building shared libraries.
165 $(VERB) $(CXX) $(MINISAT_LDFLAGS) $(LDFLAGS) -o $@ -shared -Wl,-soname,$(MINISAT_DLIB).$(SOMAJOR) $^
be233888 »
2011-02-07 More minor build system tweaks.
166 $(VERB) ln -sf $(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE) $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR)
167 $(VERB) ln -sf $(MINISAT_DLIB).$(SOMAJOR) $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB)
4e6288dd »
2010-12-16 First attempt at shared library support.
168
ed456c5d »
2011-01-13 Add install-bin target to Makefile.
169 install: install-headers install-lib install-bin
0b2667ab »
2011-03-28 Add 'install-debug' target to buildsystem.
170 install-debug: install-headers install-lib-debug
b6474591 »
2011-01-03 Add install target to Makefile.
171
172 install-headers:
173 # Create directories
174 $(INSTALL) -d $(DESTDIR)$(includedir)/minisat
175 for dir in mtl utils core simp; do \
176 $(INSTALL) -d $(DESTDIR)$(includedir)/minisat/$$dir ; \
177 done
178 # Install headers
179 for h in $(HDRS) ; do \
36ca1c7b »
2011-01-07 More buildsystem work.
180 $(INSTALL) -m 644 $$h $(DESTDIR)$(includedir)/$$h ; \
b6474591 »
2011-01-03 Add install target to Makefile.
181 done
182
0b2667ab »
2011-03-28 Add 'install-debug' target to buildsystem.
183 install-lib-debug: $(BUILD_DIR)/debug/lib/$(MINISAT_SLIB)
184 $(INSTALL) -d $(DESTDIR)$(libdir)
185 $(INSTALL) -m 644 $(BUILD_DIR)/debug/lib/$(MINISAT_SLIB) $(DESTDIR)$(libdir)
186
6736d2f9 »
2011-01-10 More build system clean ups.
187 install-lib: $(BUILD_DIR)/release/lib/$(MINISAT_SLIB) $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)
b6474591 »
2011-01-03 Add install target to Makefile.
188 $(INSTALL) -d $(DESTDIR)$(libdir)
6736d2f9 »
2011-01-10 More build system clean ups.
189 $(INSTALL) -m 644 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE) $(DESTDIR)$(libdir)
dd1b19f9 »
2011-01-24 Some fixes to the build system mostly related to dynamic linking.
190 ln -sf $(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE) $(DESTDIR)$(libdir)/$(MINISAT_DLIB).$(SOMAJOR)
191 ln -sf $(MINISAT_DLIB).$(SOMAJOR) $(DESTDIR)$(libdir)/$(MINISAT_DLIB)
b6474591 »
2011-01-03 Add install target to Makefile.
192 $(INSTALL) -m 644 $(BUILD_DIR)/release/lib/$(MINISAT_SLIB) $(DESTDIR)$(libdir)
193
dd1b19f9 »
2011-01-24 Some fixes to the build system mostly related to dynamic linking.
194 install-bin: $(BUILD_DIR)/dynamic/bin/$(MINISAT)
195 $(INSTALL) -d $(DESTDIR)$(bindir)
196 $(INSTALL) -m 755 $(BUILD_DIR)/dynamic/bin/$(MINISAT) $(DESTDIR)$(bindir)
197
cf613209 »
2011-01-07 Adding clean target to build system.
198 clean:
199 rm -f $(foreach t, release debug profile dynamic, $(foreach o, $(SRCS:.cc=.o), $(BUILD_DIR)/$t/$o)) \
9e993015 »
2011-02-21 Buildsystem: fix dependency generation to separate build-types.
200 $(foreach t, release debug profile dynamic, $(foreach d, $(SRCS:.cc=.d), $(BUILD_DIR)/$t/$d)) \
cf613209 »
2011-01-07 Adding clean target to build system.
201 $(foreach t, release debug profile dynamic, $(BUILD_DIR)/$t/bin/$(MINISAT_CORE) $(BUILD_DIR)/$t/bin/$(MINISAT)) \
202 $(foreach t, release debug profile, $(BUILD_DIR)/$t/lib/$(MINISAT_SLIB)) \
be233888 »
2011-02-07 More minor build system tweaks.
203 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)\
204 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR)\
205 $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB)
cf613209 »
2011-01-07 Adding clean target to build system.
206
207 distclean: clean
208 rm -f config.mk
209
1328a8db »
2010-12-10 Refactoring + new GNU Make system
210 ## Include generated dependencies
9e993015 »
2011-02-21 Buildsystem: fix dependency generation to separate build-types.
211 -include $(foreach s, $(SRCS:.cc=.d), $(BUILD_DIR)/release/$s)
212 -include $(foreach s, $(SRCS:.cc=.d), $(BUILD_DIR)/debug/$s)
213 -include $(foreach s, $(SRCS:.cc=.d), $(BUILD_DIR)/profile/$s)
214 -include $(foreach s, $(SRCS:.cc=.d), $(BUILD_DIR)/dynamic/$s)
Something went wrong with that request. Please try again.