1# -*- makefile -*- Time-stamp: <07/12/12 01:52:19 ptr>
2#
3# Copyright (c) 1997-1999, 2002, 2003, 2005-2007
4# Petr Ovtchenkov
5#
6# Portion Copyright (c) 1999-2001
7# Parallel Graphics Ltd.
8#
9# Licensed under the Academic Free License version 3.0
10#
11
12ifndef INSTALL_TAGS
13
14ifndef _NO_SHARED_BUILD
15INSTALL_TAGS := install-release-shared
16else
17INSTALL_TAGS :=
18endif
19
20ifdef _STATIC_BUILD
21INSTALL_TAGS += install-release-static
22endif
23
24ifndef _NO_DBG_BUILD
25ifndef _NO_SHARED_BUILD
26INSTALL_TAGS += install-dbg-shared
27endif
28ifdef _STATIC_BUILD
29INSTALL_TAGS += install-dbg-static
30endif
31endif
32
33ifndef _NO_STLDBG_BUILD
34ifndef WITHOUT_STLPORT
35ifndef _NO_SHARED_BUILD
36INSTALL_TAGS += install-stldbg-shared
37endif
38ifdef _STATIC_BUILD
39INSTALL_TAGS += install-stldbg-static
40endif
41endif
42endif
43
44endif
45
46
47ifndef INSTALL_STRIP_TAGS
48
49ifndef _NO_SHARED_BUILD
50INSTALL_STRIP_TAGS := install-strip-shared
51else
52INSTALL_STRIP_TAGS :=
53endif
54
55ifdef _STATIC_BUILD
56INSTALL_STRIP_TAGS += install-release-static
57endif
58
59ifndef _NO_DBG_BUILD
60ifndef _NO_SHARED_BUILD
61INSTALL_STRIP_TAGS += install-dbg-shared
62endif
63ifdef _STATIC_BUILD
64INSTALL_STRIP_TAGS += install-dbg-static
65endif
66endif
67
68ifndef _NO_STLDBG_BUILD
69ifndef WITHOUT_STLPORT
70ifndef _NO_SHARED_BUILD
71INSTALL_STRIP_TAGS += install-stldbg-shared
72endif
73ifdef _STATIC_BUILD
74INSTALL_STRIP_TAGS += install-stldbg-static
75endif
76endif
77endif
78
79endif
80
81
82PHONY += install install-strip install-headers $(INSTALL_TAGS) $(INSTALL_STRIP_TAGS)
83
84install:	$(INSTALL_TAGS) install-headers
85
86install-strip:	$(INSTALL_STRIP_TAGS) install-headers
87
88# Workaround for GNU make 3.80; see comments in rules-so.mak
89define do_install_so_links
90$${INSTALL_LIB_DIR$(1)}/$${SO_NAME$(1)xxx}:	$${SO_NAME_OUT$(1)xxx}
91	$$(INSTALL_SO) $${SO_NAME_OUT$(1)xxx} $$(INSTALL_LIB_DIR$(1))
92	@$(call do_so_links_1,$$(INSTALL_LIB_DIR$(1)),$${SO_NAME$(1)xx},$${SO_NAME$(1)xxx})
93	@$(call do_so_links_1,$$(INSTALL_LIB_DIR$(1)),$${SO_NAME$(1)x},$${SO_NAME$(1)xx})
94	@$(call do_so_links_1,$$(INSTALL_LIB_DIR$(1)),$${SO_NAME$(1)},$${SO_NAME$(1)x})
95endef
96
97# Workaround for GNU make 3.80; see comments in rules-so.mak
98define do_install_so_links_wk
99# expand to nothing, if equal
100ifneq (${INSTALL_LIB_DIR}/${SO_NAMExxx},${INSTALL_LIB_DIR_STLDBG}/${SO_NAME_STLDBGxxx})
101# expand to nothing, if WITHOUT_STLPORT
102ifndef WITHOUT_STLPORT
103$(call do_install_so_links,$(1))
104endif
105endif
106endef
107
108# Workaround for GNU make 3.80; see comments in rules-so.mak
109define do_install_so_links_wk2
110# expand to nothing, if equal
111ifneq (${INSTALL_LIB_DIR}/${SO_NAMExxx},${INSTALL_LIB_DIR_DBG}/${SO_NAME_DBGxxx})
112$(call do_install_so_links,$(1))
113endif
114endef
115
116
117$(eval $(call do_install_so_links,))
118# ifneq (${INSTALL_LIB_DIR}/${SO_NAMExxx},${INSTALL_LIB_DIR_DBG}/${SO_NAME_DBGxxx})
119# $(eval $(call do_install_so_links,_DBG))
120$(eval $(call do_install_so_links_wk2,_DBG))
121# endif
122# ifneq (${INSTALL_LIB_DIR}/${SO_NAMExxx},${INSTALL_LIB_DIR_STLDBG}/${SO_NAME_STLDBGxxx})
123# ifndef WITHOUT_STLPORT
124$(eval $(call do_install_so_links_wk,_STLDBG))
125# endif
126# endif
127
128install-release-shared:	release-shared $(INSTALL_LIB_DIR) $(INSTALL_LIB_DIR)/${SO_NAMExxx} install-headers
129	${POST_INSTALL}
130
131install-strip-shared:	release-shared $(INSTALL_LIB_DIR) $(INSTALL_LIB_DIR)/${SO_NAMExxx} install-headers
132	${STRIP} ${_SO_STRIP_OPTION} $(INSTALL_LIB_DIR)/${SO_NAMExxx}
133	${POST_INSTALL}
134
135install-dbg-shared:	dbg-shared $(INSTALL_LIB_DIR_DBG) $(INSTALL_LIB_DIR_DBG)/${SO_NAME_DBGxxx}
136	${POST_INSTALL_DBG}
137
138ifndef WITHOUT_STLPORT
139install-stldbg-shared:	stldbg-shared $(INSTALL_LIB_DIR_STLDBG) $(INSTALL_LIB_DIR_STLDBG)/${SO_NAME_STLDBGxxx}
140	${POST_INSTALL_STLDBG}
141endif
142
143define do_install_headers
144if [ ! -d $(INSTALL_HDR_DIR) ]; then \
145  $(INSTALL_D) $(INSTALL_HDR_DIR) || { echo "Can't create $(INSTALL_HDR_DIR)"; exit 1; }; \
146fi; \
147for dd in $(HEADERS_BASE); do \
148  d=`dirname $$dd`; \
149  h=`basename $$dd`; \
150  f=`cd $$d; find $$h \( -wholename "*/.svn" -prune \) -o \( -type d -print \)`; \
151  for ddd in $$f; do \
152    if [ ! -d $(INSTALL_HDR_DIR)/$$ddd ]; then \
153      $(INSTALL_D) $(INSTALL_HDR_DIR)/$$ddd || { echo "Can't create $(INSTALL_HDR_DIR)/$$ddd"; exit 1; }; \
154    fi; \
155  done; \
156  f=`find $$dd \( -wholename "*/.svn*" -o -name "*~" -o -name "*.bak" \) -prune -o \( -type f -print \)`; \
157  for ff in $$f; do \
158    h=`echo $$ff | sed -e "s|$$d|$(INSTALL_HDR_DIR)|"`; \
159    $(INSTALL_F) $$ff $$h; \
160  done; \
161done; \
162for f in $(HEADERS); do \
163  h=`basename $$f`; \
164  $(INSTALL_F) $$f $(INSTALL_HDR_DIR)/$$h || { echo "Can't install $(INSTALL_HDR_DIR)/$$h"; exit 1; }; \
165done
166endef
167
168# find $$dd \( -type f \( \! \( -wholename "*/.svn*" -o -name "*~" -o -name "*.bak" \) \) \) -print
169# _HEADERS_FROM = $(shell for dd in $(HEADERS_BASE); do find $$dd \( -type f \( \! \( -wholename "*/.svn/*" -o -name "*~" -o -name "*.bak" \) \) \) -print ; done )
170# _HEADERS_TO = $(foreach d,$(HEADERS_BASE),$(patsubst $(d)/%,$(BASE_INSTALL_DIR)include/%,$(_HEADERS_FROM)))
171
172install-headers:
173	@$(do_install_headers)
174