Makefile revision 132751
1# $FreeBSD: head/gnu/lib/libstdc++/Makefile 132751 2004-07-28 05:27:21Z kan $
2
3GCCDIR=	${.CURDIR}/../../../contrib/gcc
4SRCDIR=	${.CURDIR}/../../../contrib/libstdc++
5SUPDIR=	${SRCDIR}/libsupc++
6
7.PATH: ${SRCDIR}/src ${SRCDIR}/libmath ${SRCDIR}/config/io \
8       ${SRCDIR}/config/locale/generic ${SRCDIR}/include \
9       ${SUPDIR} ${GCCDIR}
10
11LIB=		stdc++
12SHLIB_MAJOR=	4
13
14CFLAGS+=	-DIN_GLIBCPP_V3 -DHAVE_CONFIG_H
15CFLAGS+=	-I${.CURDIR} -I${SUPDIR} -I${GCCDIR} -I${SRCDIR}/include
16CXXFLAGS+=	-fno-implicit-templates -ffunction-sections -fdata-sections \
17		-Wno-deprecated
18
19LDADD=		-lm
20DPADD=		${LIBM}
21
22# libstdc++ sources
23SRCS+= 	allocator.cc codecvt.cc complex_io.cc ctype.cc debug.cc functexcept.cc \
24	globals_locale.cc globals_io.cc ios.cc ios_failure.cc ios_init.cc \
25	ios_locale.cc limits.cc list.cc locale.cc locale_init.cc \
26	locale_facets.cc localename.cc stdexcept.cc strstream.cc tree.cc \
27	allocator-inst.cc concept-inst.cc fstream-inst.cc ext-inst.cc \
28	io-inst.cc istream-inst.cc locale-inst.cc locale-misc-inst.cc \
29	misc-inst.cc ostream-inst.cc sstream-inst.cc streambuf-inst.cc \
30	string-inst.cc valarray-inst.cc wlocale-inst.cc wstring-inst.cc 
31
32# target sources
33SRCS+=  atomicity.cc codecvt_members.cc collate_members.cc ctype_members.cc \
34	messages_members.cc monetary_members.cc numeric_members.cc \
35	time_members.cc
36
37# target sources extra
38SRCS+=  basic_file_stdio.cc c_locale.cc
39
40# C parts of math
41SRCS+=	signbitf.c signbitl.c stubs.c
42
43# Embedded copy of libsupc++
44SRCS+=	del_op.cc del_opnt.cc del_opv.cc del_opvnt.cc eh_alloc.cc \
45	eh_aux_runtime.cc eh_catch.cc eh_exception.cc eh_globals.cc \
46	eh_personality.cc eh_term_handler.cc eh_terminate.cc eh_throw.cc \
47	eh_type.cc eh_unex_handler.cc guard.cc new_handler.cc new_op.cc \
48	new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc \
49	vec.cc vterminate.cc
50
51# from libiberty:
52SRCS+=	cp-demangle.c
53
54# MD headers location
55.if ${MACHINE_ARCH} == "sparc64"
56MARCHDIR=	sparc
57.elif ${MACHINE_ARCH} == "i386" && ${MACHINE_CPU} != 'i386'
58MARCHDIR=	i486
59.elif ${MACHINE_ARCH} == "amd64"
60MARCHDIR=	i486
61.else
62MARCHDIR=	${MACHINE_ARCH}
63.endif
64
65ATOMICITY_H=	atomicity.h
66.if exists(${SRCDIR}/config/cpu/${MARCHDIR}/atomicity.h)
67ATOMICITY_H=	${SRCDIR}/config/cpu/${MARCHDIR}/atomicity.h
68.else
69ATOMICITY_H=	${SRCDIR}/config/cpu/generic/atomicity.h
70.endif
71
72atomicity.cc:	${ATOMICITY_H}
73	ln -sf ${.ALLSRC} ${.TARGET}
74
75INCSGROUPS=	BITSHDRS BKWHDRS EXTHDRS BASEHDRS BASEXHDRS STDHDRS \
76		TARGETHDRS THRHDRS DEBUGHDRS
77CXXINCLUDEDIR=	${INCLUDEDIR}/c++/3.4
78
79STDHDRS=	std_algorithm.h std_bitset.h std_complex.h std_deque.h \
80		std_fstream.h std_functional.h std_iomanip.h std_ios.h \
81		std_iosfwd.h std_iostream.h std_istream.h std_iterator.h \
82		std_limits.h std_list.h std_locale.h std_map.h std_memory.h \
83		std_numeric.h std_ostream.h std_queue.h std_set.h \
84		std_sstream.h std_stack.h std_stdexcept.h std_streambuf.h \
85		std_string.h std_utility.h std_valarray.h std_vector.h
86.for h in ${STDHDRS}
87STDHDRSNAME_$h=${h:R:S;^std_;;}
88.endfor
89STDHDRS:=	${STDHDRS:S;^;${SRCDIR}/include/std/;}
90STDHDRSDIR=	${CXXINCLUDEDIR}
91
92BITSHDRS=	allocator.h atomicity.h basic_ios.h basic_ios.tcc \
93		basic_string.h basic_string.tcc boost_concept_check.h \
94		char_traits.h codecvt.h concept_check.h concurrence.h \
95		cpp_type_traits.h deque.tcc fstream.tcc functexcept.h \
96		gslice.h gslice_array.h indirect_array.h ios_base.h \
97		istream.tcc list.tcc locale_classes.h locale_facets.h \
98		locale_facets.tcc localefwd.h mask_array.h ostream.tcc \
99		postypes.h stream_iterator.h streambuf_iterator.h \
100		slice_array.h sstream.tcc stl_algo.h stl_algobase.h \
101		stl_bvector.h stl_construct.h stl_deque.h stl_function.h \
102		stl_heap.h stl_iterator.h stl_iterator_base_funcs.h \
103		stl_iterator_base_types.h stl_list.h stl_map.h stl_multimap.h \
104		stl_multiset.h stl_numeric.h stl_pair.h stl_queue.h \
105		stl_raw_storage_iter.h stl_relops.h stl_set.h stl_stack.h \
106		stl_tempbuf.h stl_threads.h stl_tree.h stl_uninitialized.h \
107		stl_vector.h streambuf.tcc stringfwd.h type_traits.h \
108		valarray_array.h valarray_array.tcc valarray_before.h \
109		valarray_after.h vector.tcc
110BITSHDRS:=	${BITSHDRS:S;^;${SRCDIR}/include/bits/;}
111BITSHDRSDIR=	${CXXINCLUDEDIR}/bits
112
113BKWHDRS=	complex.h iomanip.h istream.h ostream.h stream.h streambuf.h \
114		algo.h algobase.h alloc.h bvector.h defalloc.h deque.h \
115		function.h hash_map.h hash_set.h hashtable.h heap.h iostream.h \
116		iterator.h list.h map.h multimap.h new.h multiset.h pair.h \
117		queue.h rope.h set.h slist.h stack.h tempbuf.h tree.h \
118		vector.h fstream.h strstream backward_warning.h
119BKWHDRS:=	${BKWHDRS:S;^;${SRCDIR}/include/backward/;}
120BKWHDRSDIR=	${CXXINCLUDEDIR}/backward
121
122EXTHDRS=	algorithm bitmap_allocator.h debug_allocator.h demangle.h \
123		enc_filebuf.h stdio_filebuf.h stdio_sync_filebuf.h functional \
124		hash_map hash_set iterator malloc_allocator.h memory \
125		mt_allocator.h new_allocator.h numeric pod_char_traits.h \
126		pool_allocator.h rb_tree rope ropeimpl.h slist hash_fun.h \
127		hashtable.h
128EXTHDRS:=	${EXTHDRS:S;^;${SRCDIR}/include/ext/;}
129EXTHDRSDIR=	${CXXINCLUDEDIR}/ext
130
131# This is the common subset of files that all three "C" header models use.
132BASEHDRS=	std_cassert.h std_cctype.h std_cerrno.h std_cfloat.h \
133		std_ciso646.h std_climits.h std_clocale.h std_cmath.h \
134		std_csetjmp.h std_csignal.h std_cstdarg.h std_cstddef.h \
135		std_cstdio.h std_cstdlib.h std_cstring.h std_ctime.h \
136		std_cwchar.h std_cwctype.h
137.for h in ${BASEHDRS}
138BASEHDRSNAME_$h=${h:R:S;^std_;;}
139.endfor
140BASEHDRS:=	${BASEHDRS:S;^;${SRCDIR}/include/c_std/;}
141BASEHDRSDIR=	${CXXINCLUDEDIR}
142
143# Some of the different "C" header models need extra files.
144BASEXHDRS=	${SRCDIR}/include/c_std/cmath.tcc
145BASEXHDRSDIR=	${CXXINCLUDEDIR}/bits
146
147DEBUGHDRS=	bitset debug.h deque formatter.h hash_map hash_map.h \
148		hash_multimap.h hash_multiset.h hash_set hash_set.h list \
149		map map.h multimap.h multiset.h safe_base.h safe_iterator.h \
150		safe_iterator.tcc safe_sequence.h set set.h string vector
151DEBUGHDRS:=	${DEBUGHDRS:S;^;${SRCDIR}/include/debug/;}
152DEBUGHDRSDIR=	${CXXINCLUDEDIR}/debug
153
154TARGETHDRS=	allocator/new_allocator_base.h \
155		io/basic_file_stdio.h \
156		io/c_io_stdio.h \
157		locale/generic/c_locale.h \
158		locale/generic/c++locale_internal.h \
159		locale/generic/messages_members.h \
160		locale/generic/time_members.h \
161		locale/generic/codecvt_specializations.h \
162		os/bsd/freebsd/ctype_base.h \
163		os/bsd/freebsd/ctype_inline.h \
164		os/bsd/freebsd/ctype_noninline.h \
165		os/bsd/freebsd/os_defines.h
166TARGETHDRS:=	${TARGETHDRS:S;^;${SRCDIR}/config/;}
167TARGETHDRS+=	c++config.h
168TARGETHDRSNAME_basic_file_stdio.h= basic_file.h
169TARGETHDRSNAME_c_io_stdio.h= c++io.h
170TARGETHDRSNAME_c_locale.h= c++locale.h
171TARGETHDRSNAME_new_allocator_base.h= c++allocator.h
172TARGETHDRSDIR=	${CXXINCLUDEDIR}/bits
173
174MARCHHDRS=	atomic_word.h
175.for h in ${MARCHHDRS}
176.if exists(${SRCDIR}/config/cpu/${MARCHDIR}/${h})
177TARGETHDRS+=	${SRCDIR}/config/cpu/${MARCHDIR}/${h}
178.else
179TARGETHDRS+=	${SRCDIR}/config/cpu/generic/${h}
180.endif
181.endfor
182
183THRHDRS=	gthr.h gthr-single.h gthr-posix.h gthr-default.h
184THRHDRSDIR=	${CXXINCLUDEDIR}/bits
185uppercase =	[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
186
187gthr.h: ${GCCDIR}/gthr.h
188	sed -e '/^#/s/\(${uppercase}${uppercase}*\)/_GLIBCXX_\1/g' \
189	    -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
190	    -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
191	    < ${.ALLSRC} > ${.TARGET}
192
193gthr-single.h: ${GCCDIR}/gthr-single.h
194	sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
195	    -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
196	    < ${.ALLSRC} > ${.TARGET}
197
198gthr-posix.h: ${GCCDIR}/gthr-posix.h
199	sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
200	    -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
201	    -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
202	    -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
203	    < ${.ALLSRC} > ${.TARGET}
204
205gthr-default.h: ${GCCDIR}/gthr-posix.h
206	sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
207	    -e 's/\(GCC${uppercase}*_H\)/_GLIBCXX_\1/g' \
208	    -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
209	    -e 's/\(${uppercase}*USE_WEAK\)/_GLIBCXX_\1/g' \
210	    -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
211	    < ${.ALLSRC} > ${.TARGET}
212
213CLEANFILES+=	${THRHDRS}
214
215c++config.h: ${.CURDIR}/config.h ${SRCDIR}/include/bits/c++config
216	cat ${SRCDIR}/include/bits/c++config > ${.TARGET} && \
217	sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
218	    -e 's/PACKAGE/_GLIBCXX_PACKAGE/g' \
219	    -e 's/VERSION/_GLIBCXX_VERSION/g' \
220	    -e 's/WORDS_/_GLIBCXX_WORDS_/g' \
221	    < ${.CURDIR}/config.h >> ${.TARGET} && \
222	echo "#endif // _CXXCONFIG_" >> ${.TARGET}
223CLEANFILES+=	c++config.h
224
225.include <bsd.lib.mk>
226