Makefile revision 175623
1# $FreeBSD: head/gnu/lib/csu/Makefile 175623 2008-01-24 07:43:09Z ru $
2
3GCCDIR=	${.CURDIR}/../../../contrib/gcc
4GCCLIB=	${.CURDIR}/../../../contrib/gcclibs
5CCDIR=	${.CURDIR}/../../usr.bin/cc
6.include "${CCDIR}/Makefile.tgt"
7
8.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}
9
10SRCS=		crtstuff.c tconfig.h tm.h options.h
11OBJS=		crtbegin.o crtend.o crtbeginT.o
12SOBJS=		crtbegin.So crtend.So
13CSTD?=		gnu89
14CFLAGS+=	-DIN_GCC -DHAVE_LD_EH_FRAME_HDR -DDT_CONFIG -D__GLIBC__=3
15CFLAGS+=	-finhibit-size-directive -fno-inline-functions \
16		-fno-exceptions -fno-zero-initialized-in-bss \
17		-fno-zero-initialized-in-bss -fno-toplevel-reorder
18CFLAGS+=	-I${GCCLIB}/include -I${GCCDIR}/config -I${GCCDIR} -I. \
19		-I${CCDIR}/cc_tools
20CRTS_CFLAGS=	-DCRTSTUFFS_O -DSHARED ${PICFLAG}
21MKDEP=		-DCRT_BEGIN
22
23.if ${MACHINE_ARCH} == "ia64"
24BEGINSRC=	crtbegin.asm
25ENDSRC=		crtend.asm
26CFLAGS+=	-x assembler-with-cpp	# Ugly hack
27CFLAGS+=	-include osreldate.h
28.undef SRCS				# hack for 'make depend'
29.endif
30.if ${MACHINE_ARCH} == "powerpc"
31TGTOBJS=	crtsavres.o
32SRCS+=		crtsavres.asm
33.endif
34.if ${MACHINE_ARCH} == "sparc64"
35TGTOBJS=	crtfastmath.o
36SRCS+=		crtfastmath.c
37.endif
38BEGINSRC?=	crtstuff.c
39ENDSRC?=	crtstuff.c
40
41all: ${OBJS} ${SOBJS} ${TGTOBJS}
42${OBJS} ${SOBJS}: ${SRCS:M*.h}
43
44CLEANFILES=	${OBJS} ${SOBJS} ${TGTOBJS}
45
46crtbegin.o:	${BEGINSRC}
47	${CC} ${CFLAGS} -g0 -DCRT_BEGIN \
48		-c -o ${.TARGET} ${.ALLSRC:N*.h}
49
50crtbeginT.o:	${BEGINSRC}
51	${CC} ${CFLAGS} -g0 -DCRT_BEGIN -DCRTSTUFFT_O \
52		-c -o ${.TARGET} ${.ALLSRC:N*.h}
53
54crtbegin.So:	${BEGINSRC}
55	${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \
56		-c -o ${.TARGET} ${.ALLSRC:N*.h}
57
58crtend.o:	${ENDSRC}
59	${CC} ${CFLAGS} -g0 -DCRT_END \
60		-c -o ${.TARGET} ${.ALLSRC:N*.h}
61
62crtend.So:	${ENDSRC}
63	${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
64		-c -o ${.TARGET} ${.ALLSRC:N*.h}
65
66CLEANFILES+=	tm.h tconfig.h options.h optionlist cs-tconfig.h cs-tm.h
67tm.h tconfig.h options.h: ${CCDIR}/cc_tools/Makefile
68	${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}
69
70realinstall:
71.for file in ${OBJS} ${SOBJS} ${TGTOBJS}
72	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
73	    ${file} ${DESTDIR}${LIBDIR}/${file:S/.So$/S.o/}
74.endfor
75
76.include <bsd.lib.mk>
77