summaryrefslogtreecommitdiff
path: root/Makefile.builds.in
blob: 7d2e8586b9bcbab182648795512d9f13a5a1a7e5 (plain)
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
155
156
157
158
# -*- makefile -*-
#
# This Makefile produces the Makefile in the top-level builds/
# directory for standard-path builds (e.g., those configured from the
# source tree).  It has some autoconf cruft in it, documented below.
#
# Its main purposes are to:
# 1. build the current build profile
# 2. install into "builds/$(CURRENT_BUILD)/$(prefix)"
# 3. set up "builds/$(CURRENT_BUILD)/{bin,lib}" symlinks
# 4. install into "builds/$(prefix)"
# 5. set up "builds/bin" and "builds/lib"
#
# Steps 2 and 4 require libtool-relinking for dynamically-linked
# executables and libraries, since build/bin is not the final
# installation path.

# Include the "current" build profile.
include current

# Set up $(MAKE)
@SET_MAKE@

# Set up some basic autoconf make vars
install_sh = @install_sh@
mkinstalldirs = $(install_sh) -d
exec_prefix = @exec_prefix@
prefix = @prefix@
bindir = @bindir@
libdir = @libdir@
abs_builddir = @abs_builddir@
distdir = @PACKAGE@-@VERSION@

# Are we building the libcvc4compat library ?
CVC4_BUILD_LIBCOMPAT = @CVC4_BUILD_LIBCOMPAT@

# Are we building static/dynamic libraries/binaries?  One or the other can be
# on, or both.
BUILDING_STATIC = @BUILDING_STATIC@
BUILDING_SHARED = @BUILDING_SHARED@
STATIC_BINARY = @STATIC_BINARY@

.PHONY: _default_build_ all
_default_build_: all
all:
#	build the current build profile
	+(cd $(CURRENT_BUILD) && $(MAKE) $@)
#	set up builds/$(CURRENT_BUILD)/...prefix.../bin
#	and builds/$(CURRENT_BUILD)/...prefix.../lib
	$(mkinstalldirs) "$(CURRENT_BUILD)$(bindir)" "$(CURRENT_BUILD)$(libdir)"
#	install libcvc4
	$(CURRENT_BUILD)/libtool --mode=install install -v \
		$(CURRENT_BUILD)/src/libcvc4.la \
		"$(abs_builddir)$(libdir)"
#	install libcvc4parser
	$(CURRENT_BUILD)/libtool --mode=install install -v \
		$(CURRENT_BUILD)/src/parser/libcvc4parser.la \
		"$(abs_builddir)$(libdir)"
ifeq ($(CVC4_BUILD_LIBCOMPAT),yes)
#	install libcvc4compat
	$(CURRENT_BUILD)/libtool --mode=install install -v \
		$(CURRENT_BUILD)/src/compat/libcvc4compat.la \
		"$(abs_builddir)$(libdir)"
endif
ifeq ($(BUILDING_SHARED)$(STATIC_BINARY),10)
#	if we're building shared libs and the binary is not static, relink
#	the handling with empty $relink_command is a hack for Mac OS
	thelibdir="$(abs_builddir)$(libdir)"; \
	progdir="$(abs_builddir)$(bindir)"; file=cvc4; \
		eval `grep '^relink_command=' $(CURRENT_BUILD)/src/main/cvc4 | sed 's:-Wl,-rpath:-Wl,-rpath -Wl,\\\\$$thelibdir -Wl,-rpath:'`; \
		if test -z "$$relink_command"; then \
			$(mkinstalldirs) "$(CURRENT_BUILD)$(bindir)/.libs"; \
			$(install_sh) \
				$(CURRENT_BUILD)/src/main/.libs/cvc4 \
				"$(abs_builddir)$(bindir)/.libs"; \
			$(install_sh) \
				$(CURRENT_BUILD)/src/main/cvc4 \
				"$(abs_builddir)$(bindir)"; \
		else \
			eval "(cd $(CURRENT_BUILD)/src/main && $$relink_command)"; \
		fi
else
#	if we're building static libs only, just install the driver binary directly
	$(install_sh) \
		$(CURRENT_BUILD)/src/main/cvc4 \
		"$(abs_builddir)$(bindir)"
