2 .
include "../../Makefile.inc"
3 SRCDIR
= ${GCCDIR}/libstdc
++-v3
4 PREDIR
= ${SRCDIR}/config
/abi
/pre
5 .
include "Makefile.src"
10 .PATH
: ${SRCDIR}/src
/c
++98
11 .PATH
: ${SRCDIR}/src
/c
++11
13 # for now do not let the use of -flto (-Wodr...)
20 CXXFLAGS
+= -fno-implicit-templates
21 CXXFLAGS
+= -fdiagnostics-show-location
=once
22 CXXFLAGS
+= -ffunction-sections
-fdata-sections
23 LDFLAGS
+= -Wl
,-z
-Wl
,relro
-Wl
,--gc-sections
24 VERSION_MAP
= ${.OBJDIR
}/libstdcxx.map
27 gnu11_FLAGS
= -std
=gnu
++11
28 gnu11_FLAGS_FILES
= ${cxx11_sources
:S|
++|xx|
}
30 CONVARCS
= ..
/components
/libconv_supc
/libsupcxxconvenience.a
31 CONVARCS
+= ..
/components
/libconv_1998
/libcxx98convenience.a
32 CONVARCS
+= ..
/components
/libconv_2011
/libcxx11convenience.a
33 LDADD
= -Wl
,--whole-archive
${CONVARCS
:.a
=_pic.a
} -lm
34 LDADD
+= -Wl
,--no-whole-archive
35 ARADD
= ${CONVARCS} ${LIBM}
37 # The AR script is a nice trick, but it *cannot* handle "++" on any line
38 # To work around this incredible limitation, copy files with "++" in
39 # their names to a new file name (transform ++ => xx)
41 SRCS
= ${libstdc___la_SOURCES
:S|
++|xx|
}
42 PROBLEMS
= ${libstdc___la_SOURCES
:M
*++*}
43 PROBLEMSXX
= ${PROBLEMS
:S|
++|xx|
}
45 libstdc
++.a
: ${SRCS
:.
cc=.o
} script.
ar
46 @
${ECHO} building static
${LIB} library via script
49 mv libstdcxx.a
${.TARGET
}
52 libstdc
++_p.a
: ${SRCS
:.
cc=.po
} script_p.
ar
53 @
${ECHO} building profiled
${LIB} library via script
55 ${AR} -M
< script_p.
ar
56 mv libstdcxx_p.a
${.TARGET
}
59 ${PROBLEMSXX}: ${PROBLEMS}
60 cp
${SRCDIR}/src
/c
++11/${.TARGET
:S|xx|
++|
} ${.TARGET
}
63 @echo
"#include <stdint.h>" > ${.TARGET
}
66 @echo
"CREATE libstdcxx.a" > ${.TARGET
}
67 .for arc in
${CONVARCS}
68 @echo
"ADDLIB ${arc}" >> ${.TARGET
}
70 .for obj in
${SRCS
:.
cc=.o
}
71 @echo
"ADDMOD ${obj}" >> ${.TARGET
}
73 @echo
"SAVE" >> ${.TARGET
}
74 @echo
"END" >> ${.TARGET
}
76 # XXX for now no profiled CONVARCS libs
78 @echo
"CREATE libstdcxx_p.a" > ${.TARGET
}
79 .for arc in
${CONVARCS}
80 @echo
"ADDLIB ${arc}" >> ${.TARGET
}
82 .for obj in
${SRCS
:.
cc=.po
}
83 @echo
"ADDMOD ${obj}" >> ${.TARGET
}
85 @echo
"SAVE" >> ${.TARGET
}
86 @echo
"END" >> ${.TARGET
}
88 libstdcxx.map
: ${PREDIR}/gnu.ver
${PREDIR}/float128.ver
89 cat
${.ALLSRC
} | grep
-E
-v
'^[ ]*#(#| |$)' | \
90 ${CC} -E
-P
-include ${.CURDIR
}/..
/headers
/config.h
- > ${.TARGET
}
92 GENFILES
= gstdint.h script.
ar script_p.
ar ${PROBLEMSXX} libstdcxx.map
93 CLEANFILES
= ${GENFILES}
94 beforedepend
: ${GENFILES}