summaryrefslogtreecommitdiff
path: root/gnu/egcs/gcc/Makefile.bsd-wrapper
blob: 93acc73d76c89f6f525f2efca16fa6f296e0f76b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#	$OpenBSD: Makefile.bsd-wrapper,v 1.23 2010/05/25 00:24:58 espie Exp $

MAN=		cpp.1 gcc.1 protoize.1 gcov.1
MLINKS+=	gcc.1 cc.1
MLINKS+=	protoize.1 unprotoize.1

.if defined(BOOTSTRAP)
LANGUAGES=--enable-languages=c
.else
LANGUAGES=--enable-languages='c,c++,objc' 
MAN+=		cp/g++.1
MLINKS+=	g++.1 c++.1
BEFOREMAN=	config.status
.endif

FAKE_FILES=	/usr/share/info/cppinternals.info \
		/usr/share/info/gccint.info

LIBIBERTY_INCLUDES=${.CURDIR}/../../lib/libiberty/include
GNUCFLAGS=	${CFLAGS} ${COPTS} -DOPENBSD_NATIVE \
		-I${LIBIBERTY_INCLUDES}

VAXHOST_CFLAGS=	-DIN_GCC -DOPENBSD_NATIVE -DHAVE_CONFIG_H -O0
MAKE_FLAGS= 	CFLAGS="${GNUCFLAGS}" \
		CC="${CC}" LDFLAGS="${LDSTATIC}" \
		DEMANGLER_PROG= \
		DEMANGLE_H= \
		LIBIBERTY_INCLUDES=${LIBIBERTY_INCLUDES} \
		build_infodir=. \
		MAKEINFO='makeinfo --no-split'

.if ${MACHINE_ARCH} == "vax"
MAKE_FLAGS+=	HOST_CFLAGS="${VAXHOST_CFLAGS} -I${LIBIBERTY_INCLUDES}"
.endif

GXX_INCDIR=	/usr/include/g++
CLEANFILES=	.gdbinit */.gdbinit *.info* \
		c-parse.c c-parse.h c-parse.y cexp.c cp/parse.c cp/parse.h \
		f/*.info* objc-parse.c objc-parse.y target_path \
		genrtl.c genrtl.h fixinc.sh fixinc/Makefile \
		po/Makefile  po/Makefile.in  po/POTFILES

CXX_HEADERS=	${.CURDIR}/cp/inc/typeinfo ${.CURDIR}/cp/inc/exception \
		${.CURDIR}/cp/inc/new ${.CURDIR}/cp/inc/new.h

.if ${MACHINE} == "arc" || ${MACHINE} == "pmax" || ${MACHINE} == "wgrisc"
M_ARCH=		mipsel
.elif ${MACHINE} == "hkmips" || ${MACHINE} == "sgi"
M_ARCH=		mips
.else
M_ARCH=		${MACHINE_ARCH}
.endif


GCCARCH=	${M_ARCH}-unknown-openbsd${OSREV}

all:	config.status
	exec ${MAKE} ${MAKE_FLAGS} all doc

tconfig.h:	config.status
	exec ${MAKE} ${MAKE_FLAGS} tconfig.h

tree-check.h: config.status
	exec ${MAKE} ${MAKE_FLAGS} $@


.FORCE:	.IGNORE

.include <bsd.own.mk>

.ifdef GLOBAL_AUTOCONF_CACHE
CF=	--cache-file=${GLOBAL_AUTOCONF_CACHE}
.else
CF=
.endif

config.status: Makefile.in configure c-parse.in
	PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
	INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
	MAKEINFO='makeinfo --no-split' \
	/bin/sh ${.CURDIR}/configure --with-gnu-as --with-gnu-ld \
		--prefix=/usr --mandir='$$(prefix)/share/man' \
		--with-local-prefix=/usr ${CF} \
		${LANGUAGES} --enable-cpp --disable-nls \
		--with-gxx-include-dir=${GXX_INCDIR} ${GCCARCH} && touch config.status

includes:
	@-for i in ${CXX_HEADERS}; do \
		j=`basename $$i` \
		cmp -s $$i ${DESTDIR}/${GXX_INCDIR}/$$j || \
		    ${INSTALL} ${INSTALL_COPY} -m 444 $$i \
		    ${DESTDIR}/${GXX_INCDIR}; \
	done

.ifdef NOMAN
maninstall:
	@echo NOMAN is set
.endif

# XXX INSTALL_TARGET should be install-normal, more or less
# the only reason is not so is because our man handling is special
# (pre-formatted) and also because of cpp, that we install by hand
# elsewhere, until we get rid of that old `compatibility' script.

target_path: config.status
	__target=`sed -n '/^target=/s/target=//p' Makefile`; \
	__version=`sed -n '/^gcc_version=/s/gcc_version=//p' Makefile`; \
	echo /usr/lib/gcc-lib/$$__target/$$__version >target_path

install:	maninstall target_path
	${MAKE} ${MAKE_FLAGS} \
		prefix=${DESTDIR}/usr \
		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
		infodir=${DESTDIR}/usr/share/info \
		tooldir=/tmp assertdir=/tmp \
		INSTALL_TARGET='install-common $$(INSTALL_HEADERS) \
		     $$(INSTALL_LIBGCC) install-info \
		     intl.install lang.install-normal' \
		NO_TARGET_GCC=true bindir=${DESTDIR}/usr/bin \
		install
	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/lib/gcc-lib
	chmod -R a+rX ${DESTDIR}/usr/lib/gcc-lib
	${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -m 755 cpp \
	   ${DESTDIR}/usr/libexec/cpp
	${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -m 755 xgcc \
	   ${DESTDIR}/usr/bin/gcc
	ln -f ${DESTDIR}/usr/bin/gcc ${DESTDIR}/usr/bin/cc
	for i in ${FAKE_FILES}; do \
	    touch ${DESTDIR}$$i; \
	done

clean cleandir: 
	-@if [ -e Makefile ]; then ${MAKE} distclean; fi
	-rm -f ${CLEANFILES}

depend:
	ln -sf ${.CURDIR}/cccp.1 ${.OBJDIR}/cpp.1

lint:
	# Nothing here so far...

tags:
	# Nothing here so far...

.include <bsd.obj.mk>
.include <bsd.subdir.mk>
.ifndef NOMAN
.include <bsd.man.mk>
.endif