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