endif
#	set up builds/$(CURRENT_BUILD)/bin and builds/$(CURRENT_BUILD)/lib
	test -e $(CURRENT_BUILD)/lib || ln -sfv "$(abs_builddir)$(libdir)" $(CURRENT_BUILD)/lib
	test -e $(CURRENT_BUILD)/bin || ln -sfv "$(abs_builddir)$(bindir)" $(CURRENT_BUILD)/bin
#	set up builds/...prefix.../bin and builds/...prefix.../lib
	$(mkinstalldirs) ".$(bindir)" ".$(libdir)"
#	install libcvc4
	$(CURRENT_BUILD)/libtool --mode=install install -v $(CURRENT_BUILD)/src/libcvc4.la "`pwd`$(libdir)"
#	install libcvc4parser
	$(CURRENT_BUILD)/libtool --mode=install install -v $(CURRENT_BUILD)/src/parser/libcvc4parser.la "`pwd`$(libdir)"
ifeq ($(CVC4_BUILD_LIBCOMPAT),yes)
#	install libcvc4compat
	$(CURRENT_BUILD)/libtool --mode=install install -v $(CURRENT_BUILD)/src/compat/libcvc4compat.la "`pwd`$(libdir)"
endif
ifeq ($(BUILDING_SHARED)$(STATIC_BINARY),10)
#	if we're building shared libs and the binary is not static, relink
#	the handling with empty $relink_command is a hack for Mac OS
	thelibdir="`pwd`$(libdir)"; progdir="`pwd`$(bindir)"; file=cvc4; \
		eval `grep '^relink_command=' $(CURRENT_BUILD)/src/main/cvc4 | sed 's:-Wl,-rpath:-Wl,-rpath -Wl,\\\\$$thelibdir -Wl,-rpath:'`; \
		if test -z "$$relink_command"; then \
			$(mkinstalldirs) ".$(bindir)/.libs"; \
			$(install_sh) \
				$(CURRENT_BUILD)/src/main/.libs/cvc4 \
				"`pwd`$(bindir)/.libs"; \
			$(install_sh) \
				$(CURRENT_BUILD)/src/main/cvc4 \
				"`pwd`$(bindir)"; \
		else \
			eval "(cd $(CURRENT_BUILD)/src/main && $$relink_command)"; \
		fi
else
#	if we're building static libs only, just install the driver binary directly
	$(install_sh) $(CURRENT_BUILD)/src/main/cvc4 "`pwd`$(bindir)"
endif
#	set up builds/bin and builds/lib
	test -e lib || ln -sfv ".$(libdir)" lib
	test -e bin || ln -sfv ".$(bindir)" bin

# The descent into "src" with target "check" is to build check
# prerequisites (e.g. CHECK_PROGRAMS, CHECK_LTLIBRARIES, ...).
check test units:
	(cd $(CURRENT_BUILD)/src && $(MAKE) check)
	+(cd $(CURRENT_BUILD)/test && $(MAKE) $@)
systemtests regress: all
	+(cd $(CURRENT_BUILD)/test && $(MAKE) $@)
units%:
	(cd $(CURRENT_BUILD)/src && $(MAKE) check)
	+(cd $(CURRENT_BUILD)/test && $(MAKE) units TEST_PREFIX=$(subst units:,,$@))
regress%: all
	+(cd $(CURRENT_BUILD)/test && $(MAKE) $@)

dist:
	+(cd $(CURRENT_BUILD) && $(MAKE) $@)
	$(install_sh) \
		$(CURRENT_BUILD)/$(distdir).tar.gz \
		"`pwd`"

TAGS tags:
	+(cd $(CURRENT_BUILD) && $(MAKE) $@)
	ln -sf $(CURRENT_BUILD)/TAGS .

.PHONY: TAGS tags

.PHONY: doc-builds doc-prereq
doc-builds: doc-prereq
	+(cd $(CURRENT_BUILD) && $(MAKE) doxygen-doc)
doc-prereq:
	+(cd $(CURRENT_BUILD) && for dir in `find . -name Makefile | xargs grep -l BUILT_SOURCES`; do (cd `dirname "$$dir"`; (cat Makefile; echo 'doc-prereq: $$(BUILT_SOURCES)') | $(MAKE) -f- doc-prereq); done)

# any other target than the default doesn't do the extra stuff above
%:
	+(cd $(CURRENT_BUILD) && $(MAKE) $@)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback