1#	$OpenBSD: Makefile.bsd-wrapper,v 1.33 1998/03/06 21:38:01 niklas Exp $
2
3MAN=		cccp.1 gcc.1 cp/g++.1 f/g77.1
4MLINKS+=	gcc.1 cc.1
5MLINKS+=	cccp.1 cpp.1
6MLINKS+=	g++.1 c++.1
7
8GPP_INC_DIR=	/usr/include/g++
9GNUCFLAGS=	CFLAGS="${CFLAGS} ${COPTS} -DOPENBSD_NATIVE"
10CLEANFILES=	.gdbinit cp/.gdbinit *.info* bi-parser.c bi-parser.h \
11		c-parse.c c-parse.h c-parse.y cexp.c cp/parse.c cp/parse.h \
12		objc-parse.c objc-parse.y f/.gdbinit f/*.info*
13CXX_HEADERS=	${.CURDIR}/cp/inc/typeinfo ${.CURDIR}/cp/inc/exception \
14		${.CURDIR}/cp/inc/new ${.CURDIR}/cp/inc/new.h
15
16.if ${MACHINE} == "arc" || ${MACHINE} == "pmax" || ${MACHINE} == "wgrisc"
17M_ARCH=		mipsel
18.elif ${MACHINE} == "hkmips" || ${MACHINE} == "sgi"
19M_ARCH=		mips
20.else
21M_ARCH=		${MACHINE_ARCH}
22.endif
23
24GCCARCH=	${M_ARCH}-unknown-openbsd`uname -r`
25
26all:	config.status
27	${MAKE} ${GNUCFLAGS} BISON=yacc CC=${CC} LDFLAGS=${LDSTATIC} \
28		build_infodir=. all doc
29
30
31.FORCE:	.IGNORE
32
33.include <bsd.own.mk>
34
35.ifdef GLOBAL_AUTOCONF_CACHE
36CF=	--cache-file=${GLOBAL_AUTOCONF_CACHE}
37.else
38CF=
39.endif
40
41config: .FORCE
42.ifndef GLOBAL_AUTOCONF_CACHE
43	-rm -f config.cache
44.endif
45	INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
46	/bin/sh ${.CURDIR}/configure --with-gnu-as --with-gnu-ld \
47		--prefix=/usr --with-local-prefix=/usr ${CF} \
48		--with-gxx-include-dir=${GPP_INC_DIR} ${GCCARCH}
49
50config.status: Makefile.in configure c-parse.in
51	INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
52	/bin/sh ${.CURDIR}/configure --with-gnu-as --with-gnu-ld \
53		--prefix=/usr --with-local-prefix=/usr ${CF} \
54		--with-gxx-include-dir=${GPP_INC_DIR} ${GCCARCH} && touch config.status
55
56includes:
57	@-for i in ${CXX_HEADERS}; do \
58		j=`basename $$i` \
59		cmp -s $$i ${DESTDIR}/${GPP_INC_DIR}/$$j || \
60		    ${INSTALL} ${INSTALL_COPY} -m 444 $$i \
61		    ${DESTDIR}/${GPP_INC_DIR}; \
62	done
63
64.ifdef NOMAN
65maninstall:
66	@echo NOMAN is set
67.endif
68
69install:	maninstall
70	${MAKE} ${GNUCFLAGS} prefix=${DESTDIR}/usr \
71		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
72		infodir=${DESTDIR}/usr/share/info \
73		build_infodir=. \
74		tooldir=/tmp assertdir=/tmp INSTALL_DRIVER=install-driver \
75		INSTALL_MAN= NO_TARGET_GCC=true bindir=${DESTDIR}/usr/bin \
76		install
77	ln -f ${DESTDIR}/usr/bin/gcc ${DESTDIR}/usr/bin/cc
78	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/lib/gcc-lib
79	chmod -R a+rX ${DESTDIR}/usr/lib/gcc-lib
80	if [ -e ${DESTDIR}/usr/lib/libf2c.a ]; then \
81		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/lib/libf2c.a; \
82		chmod 444 ${DESTDIR}/usr/lib/libf2c.a; \
83	fi
84	if [ -e ${DESTDIR}/usr/include/f2c.h ]; then \
85		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/f2c.h; \
86		chmod 444 ${DESTDIR}/usr/include/f2c.h; \
87	fi
88	__target=`sed -n '/^target=/s/target=//p' Makefile`; \
89	__version=`sed -n '/^version=/s/version=//p' Makefile`; \
90	ln -fs /usr/lib/gcc-lib/$$__target/$$__version/cpp \
91		${DESTDIR}/usr/libexec
92
93clean cleandir:
94	rm -f ${CLEANFILES}
95	-@if [ -e Makefile ]; then ${MAKE} distclean; fi
96
97depend:
98	# Nothing here so far...
99
100lint:
101	# Nothing here so far...
102
103tags:
104	# Nothing here so far...
105
106.include <bsd.obj.mk>
107.include <bsd.subdir.mk>
108.ifndef NOMAN
109.include <bsd.man.mk>
110.endif
111