1# $FreeBSD$ 2 3.PATH: ${.CURDIR:H}/common 4 5SRCS= crt1.c crti.S crtn.S 6OBJS= ${SRCS:N*.h:R:S/$/.o/g} 7OBJS+= Scrt1.o gcrt1.o 8CFLAGS+= -I${.CURDIR:H}/common \ 9 -I${SRCTOP}/lib/libc/include \ 10 -mlongcall 11 12# XXX: See the log for r232932 as to why the above -mlongcall is needed. Since 13# clang doesn't support -mlongcall, and testing shows a clang linked with a 14# clang-built csu segfaults, this must currently be compiled with gcc. Once 15# clang supports -mlongcall, or we get a fixed ld, this can be revisited. 16.include <bsd.compiler.mk> 17.if ${COMPILER_TYPE} != "gcc" 18CC:= gcc 19COMPILER_TYPE:= gcc 20.endif 21 22FILES= ${OBJS} 23FILESMODE= ${LIBMODE} 24FILESOWN= ${LIBOWN} 25FILESGRP= ${LIBGRP} 26FILESDIR= ${LIBDIR} 27# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. 28.undef LIBRARIES_ONLY 29 30CLEANFILES= ${OBJS} 31CLEANFILES+= crt1.s gcrt1.s Scrt1.s 32 33# See the comment in lib/csu/common/crtbrand.c for the reason crt1.c is not 34# directly compiled to .o files. 35 36crt1.s: crt1.c 37 ${CC} ${CFLAGS} -S -o ${.TARGET} ${.CURDIR}/crt1.c 38 sed ${SED_FIX_NOTE} ${.TARGET} 39 40crt1.o: crt1.s 41 ${CC} ${ACFLAGS} -c -o ${.TARGET} crt1.s 42 43gcrt1.s: crt1.c 44 ${CC} ${CFLAGS} -DGCRT -S -o ${.TARGET} ${.CURDIR}/crt1.c 45 sed ${SED_FIX_NOTE} ${.TARGET} 46 47gcrt1.o: gcrt1.s 48 ${CC} ${ACFLAGS} -c -o ${.TARGET} gcrt1.s 49 50Scrt1.s: crt1.c 51 ${CC} ${CFLAGS} -fPIC -DPIC -S -o ${.TARGET} ${.CURDIR}/crt1.c 52 sed ${SED_FIX_NOTE} ${.TARGET} 53 54Scrt1.o: Scrt1.s 55 ${CC} ${ACFLAGS} -c -o ${.TARGET} Scrt1.s 56 57.include <bsd.lib.mk> 58