xref: /freebsd-12.1/gnu/lib/csu/Makefile (revision dfd1ff19)
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 tm.h
10OBJS=		crtbegin.o crtend.o
11SOBJS=		crtbegin.So crtend.So
12CSTD?=		gnu89
13CFLAGS+=	-DIN_GCC -DHAVE_LD_EH_FRAME_HDR
14CFLAGS+=	-finhibit-size-directive -fno-inline-functions \
15		-fno-exceptions -fno-zero-initialized-in-bss \
16		-fno-omit-frame-pointer -fno-unit-at-a-time
17CFLAGS+=	-I${GCCDIR}/config -I${GCCDIR} -I. \
18		-I${CCDIR}/cc_tools
19CRTS_CFLAGS=	-DCRTSTUFFS_O -DSHARED ${PICFLAG}
20MKDEP=		-DCRT_BEGIN
21
22.if ${MACHINE_ARCH} == "ia64"
23BEGINSRC=	crtbegin.asm
24ENDSRC=		crtend.asm
25CFLAGS+=	-x assembler-with-cpp	# Ugly hack
26CFLAGS+=	-include osreldate.h
27.undef SRCS				# hack for 'make depend'
28.endif
29.if ${MACHINE_ARCH} == "powerpc"
30TGTOBJS=	crtsavres.o
31SRCS+=		crtsavres.asm
32.endif
33.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
34TGTOBJS=	crtfastmath.o
35SRCS+=		crtfastmath.c
36.endif
37BEGINSRC?=	crtstuff.c
38ENDSRC?=	crtstuff.c
39
40all: ${OBJS} ${SOBJS} ${TGTOBJS}
41${OBJS} ${SOBJS}: ${SRCS:M*.h}
42
43CLEANFILES=	${OBJS} ${SOBJS} ${TGTOBJS}
44
45crtbegin.o:	${BEGINSRC}
46	${CC} ${CFLAGS} -g0 -DCRT_BEGIN \
47		-c -o ${.TARGET} ${.ALLSRC:N*.h}
48
49crtbegin.So:	${BEGINSRC}
50	${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \
51		-c -o ${.TARGET} ${.ALLSRC:N*.h}
52
53crtend.o:	${ENDSRC}
54	${CC} ${CFLAGS} -g0 -DCRT_END \
55		-c -o ${.TARGET} ${.ALLSRC:N*.h}
56
57crtend.So:	${ENDSRC}
58	${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \
59		-c -o ${.TARGET} ${.ALLSRC:N*.h}
60
61CLEANFILES+=	tm.h tconfig.h
62tm.h tconfig.h: ${CCDIR}/cc_tools/Makefile
63	${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}
64
65realinstall:
66.for file in ${OBJS} ${SOBJS} ${TGTOBJS}
67	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
68	    ${file} ${DESTDIR}${LIBDIR}/${file:S/.So$/S.o/}
69.endfor
70
71.include <bsd.lib.mk>
72