libstdcxx5: Fix profiled library creation.
[dragonfly.git] / gnu / lib / gcc50 / libstdcxx / product / Makefile
blob96013a836083b55f115c6a111cad0dab56cf95a0
1 RELUP= /..
2 .include "../../Makefile.inc"
3 SRCDIR= ${GCCDIR}/libstdc++-v3
4 PREDIR= ${SRCDIR}/config/abi/pre
5 .include "Makefile.src"
7 LIB= stdc++
8 SHLIB_MAJOR= 9
10 .PATH: ${SRCDIR}/src/c++98
11 .PATH: ${SRCDIR}/src/c++11
13 # for now do not let the use of -flto (-Wodr...)
14 .if ${CFLAGS:M-flto}
15 CFLAGS+= -fno-lto
16 LDFLAGS+= -flto
17 .endif
19 CFLAGS+= -I${.OBJDIR}
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
26 FLAGS_GROUPS= gnu11
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
47 rm -f ${.TARGET}
48 ${AR} -M < script.ar
49 mv libstdcxx.a ${.TARGET}
50 ${RANLIB} ${.TARGET}
52 libstdc++_p.a: ${SRCS:.cc=.po} script_p.ar
53 @${ECHO} building profiled ${LIB} library via script
54 rm -f ${.TARGET}
55 ${AR} -M < script_p.ar
56 mv libstdcxx_p.a ${.TARGET}
57 ${RANLIB} ${.TARGET}
59 ${PROBLEMSXX}: ${PROBLEMS}
60 cp ${SRCDIR}/src/c++11/${.TARGET:S|xx|++|} ${.TARGET}
62 gstdint.h:
63 @echo "#include <stdint.h>" > ${.TARGET}
65 script.ar:
66 @echo "CREATE libstdcxx.a" > ${.TARGET}
67 .for arc in ${CONVARCS}
68 @echo "ADDLIB ${arc}" >> ${.TARGET}
69 .endfor
70 .for obj in ${SRCS:.cc=.o}
71 @echo "ADDMOD ${obj}" >> ${.TARGET}
72 .endfor
73 @echo "SAVE" >> ${.TARGET}
74 @echo "END" >> ${.TARGET}
76 # XXX for now no profiled CONVARCS libs
77 script_p.ar:
78 @echo "CREATE libstdcxx_p.a" > ${.TARGET}
79 .for arc in ${CONVARCS}
80 @echo "ADDLIB ${arc}" >> ${.TARGET}
81 .endfor
82 .for obj in ${SRCS:.cc=.po}
83 @echo "ADDMOD ${obj}" >> ${.TARGET}
84 .endfor
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}
96 .include <bsd.lib.mk>