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