aboutsummaryrefslogtreecommitdiff
path: root/devel/i386-rtems-gcc/Makefile
blob: 4c7c9ee7dcc428e136d040125722f0e8a789dee8 (plain) (blame)
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
# New ports collection makefile for:	i386-rtems-gcc
# Date created:		9 June 2000
# Whom:			James Housley <jim@thehousleys.net>
#
# $FreeBSD$
#

PORTNAME=	gcc
PORTVERSION=	3.2.3
PORTREVISION=	3
CATEGORIES=	devel
MASTER_SITES=	${MASTER_SITE_SOURCEWARE} \
		${MASTER_SITE_GNU:S/$/:gcc/}
MASTER_SITE_SUBDIR=	newlib \
			${PORTNAME}/${GCCNAME}/:gcc
DISTFILES=		${NEWLIBNAME}.tar.gz \
			${GCCNAME}.tar.gz:gcc
PATCHFILES=	${GCCNAME}-rtems-20030507a.diff \
		${NEWLIBNAME}-rtems-20030605.diff
PATCH_SITES=	ftp://ftp.rtems.com/pub/rtems/snapshots/c_tools/source/ \
		http://rtems.thehousleys.net/

MAINTAINER=	jeh@FreeBSD.org
COMMENT=	FSF C/C++/JAVA-gcc-3.2.3 base-port for RTEMS development

.include <bsd.port.pre.mk>

RTEMS_ARCH?=	i386
LCLTARGET=	${RTEMS_ARCH}-rtems

GCCVERSION=	3.2.3
GCCNAME=	gcc-${GCCVERSION}
PLIST_SUB+=	"GCCVERSION=${GCCVERSION}"
NEWLIBNAME=	newlib-1.11.0
PLIST=		${PKGDIR}/pkg-plist.${LCLTARGET}

# autoheader is used by the port but autoconf is not, setting USE_AUTOCONF
# will break the port.  Since USE_AUTOHEADER sets USE_AUTOCONF, this is
# likely to break the port also.
BUILD_DEPENDS=	autoheader:${PORTSDIR}/devel/autoconf \
		${LCLTARGET}-as:${PORTSDIR}/devel/${LCLTARGET}-binutils \
		${LCLTARGET}-ld:${PORTSDIR}/devel/${LCLTARGET}-binutils
RUN_DEPENDS=	${LCLTARGET}-as:${PORTSDIR}/devel/${LCLTARGET}-binutils \
		${LCLTARGET}-ld:${PORTSDIR}/devel/${LCLTARGET}-binutils
LIB_DEPENDS=	intl.5:${PORTSDIR}/devel/gettext-old

PKGNAMEPREFIX=	${LCLTARGET}-
USE_GMAKE=	yes
GNU_CONFIGURE=	yes
USE_REINPLACE=	yes
ALL_TARGET=	all info

CONFIGURE_TARGET?=	--target=${LCLTARGET}
CONFIGURE_ARGS?=	--with-gnu-as --with-gnu-ld --with-newlib --verbose \
			--enable-languages="c,c++,java" \
			--with-libiconv-prefix=${LOCALBASE} \
			--without-included-gettext
CONFIGURE_WRKSRC?=	${WRKDIR}/build-${LCLTARGET}
CONFIGURE_SCRIPT?=	../${GCCNAME}/configure

PATCH_WRKSRC=		${WRKDIR}
PATCH_STRIP=		-p

