Makefile revision 97314
167811Sobrien# $FreeBSD: head/gnu/lib/csu/Makefile 97314 2002-05-26 17:09:31Z obrien $
267811Sobrien
396340SobrienGCCDIR=	${.CURDIR}/../../../contrib/gcc
496340SobrienCCDIR=	${.CURDIR}/../../usr.bin/cc
596340Sobrien.include "${CCDIR}/Makefile.tgt"
696340Sobrien
796796Speter.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}
896796Speter
996340SobrienSRCS=		crtstuff.c tconfig.h
1067811SobrienOBJS=		crtbegin.o crtend.o
1167811SobrienSOBJS=		crtbegin.So crtend.So
1296340SobrienCFLAGS+=	-DIN_GCC -DHAVE_LD_EH_FRAME_HDR
1396340SobrienCFLAGS+=	-finhibit-size-directive -fno-inline-functions \
1467811Sobrien		-fno-exceptions -fno-omit-frame-pointer
1596340SobrienCFLAGS+=	-I${GCCDIR}/config -I${GCCDIR} -I. \
1696340Sobrien		-I${CCDIR}/cc_tools
1796796SpeterCRTS_CFLAGS=	-DCRTSTUFFS_O -DSHARED ${PICFLAG}
1896553SobrienMKDEPCMD=	CC="${CC}" MKDEP_CPP_OPTS="-M -DCRT_BEGIN" mkdep
1967811Sobrien
2096796Speter.if ${TARGET_ARCH} == "ia64"
2196796SpeterBEGINSRC=	crtbegin.asm
2296796SpeterENDSRC=		crtend.asm
2396796SpeterCFLAGS+=	-x assembler-with-cpp	# Ugly hack
2496796Speter.undef SRCS				# hack for 'make depend'
2596796Speter.endif
2696778Sobrien.if ${TARGET_ARCH} == "powerpc"
2796778SobrienTGTOBJS=	crtsavres.o
2896778SobrienSRCS+=		crtsavres.asm
2996778Sobrien.endif
3096340Sobrien.if ${TARGET_ARCH} == "sparc64"
3196340SobrienTGTOBJS=	crtfastmath.o
3296340SobrienSRCS+=		crtfastmath.c
3396340Sobrien.endif
3496796SpeterBEGINSRC?=	crtstuff.c
3596796SpeterENDSRC?=	crtstuff.c
3667811Sobrien
3796340Sobrienall: ${OBJS} ${SOBJS} ${TGTOBJS}
3897314Sobrien${OBJS} ${SOBJS}: tconfig.h
3996340Sobrien
4096530SruCLEANFILES=	${OBJS} ${SOBJS} ${TGTOBJS}
4196530Sru
4296796Spetercrtbegin.o:	${BEGINSRC}
4367811Sobrien	${CC} ${CFLAGS} -g0 -DCRT_BEGIN \
4497314Sobrien		-c -o ${.TARGET} ${.ALLSRC:N*.h}
4567811Sobrien
4696796Spetercrtbegin.So:	${BEGINSRC}
4767811Sobrien	${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \
4897314Sobrien		-c -o ${.TARGET} ${.ALLSRC:N*.h}
4967811Sobrien
5096796Spetercrtend.o:	${ENDSRC}
5167811Sobrien	${CC} ${CFLAGS} -g0 -DCRT_END \
5297314Sobrien		-c -o ${.TARGET} ${.ALLSRC:N*.h}
5367811Sobrien
5496796Spetercrtend.So:	${ENDSRC}
5567811Sobrien	${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
5697314Sobrien		-c -o ${.TARGET} ${.ALLSRC:N*.h}
5767811Sobrien
5896530SruCLEANFILES+=	tconfig.h
5996340Sobrientconfig.h: ${CCDIR}/cc_tools/Makefile
6096340Sobrien	${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}
6167811Sobrien
6267811Sobrienrealinstall:
6396340Sobrien.for file in ${OBJS} ${SOBJS} ${TGTOBJS}
6467811Sobrien	${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
6567811Sobrien	    ${file} ${DESTDIR}${LIBDIR}/${file:S/.So$/S.o/}
6667811Sobrien.endfor
6767811Sobrien
6867811Sobrien.include <bsd.lib.mk>
69