xref: /freebsd-12.1/gnu/lib/csu/Makefile (revision 00a91cb7)
1# $FreeBSD$
2
3GCCDIR=	${.CURDIR}/../../../contrib/gcc
4CCDIR=	${.CURDIR}/../../usr.bin/cc
5.include "${CCDIR}/Makefile.tgt"
6
7.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR}
8
9SRCS=		crtstuff.c tconfig.h
10OBJS=		crtbegin.o crtend.o
11SOBJS=		crtbegin.So crtend.So
12CFLAGS+=	-DIN_GCC -DHAVE_LD_EH_FRAME_HDR
13CFLAGS+=	-finhibit-size-directive -fno-inline-functions \
14		-fno-exceptions -fno-omit-frame-pointer
15CFLAGS+=	-I${GCCDIR}/config -I${GCCDIR} -I. \
16		-I${CCDIR}/cc_tools
17CRTS_CFLAGS=	-DCRTSTUFFS_O -DSHARED ${PICFLAG}
18MKDEPCMD=	CC="${CC}" MKDEP_CPP_OPTS="-M -DCRT_BEGIN" mkdep
19
20.if ${TARGET_ARCH} == "ia64"
21BEGINSRC=	crtbegin.asm
22ENDSRC=		crtend.asm
23CFLAGS+=	-x assembler-with-cpp	# Ugly hack
24.undef SRCS				# hack for 'make depend'
25.endif
26.if ${TARGET_ARCH} == "powerpc"
27TGTOBJS=	crtsavres.o
28SRCS+=		crtsavres.asm
29.endif
30.if ${TARGET_ARCH} == "alpha" || ${TARGET_ARCH} == "sparc64"
31TGTOBJS=	crtfastmath.o
32SRCS+=		crtfastmath.c
33.endif
34BEGINSRC?=	crtstuff.c
35ENDSRC?=	crtstuff.c
36
37all: ${OBJS} ${SOBJS} ${TGTOBJS}
38${OBJS} ${SOBJS}: tconfig.h
39
40CLEANFILES=	${OBJS} ${SOBJS} ${TGTOBJS}
41
42crtbegin.o:	${BEGINSRC}
43	${CC} ${CFLAGS} -g0 -DCRT_BEGIN \
44		-c -o ${.TARGET} ${.ALLSRC:N*.h}
45
46crtbegin.So:	${BEGINSRC}
47	${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \
48		-c -o ${.TARGET} ${.ALLSRC:N*.h}
49
50crtend.o:	${ENDSRC}
51	${CC} ${CFLAGS} -g0 -DCRT_END \
52		-c -o ${.TARGET} ${.ALLSRC:N*.h}
53
54crtend.So:	${ENDSRC}
55	${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
56		-c -o ${.TARGET} ${.ALLSRC:N*.h}
57
58CLEANFILES+=	tconfig.h
59tconfig.h: ${CCDIR}/cc_tools/Makefile
60	${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}
61
62realinstall:
63.for file in ${OBJS} ${SOBJS} ${TGTOBJS}
64	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
65	    ${file} ${DESTDIR}${LIBDIR}/${file:S/.So$/S.o/}
66.endfor
67
68.include <bsd.lib.mk>
69