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