summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gcc/Makefile.bsd-wrapper
blob: dd38007234bcb741c4bdb587bf2a54fe86f31eca (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#	$OpenBSD: Makefile.bsd-wrapper,v 1.65 2017/06/12 18:49:34 espie Exp $

MAN=		gcc.1 cpp.1 gcov.1 protoize.1

BINDIR=/usr/bin
.if defined(BOOTSTRAP)
LANGUAGES=--enable-languages=c
.else
LANGUAGES=--enable-languages='c,c++,objc' 
.endif
V=3.3.6

.SUFFIXES:	.1
.PATH.1:	${.CURDIR}/gcc ${.CURDIR}/gcc/doc

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

MAKE_FLAGS= 	CFLAGS="${GNUCFLAGS}" \
		CC="${CC}" LDFLAGS="${LDSTATIC}" \
		DEMANGLER_PROG= \
		DEMANGLE_H= \
		LIBIBERTY_INCLUDES=${LIBIBERTY_INCLUDES} \
		LIBGCC2_INCLUDES=-I${LIBIBERTY_INCLUDES} \
		BUILD_LIBIBERTY=-liberty \
		LIBIBERTY=-liberty \
		HOST_LIBDEPS= \
		LIBDEPS= \
		build_infodir=.

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/objc-parse.c objc/objc-parse.y target_path \
		print-rtl1.c gengtype-lex.c gengtype-yacc.c gengtype-yacc.h \
		genrtl.c genrtl.h fixinc.sh fixinc/Makefile \
		po/Makefile  po/Makefile.in  po/POTFILES

GCCARCH=	${MACHINE_ARCH}-unknown-openbsd${OSREV}
GCCINC=	/usr/lib/gcc-lib/${GCCARCH}/$V/include

# cross-compilation
.if defined(CROSS_HOST) && defined(TARGET_ARCH) && defined(CROSSDIR)
CONFIGTARGET=	--build=${CROSS_HOST}-unknown-openbsd${OSREV} \
    --target=${TARGET_ARCH}-unknown-openbsd${OSREV}

CONFIGPREFIX=	${CROSSDIR}/usr
PATH=		/bin:/usr/bin:/sbin:/usr/sbin:${CROSSDIR}/usr/bin
GXX_INCDIR=	${CROSSDIR}/usr/include/g++
GNUCFLAGS=	${CFLAGS} ${COPTS} -DOPENBSD_CROSS -I${LIBIBERTY_INCLUDES}
HOSTCFLAGS=	${CFLAGS} ${COPTS} -DOPENBSD_CROSS -I${LIBIBERTY_INCLUDES}
HOST_CC=cc
MAKE_FLAGS+= 	CFLAGS_FOR_BUILD="${HOSTCFLAGS}" HOST_CC=cc
.elif defined(TARGET_ARCH) && defined(CROSSDIR)
CONFIGTARGET=	--target=${TARGET_ARCH}-unknown-openbsd${OSREV}
CONFIGPREFIX=	${CROSSDIR}/usr
MAKE_FLAGS+=	GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include"
PATH=		/bin:/usr/bin:/sbin:/usr/sbin:${CROSSDIR}/usr/bin
GXX_INCDIR=	${CROSSDIR}/usr/include/g++
GNUCFLAGS=	${CFLAGS} ${COPTS} -DOPENBSD_CROSS -I${LIBIBERTY_INCLUDES}
.else
CONFIGTARGET=
CONFIGPREFIX=	/usr
PATH=		/bin:/usr/bin:/sbin:/usr/sbin
.endif

all:	config.status
	exec env PATH="${PATH}" ${MAKE} ${MAKE_FLAGS} all doc proto

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: gcc/Makefile.in gcc/configure gcc/c-parse.in
	PATH="${PATH}" \
	INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
	CPPFLAGS=-I${LIBIBERTY_INCLUDES} \
	MAKEINFO='makeinfo --no-split' \
	/bin/sh ${.CURDIR}/gcc/configure --with-gnu-as --with-gnu-ld \
		--prefix=${CONFIGPREFIX} --mandir='$$(prefix)/share/man' \
		--with-local-prefix=/usr ${CF} \
		${LANGUAGES} --enable-cpp --disable-nls \
		--with-gxx-include-dir=${GXX_INCDIR} \
		--enable-__cxa_atexit \
		--enable-threads=posix \
		${CONFIGTARGET} ${GCCARCH} && touch config.status

.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=/usr \
		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
		GXX_TARGET_INSTALL_NAME=${.OBJDIR}/dummy1 \
		CXX_TARGET_INSTALL_NAME=${.OBJDIR}/dummy2 \
		infodir=/usr/share/info \
		tooldir=/tmp assertdir=/tmp \
		bindir=$(BINDIR) \
		install-common install-multilib \
		install-info intl.install \
		lang.install-normal
	chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/lib/gcc-lib
	chmod -R a+rX ${DESTDIR}/usr/lib/gcc-lib
	mkdir -p ${DESTDIR}/usr/libexec ${DESTDIR}/usr/bin
#	if [ -e ${DESTDIR}/usr/lib/libf2c.a ]; then \
#		chown ${BINOWN}:${BINGRP} ${DESTDIR}/usr/lib/libf2c.a; \
#		chmod 444 ${DESTDIR}/usr/lib/libf2c.a; \
#	fi
	if [ -e ${DESTDIR}/usr/include/f2c.h ]; then \
		chown ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include/f2c.h; \
		chmod 444 ${DESTDIR}/usr/include/f2c.h; \
	fi
	${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

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

depend: config.status
	exec ${MAKE} ${MAKE_FLAGS} generated-manpages

FILES= ${.CURDIR}/gcc/unwind.h
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
FILES+=${.CURDIR}/gcc/config/i386/mmintrin.h \
	${.CURDIR}/gcc/config/i386/xmmintrin.h \
	${.CURDIR}/gcc/config/i386/emmintrin.h \
	${.CURDIR}/gcc/config/i386/pmmintrin.h
.elif ${MACHINE_ARCH} == "powerpc"
FILES+=${.CURDIR}/gcc/config/rs6000/altivec.h
.endif

includes:
	mkdir -p ${DESTDIR}${GCCINC}
	for i in ${FILES}; do \
		j=`basename $$i`; \
		cmp -s $$i ${DESTDIR}${GCCINC}/$$j || \
		    ${INSTALL} ${INSTALL_COPY} -m 444 $$i ${DESTDIR}${GCCINC}/$$j; \
		ln -sf ${GCCINC}/$$j ${DESTDIR}/usr/include/$$j; \
	done

tags:
	# Nothing here so far...

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