1# $FreeBSD$ 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 15.if ${MACHINE_ARCH} == "arm" 16CFLAGS+= -D_GLIBCXX_SJLJ_EXCEPTIONS=1 17.endif 18CFLAGS+= -I${.CURDIR} -I${SUPDIR} -I${GCCDIR} -I${SRCDIR}/include 19CFLAGS+= -frandom-seed=RepeatabilityConsideredGood 20CXXFLAGS+= -fno-implicit-templates -ffunction-sections -fdata-sections \ 21 -Wno-deprecated 22 23DPADD= ${LIBM} 24LDADD= -lm 25 26# libstdc++ sources 27SRCS+= 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 \ 35 wstring-inst.cc 36 37# target sources 38SRCS+= atomicity.cc codecvt_members.cc collate_members.cc ctype_members.cc \ 39 messages_members.cc monetary_members.cc numeric_members.cc \ 40 time_members.cc 41 42# target sources extra 43SRCS+= basic_file_stdio.cc c_locale.cc 44 45# C parts of math 46SRCS+= signbitf.c signbitl.c stubs.c 47 48# Embedded copy of libsupc++ 49SRCS+= 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 \ 54 vec.cc vterminate.cc 55 56# from libiberty: 57SRCS+= cp-demangle.c 58 59# MD headers location 60.if ${MACHINE_ARCH} == "sparc64" 61MARCHDIR= sparc 62.elif ${MACHINE_ARCH} == "i386" && ${MACHINE_CPU} != 'i386' 63MARCHDIR= i486 64.elif ${MACHINE_ARCH} == "amd64" 65MARCHDIR= i486 66.else 67MARCHDIR= ${MACHINE_ARCH} 68.endif 69 70ATOMICITY_H= atomicity.h 71.if exists(${SRCDIR}/config/cpu/${MARCHDIR}/atomicity.h) 72ATOMICITY_H= ${SRCDIR}/config/cpu/${MARCHDIR}/atomicity.h 73.else 74ATOMICITY_H= ${SRCDIR}/config/cpu/generic/atomicity.h 75.endif 76 77atomicity.cc: ${ATOMICITY_H} 78 ln -sf ${.ALLSRC} ${.TARGET} 79CLEANFILES+= atomicity.cc 80 81INCSGROUPS= BITSHDRS BKWHDRS EXTHDRS BASEHDRS BASEXHDRS STDHDRS \ 82 TARGETHDRS THRHDRS DEBUGHDRS 83CXXINCLUDEDIR= ${INCLUDEDIR}/c++/3.4 84 85STDHDRS= 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 92.for h in ${STDHDRS} 93STDHDRSNAME_$h=${h:R:S;^std_;;} 94.endfor 95STDHDRS:= ${STDHDRS:S;^;${SRCDIR}/include/std/;} 96STDHDRSDIR= ${CXXINCLUDEDIR} 97 98BITSHDRS= 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 116BITSHDRS:= ${BITSHDRS:S;^;${SRCDIR}/include/bits/;} 117BITSHDRSDIR= ${CXXINCLUDEDIR}/bits 118 119BKWHDRS= 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 125BKWHDRS:= ${BKWHDRS:S;^;${SRCDIR}/include/backward/;} 126BKWHDRSDIR= ${CXXINCLUDEDIR}/backward 127 128EXTHDRS= 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 \ 133 hashtable.h 134EXTHDRS:= ${EXTHDRS:S;^;${SRCDIR}/include/ext/;} 135EXTHDRSDIR= ${CXXINCLUDEDIR}/ext 136 137# This is the common subset of files that all three "C" header models use. 138BASEHDRS= 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} 144BASEHDRSNAME_$h=${h:R:S;^std_;;} 145.endfor 146BASEHDRS:= ${BASEHDRS:S;^;${SRCDIR}/include/c_std/;} 147BASEHDRSDIR= ${CXXINCLUDEDIR} 148 149# Some of the different "C" header models need extra files. 150BASEXHDRS= ${SRCDIR}/include/c_std/cmath.tcc 151BASEXHDRSDIR= ${CXXINCLUDEDIR}/bits 152 153DEBUGHDRS= 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 157DEBUGHDRS:= ${DEBUGHDRS:S;^;${SRCDIR}/include/debug/;} 158DEBUGHDRSDIR= ${CXXINCLUDEDIR}/debug 159 160TARGETHDRS= allocator/new_allocator_base.h \ 161 io/basic_file_stdio.h \ 162 io/c_io_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 172TARGETHDRS:= ${TARGETHDRS:S;^;${SRCDIR}/config/;} 173TARGETHDRS+= c++config.h 174TARGETHDRSNAME_basic_file_stdio.h= basic_file.h 175TARGETHDRSNAME_c_io_stdio.h= c++io.h 176TARGETHDRSNAME_c_locale.h= c++locale.h 177TARGETHDRSNAME_new_allocator_base.h= c++allocator.h 178TARGETHDRSDIR= ${CXXINCLUDEDIR}/bits 179 180MARCHHDRS= atomic_word.h 181.for h in ${MARCHHDRS} 182.if exists(${SRCDIR}/config/cpu/${MARCHDIR}/${h}) 183TARGETHDRS+= ${SRCDIR}/config/cpu/${MARCHDIR}/${h} 184.else 185TARGETHDRS+= ${SRCDIR}/config/cpu/generic/${h} 186.endif 187.endfor 188 189THRHDRS= gthr.h gthr-single.h gthr-posix.h gthr-default.h 190THRHDRSDIR= ${CXXINCLUDEDIR}/bits 191uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_] 192 193gthr.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} 198 199gthr-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} 203 204gthr-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} 210 211gthr-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} 218 219CLEANFILES+= ${THRHDRS} 220 221c++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} 229CLEANFILES+= c++config.h 230 231.include <bsd.lib.mk> 232