1#	$NetBSD: Makefile,v 1.7 2013/11/01 18:11:49 christos Exp $
2
3REQUIRETOOLS=	yes
4NOLINT=		# defined
5
6.include <bsd.own.mk>
7
8.include "Makefile.inc"
9
10LIB=		stdc++
11LDADD=		-lgcc_s
12
13LIBDPLIBS+=	m ${.CURDIR}/../../../../../lib/libm
14
15.if defined(__MINIX)
16NOGCCERROR=yes
17NOCLANGERROR=yes
18.endif
19
20UNSUPPORTED_COMPILER.clang=	# defined
21CWARNFLAGS.clang+=	-Wno-logical-op-parentheses \
22			-Wno-deprecated-writable-strings -Wno-parentheses
23
24.if exists(${.CURDIR}/arch/${GCC_MACHINE_ARCH}/defs.mk) && ${MKGCC} != "no"
25.include "${.CURDIR}/arch/${GCC_MACHINE_ARCH}/defs.mk"
26
27.if defined(__MINIX)
28# by itself, libstdc++ think it is version 6, so use the same number here
29# as this is the exact same code, and will allow us to provide this library
30# from the base system (here), or through the gcc45 package.
31SHLIB_MAJOR=	6
32.else
33SHLIB_MAJOR=	7
34.endif # defined(__MINIX)
35SHLIB_MINOR=	1
36
37SUBDIR=		include
38
39.include "${.CURDIR}/../libsupc++/Makefile.common"
40
41SRCS=		${LIBSUPCXXSRCS} ${LIBSTDCXXSRCS}
42# affects profiling; can't switch it off just for profiling easily.
43#CXXFLAGS+=	${G_SECTION_FLAGS}
44#CXXFLAGS+=	-ffunction-sections -fdata-sections
45CXXFLAGS+=	-fno-implicit-templates -fdiagnostics-show-location=once
46CPPFLAGS+=	-I${DIST}/libstdc++-v3/include
47CPPFLAGS+=	-I${.CURDIR}/arch/${GCC_MACHINE_ARCH}
48CPPFLAGS+=	-I${.CURDIR}/../libgomp/arch/${GCC_MACHINE_ARCH}
49
50CONF=		${DIST}/libstdc++-v3/config
51
52#BUILDSYMLINKS+=	${CONF}/io/basic_file_stdio.cc		basic_file.cc \
53#		${CONF}/locale/generic/c_locale.cc	c++locale.cc
54
55GLIBCPP_INCLUDE_DIR=	${DESTDIR}/usr/include/g++
56
57COPTS.cp-demangle.c = -Wno-stack-protector
58COPTS.fstream-inst.cc = -Wno-stack-protector
59COPTS.locale-inst.cc = -Wno-stack-protector
60COPTS.misc-inst.cc = -Wno-stack-protector
61COPTS.ostream-inst.cc = -Wno-stack-protector
62COPTS.valarray-inst.cc = -Wno-stack-protector
63COPTS.wlocale-inst.cc = -Wno-stack-protector
64COPTS.concept-inst.cc=	-D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates
65CPPFLAGS.strstream.cc=	-I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated
66
67# For GCC 4.5
68.if ${HAVE_GCC} >= 45
69# XXX also need this for some PCHs.
70CPPFLAGS.atomic.cc = -std=gnu++0x
71CPPFLAGS.compatibility-c++0x.cc = -std=gnu++0x
72CPPFLAGS.functexcept.cc = -std=gnu++0x
73CPPFLAGS.hash_c++0x.cc = -std=gnu++0x
74CPPFLAGS.hashtable_c++0x.cc = -std=gnu++0x
75CPPFLAGS.limits.cc = -std=gnu++0x
76CPPFLAGS.system_error.cc = -std=gnu++0x
77CPPFLAGS.fstream-inst.cc = -std=gnu++0x
78CPPFLAGS.string-inst.cc = -std=gnu++0x
79CPPFLAGS.wstring-inst.cc = -std=gnu++0x
80CPPFLAGS.mutex.cc = -std=gnu++0x
81CPPFLAGS.condition_variable.cc = -std=gnu++0x
82CPPFLAGS.chrono.cc = -std=gnu++0x
83CPPFLAGS.thread.cc = -std=gnu++0x
84CPPFLAGS.future.cc = -std=gnu++0x
85
86CPPFLAGS.cp-demangle.cc += -DIN_GLIBCPP_V3
87CPPFLAGS.concept-inst.cc += -D_GLIBCXX_CONCEPT_CHECKS
88CPPFLAGS.parallel_list.cc += -D_GLIBCXX_PARALLEL
89CPPFLAGS.parallel_settings.cc += -D_GLIBCXX_PARALLEL
90CPPFLAGS.compatibility-parallel_list.cc += -D_GLIBCXX_PARALLEL
91.endif
92
93# XXX
94MKDEPFLAGS+=	-I$(GLIBCPP_INCLUDE_DIR)/backward
95
96.include <bsd.lib.mk>
97.include <bsd.subdir.mk>
98.include <bsd.info.mk>
99
100GLIBCXX_SRCDIR=	${DIST}/libstdc++-v3
101
102codecvt_members.cc: ${GLIBCXX_SRCDIR}/${G_CCODECVT_CC}
103	${_MKTARGET_CREATE}
104	rm -f ${.TARGET}
105	ln -s ${GLIBCXX_SRCDIR}/${G_CCODECVT_CC} ${.TARGET}
106
107collate_members.cc: ${GLIBCXX_SRCDIR}/${G_CCOLLATE_CC}
108	${_MKTARGET_CREATE}
109	rm -f ${.TARGET}
110	ln -s ${GLIBCXX_SRCDIR}/${G_CCOLLATE_CC} ${.TARGET}
111
112ctype_members.cc: ${GLIBCXX_SRCDIR}/${G_CCTYPE_CC}
113	${_MKTARGET_CREATE}
114	rm -f ${.TARGET}
115	ln -s ${GLIBCXX_SRCDIR}/${G_CCTYPE_CC} ${.TARGET}
116
117messages_members.cc: ${GLIBCXX_SRCDIR}/${G_CMESSAGES_CC}
118	${_MKTARGET_CREATE}
119	rm -f ${.TARGET}
120	ln -s ${GLIBCXX_SRCDIR}/${G_CMESSAGES_CC} ${.TARGET}
121
122monetary_members.cc: ${GLIBCXX_SRCDIR}/${G_CMONEY_CC}
123	${_MKTARGET_CREATE}
124	rm -f ${.TARGET}
125	ln -s ${GLIBCXX_SRCDIR}/${G_CMONEY_CC} ${.TARGET}
126
127numeric_members.cc: ${GLIBCXX_SRCDIR}/${G_CNUMERIC_CC}
128	${_MKTARGET_CREATE}
129	rm -f ${.TARGET}
130	ln -s ${GLIBCXX_SRCDIR}/${G_CNUMERIC_CC} ${.TARGET}
131
132time_members.cc: ${GLIBCXX_SRCDIR}/${G_CTIME_CC}
133	${_MKTARGET_CREATE}
134	rm -f ${.TARGET}
135	ln -s ${GLIBCXX_SRCDIR}/${G_CTIME_CC} ${.TARGET}
136
137atomicity.cc: ${G_atomicity_file}
138	${_MKTARGET_CREATE}
139	rm -f ${.TARGET}
140	ln -s ${G_atomicity_file} ${.TARGET}
141
142c++locale.cc: ${GLIBCXX_SRCDIR}/${G_CLOCALE_CC}
143	${_MKTARGET_CREATE}
144	rm -f ${.TARGET}
145	ln -s ${GLIBCXX_SRCDIR}/${G_CLOCALE_CC} ${.TARGET}
146
147basic_file.cc: ${GLIBCXX_SRCDIR}/${G_BASIC_FILE_CC}
148	${_MKTARGET_CREATE}
149	rm -f ${.TARGET}
150	ln -s ${GLIBCXX_SRCDIR}/${G_BASIC_FILE_CC} ${.TARGET}
151
152
153CLEANFILES+=	atomicity.cc basic_file.cc c++locale.cc codecvt_members.cc
154CLEANFILES+=	collate_members.cc ctype_members.cc messages_members.cc
155CLEANFILES+=	monetary_members.cc numeric_members.cc time_members.cc
156
157${SRCS}: unwind.h
158unwind.h: ${G_UNWIND_H}
159	${_MKTARGET_CREATE}
160	rm -f ${.TARGET}
161	ln -s ${G_UNWIND_H} ${.TARGET}
162CLEANFILES+= unwind.h
163
164.PATH:	${DIST}/libstdc++-v3/src \
165	${DIST}/libstdc++-v3/libsupc++ \
166	${DIST}/libiberty \
167	${CONF}/locale/generic \
168	${.CURDIR}/arch/${GCC_MACHINE_ARCH}
169
170${OBJS}: ${.CURDIR}/arch/${GCC_MACHINE_ARCH}/defs.mk
171.else
172.include <bsd.prog.mk> # do nothing
173.endif
174