1# $FreeBSD$ 2 3.MAIN: all 4 5.include <src.opts.mk> 6MK_SSP= no 7 8GCCDIR= ${.CURDIR}/../../../contrib/gcc 9GCCLIB= ${.CURDIR}/../../../contrib/gcclibs 10CCDIR= ${.CURDIR}/../../usr.bin/cc 11.include "${CCDIR}/Makefile.tgt" 12 13.PATH: ${GCCDIR}/config/${GCC_CPU} ${GCCDIR} 14 15SRCS= crtstuff.c tconfig.h tm.h options.h 16OBJS= crtbegin.o crtend.o crtbeginT.o 17SOBJS= crtbeginS.o crtendS.o 18CSTD?= gnu89 19CFLAGS+= -DIN_GCC -DHAVE_LD_EH_FRAME_HDR -DDT_CONFIG -D__GLIBC__=3 20CFLAGS.gcc+= -finhibit-size-directive -fno-toplevel-reorder 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" 30CFLAGS+= -DTARGET_ARM_EABI 31.endif 32 33.if ${MACHINE_CPUARCH} == "powerpc" 34TGTOBJS= crtsavres.o 35SRCS+= crtsavres.asm 36.endif 37.if ${MACHINE_CPUARCH} == "sparc64" 38TGTOBJS= crtfastmath.o 39SRCS+= crtfastmath.c 40.endif 41BEGINSRC?= crtstuff.c 42ENDSRC?= crtstuff.c 43 44all: ${OBJS} ${SOBJS} ${TGTOBJS} 45${OBJS} ${SOBJS}: ${SRCS:M*.h} 46 47CLEANFILES= ${OBJS} ${SOBJS} ${TGTOBJS} 48 49crtbegin.o: ${BEGINSRC} 50 ${CC} ${CFLAGS} -g0 -DCRT_BEGIN \ 51 -c -o ${.TARGET} ${.ALLSRC:N*.h} 52 53crtbeginT.o: ${BEGINSRC} 54 ${CC} ${CFLAGS} -g0 -DCRT_BEGIN -DCRTSTUFFT_O \ 55 -c -o ${.TARGET} ${.ALLSRC:N*.h} 56 57crtbeginS.o: ${BEGINSRC} 58 ${CC} ${CFLAGS} -g0 -DCRT_BEGIN ${CRTS_CFLAGS} \ 59 -c -o ${.TARGET} ${.ALLSRC:N*.h} 60 61crtend.o: ${ENDSRC} 62 ${CC} ${CFLAGS} -g0 -DCRT_END \ 63 -c -o ${.TARGET} ${.ALLSRC:N*.h} 64 65crtendS.o: ${ENDSRC} 66 ${CC} ${CFLAGS} -g0 -DCRT_END ${CRTS_CFLAGS} \ 67 -c -o ${.TARGET} ${.ALLSRC:N*.h} 68 69CLEANFILES+= tm.h tconfig.h options.h optionlist cs-tconfig.h cs-tm.h 70tm.h tconfig.h options.h: ${CCDIR}/cc_tools/Makefile 71 (cd ${.CURDIR}; ${MAKE} -f ${.ALLSRC} MFILE=${.ALLSRC} GCCDIR=${GCCDIR} ${.TARGET}) 72 73realinstall: 74.for file in ${OBJS} ${SOBJS} ${TGTOBJS} 75 ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 76 ${file} ${DESTDIR}${LIBDIR}/${file} 77.endfor 78 79.if ${MK_STAGING} == "yes" 80STAGE_DIR= ${STAGE_LIBDIR} 81STAGE_FILES= ${OBJS} ${SOBJS} ${TGTOBJS} 82staging: stage_files 83.endif 84 85.include <bsd.lib.mk> 86