NO_CPU_FLAGS=	true
MAKE_FLAGS=	LANGUAGES="c c++ java"
MAKE_ENV=	MACHINE_ARCH=${RTEMS_ARCH} NO_CPU_CFLAGS=true
# Since once mk/bsd.cpu.mk adds the _CPUCFLAGS they can't be removed
# by NO_CPU_FLAGS, and since they are added long before here we are
# stuck with this hack.
CFLAGS:=	${CFLAGS:C/-mcpu=[^ ]*//:C/-march=[^ ]*//:C/-mtune=[^ ]*//}
CXXFLAGS:=	${CXXFLAGS:C/-mcpu=[^ ]*//:C/-march=[^ ]*//:C/-mtune=[^ ]*//}

MAN1=		${LCLTARGET}-gcc.1 ${LCLTARGET}-g++.1 ${LCLTARGET}-gcj.1 \
		cpp.1 gcov.1 gcjh.1 jv-scan.1 jcf-dump.1 gij.1 \
		jv-convert.1 rmic.1 rmiregistry.1
MAN7=		fsf-funding.7 gfdl.7 gpl.7
INFO=		${LCLTARGET}-cpp ${LCLTARGET}-cppinternals \
		${LCLTARGET}-gcc ${LCLTARGET}-gccint ${LCLTARGET}-gcj

pre-configure:
	@(cd ${WRKDIR} ; \
	cd ${GCCNAME} ; ${LN} -fs ../${NEWLIBNAME}/newlib . ; \
	cd .. ; \
	${MKDIR} build-${LCLTARGET})
	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
		${WRKSRC}/gcc/configure

post-patch:
# Change cpp.info to ${LCLTARGET}-cpp.info
	@${REINPLACE_CMD} -e 's|setfilename cpp.info|setfilename ${LCLTARGET}-cpp.info|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|(cpp)|(${LCLTARGET}-cpp)|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|@file{cpp}|@file{${LCLTARGET}-cpp}|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|cpp.info|${LCLTARGET}-cpp.info|g' ${WRKSRC}/gcc/Makefile.in
	@${REINPLACE_CMD} -e 's|cpp.texi|${LCLTARGET}-cpp.texi|g' ${WRKSRC}/gcc/Makefile.in
	@${MV} ${WRKSRC}/gcc/doc/cpp.texi ${WRKSRC}/gcc/doc/${LCLTARGET}-cpp.texi
# special case for included file
	@${REINPLACE_CMD} -e 's|,cpp.info,|,${LCLTARGET}-cpp.info,|g' ${WRKSRC}/gcc/doc/extend.texi
# Change cpp.info to ${LCLTARGET}-cpp.info
	@${REINPLACE_CMD} -e 's|setfilename cppinternals.info|setfilename ${LCLTARGET}-cppinternals.info|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|(cppinternals)|(${LCLTARGET}-cppinternals)|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|@file{cppinternals}|@file{${LCLTARGET}-cppinternals}|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|cppinternals.info|${LCLTARGET}-cppinternals.info|g' ${WRKSRC}/gcc/Makefile.in
	@${REINPLACE_CMD} -e 's|cppinternals.texi|${LCLTARGET}-cppinternals.texi|g' ${WRKSRC}/gcc/Makefile.in
	@${MV} ${WRKSRC}/gcc/doc/cppinternals.texi ${WRKSRC}/gcc/doc/${LCLTARGET}-cppinternals.texi
# Change cpp.info to ${LCLTARGET}-cpp.info
	@${REINPLACE_CMD} -e 's|setfilename gcc.info|setfilename ${LCLTARGET}-gcc.info|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|(gcc)|(${LCLTARGET}-gcc)|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|@file{gcc}|@file{${LCLTARGET}-gcc}|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|gcc.info|${LCLTARGET}-gcc.info|g' ${WRKSRC}/gcc/Makefile.in
	@${REINPLACE_CMD} -e 's|gcc.texi|${LCLTARGET}-gcc.texi|g' ${WRKSRC}/gcc/Makefile.in
	@${MV} ${WRKSRC}/gcc/doc/gcc.texi ${WRKSRC}/gcc/doc/${LCLTARGET}-gcc.texi
# Change cpp.info to ${LCLTARGET}-cpp.info
	@${REINPLACE_CMD} -e 's|setfilename gccint.info|setfilename ${LCLTARGET}-gccint.info|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|(gccint)|(${LCLTARGET}-gccint)|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|@file{gccint}|@file{${LCLTARGET}-gccint}|g' ${WRKSRC}/gcc/doc/*.texi
	@${REINPLACE_CMD} -e 's|gccint.info|${LCLTARGET}-gccint.info|g' ${WRKSRC}/gcc/Makefile.in
	@${REINPLACE_CMD} -e 's|gccint.texi|${LCLTARGET}-gccint.texi|g' ${WRKSRC}/gcc/Makefile.in
	@${MV} ${WRKSRC}/gcc/doc/gccint.texi ${WRKSRC}/gcc/doc/${LCLTARGET}-gccint.texi
# Change gcj.info to ${LCLTARGET}-gcj.info
	@${REINPLACE_CMD} -e 's|setfilename gcj.info|setfilename ${LCLTARGET}-gcj.info|g' ${WRKSRC}/gcc/java/*.texi
	@${REINPLACE_CMD} -e 's|(gcj)|(${LCLTARGET}-gcj)|g' ${WRKSRC}/gcc/java/*.texi
	@${REINPLACE_CMD} -e 's|@file{gcj}|@file{${LCLTARGET}-gcj}|g' ${WRKSRC}/gcc/java/*.texi
	@${REINPLACE_CMD} -e 's|gcj.info|${LCLTARGET}-gcj.info|g' ${WRKSRC}/gcc/java/Make-lang.in
	@${REINPLACE_CMD} -e 's|gcj.texi|${LCLTARGET}-gcj.texi|g' ${WRKSRC}/gcc/java/Make-lang.in
	@${MV} ${WRKSRC}/gcc/java/gcj.texi ${WRKSRC}/gcc/java/${LCLTARGET}-gcj.texi

do-build:
	@(cd ${WRKDIR}/build-${LCLTARGET} ; \
	${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})

do-install:
	@(cd ${WRKDIR}/build-${LCLTARGET} && \
	${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})

.include <bsd.port.post.mk>