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