1#	$NetBSD: Makefile,v 1.5 2011/07/01 05:07:59 mrg Exp $
2
3REQUIRETOOLS=	yes
4NOLINT=		# defined
5
6UNSUPPORTED_COMPILER.clang=	# defined
7
8.include <bsd.own.mk>
9
10LIB=		objc
11
12.if ${MKGCC} != "no"
13
14SHLIB_MAJOR=	3
15SHLIB_MINOR=	0
16
17# XXX just while all platforms defs.mk are updated..
18.if exists(${.CURDIR}/arch/${MACHINE_ARCH}/defs.mk)
19# Machine-dependent definitions (include file names).
20.include "${.CURDIR}/arch/${MACHINE_ARCH}/defs.mk"
21EXTRA_FAKEHEADERS=
22.else
23# Machine-independent definitions (include file names).
24.include "${.CURDIR}/defs.mk"
25EXTRA_FAKEHEADERS=
26.endif
27
28LIBGCCOBJ!=    cd ${.CURDIR}/../libgcc/libgcc && ${PRINTOBJDIR}
29
30DIST=		${NETBSDSRCDIR}/external/gpl3/gcc/dist
31GNUHOSTDIST=	${NETBSDSRCDIR}/external/gpl3/gcc/dist
32GCCARCH=	${NETBSDSRCDIR}/external/gpl3/gcc/usr.bin/gcc/arch/${MACHINE_ARCH}
33LIBOBJCARCH=	${NETBSDSRCDIR}/external/gpl3/gcc/lib/libobjc/arch/${MACHINE_ARCH}
34GCCLIBXX=	${NETBSDSRCDIR}/external/gpl3/gcc/lib/libstdc++-v3/arch/${MACHINE_ARCH}
35
36SRCS=		${G_OBJS:N[A-Z]*:Nlinking.lo:.lo=.c} ${G_OBJS:M[A-Z]*:.lo=.m} linking.m
37
38GCPPFLAGS=	${G_ALL_CFLAGS} ${G_INCLUDES}
39CPPFLAGS+=	-I. -I${.CURDIR}/arch/${MACHINE_ARCH}
40CPPFLAGS+=	-I${GCCARCH} ${GCPPFLAGS:M-D*} ${GCPPFLAGS:M-I*:N-I.*}
41CPPFLAGS+=	-I${GCCLIBXX}
42
43BUILDSYMLINKS=	${.CURDIR}/../libstdc++-v3/arch/${MACHINE_ARCH} bits
44DPSRCS+=	bits
45
46.for f in Protocol.m Object.m NXConstStr.m linking.m
47OBJCOPTS.${f}=	-fgnu-runtime
48.endfor
49
50.for f in thr.c thr-objc.c
51COPTS.${f}=	-Wno-missing-noreturn
52.endfor
53
54COPTS+=		-fno-strict-aliasing -fexceptions
55OBJCOPTS+=	-fno-strict-aliasing -fexceptions
56
57OBJCOPTS.Object.m = -Wno-stack-protector
58COPTS.sendmsg.c = -Wno-stack-protector
59
60INCS=		${G_OBJC_H}
61INCSDIR=	/usr/include/objc
62
63DPSRCS+=	runtime-info.h
64CLEANFILES+=	rtscratch rtscratch.s runtime-info.h
65runtime-info.h:
66	${_MKTARGET_CREATE}
67	touch rtscratch
68	`${OBJC} --print-prog-name=cc1obj` -print-objc-runtime-info rtscratch >$@
69
70.PATH: ${DIST}/libobjc ${DIST}/libobjc/objc
71
72${OBJS} ${POBJS} ${SOBJS}: runtime-info.h
73
74${SRCS}: tconfig.h unwind.h options.h
75
76BUILDSYMLINKS+=	${G_UNWIND_H} unwind.h
77DPSRCS+=	unwind.h
78
79.include "../Makefile.tconfigh"
80.include "../Makefile.hacks"
81
82# XXX just while all platforms defs.mk are updated..
83.if exists(${.CURDIR}/arch/${MACHINE_ARCH}/defs.mk)
84optionlist: ${G_ALL_OPT_FILES} ${LIBOBJCARCH}/defs.mk Makefile ${DIST}/gcc/opt-gather.awk
85	${TOOL_AWK} -f ${DIST}/gcc/opt-gather.awk ${G_ALL_OPT_FILES} \
86		> ${.TARGET}
87
88options.h: optionlist ${DIST}/gcc/opt-functions.awk ${DIST}/gcc/opth-gen.awk
89	${TOOL_AWK} -f ${DIST}/gcc/opt-functions.awk \
90		-f ${DIST}/gcc/opth-gen.awk \
91		< optionlist > ${.TARGET}
92
93CLEANFILES+=	options.h optionlist
94.endif
95
96.include <bsd.lib.mk>
97
98.else
99.include <bsd.prog.mk>	# do nothing
100.endif
101
102COPTS.archive.c+=	-Wno-error
103COPTS.sendmsg.c+=	-Wno-error
104