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