1# $MirOS: src/lib/csu/common_elf/Makefile.inc,v 1.15 2009/08/30 17:54:32 tg Exp $ 2# $NetBSD: Makefile.inc,v 1.23 2003/03/19 16:54:25 ross Exp $ 3 4.include "${.CURDIR}/../Makefile.inc" 5 6.if !defined(ELFSIZE) || empty(ELFSIZE) 7ELFSIZE= 32 8.endif 9 10.if ${DEBUGLIBS:L} == "yes" 11_DISCARD= -X 12_SODISCARD= -X 13.else 14_DISCARD= -x 15_SODISCARD= -g -x 16.endif 17 18COPTS+= -fno-stack-protector-all -fno-stack-protector \ 19 -fno-omit-frame-pointer -fno-unit-at-a-time -Werror 20CPPFLAGS+= -idirafter ${.CURDIR}/../common_elf 21CPPFLAGS+= -DELFSIZE=${ELFSIZE} 22 23.PATH: ${.CURDIR}/../common_elf 24 25SRCS+= crt0.c crti.c crtn.c 26# if profiling 27#SRCS+= gcrt0.c 28 29.ifndef HAVE_VERSION_SPECIFIC_GCC_LIBS 30# These are now provided by GCC 3 31.else 32CPPFLAGS+= -DHAVE_VERSION_SPECIFIC_GCC_LIBS 33SRCS+= crtbegin.c crtbeginT.c crtend.c 34. if !defined(NOPIC) || ${NOPIC:L} == "no" 35SRCS+= crtbeginS.c crtendS.c 36. endif 37CPPFLAGS+= -DDWARF2_EH -DDSO_HANDLE # -DJCR 38.endif 39 40COPYFILES+= crt0.c gcrt0.c 41COPYFILES+= crtbegin.c crtbeginT.c 42COPYFILES+= crtbegin.c crtbeginS.c 43COPYFILES+= crtend.c crtendS.c 44.for _s _d in ${COPYFILES} 45CLEANFILES+= ${_d} 46beforedepend: ${_d} 47${_d}: ${_s} 48 cp -f ${.ALLSRC} $@ 49.endfor 50 51CLEANFILES+= sun_crt1.o sun_crtn.o sun_crti.o 52sunstuff: sun_crt1.o sun_crtn.o sun_crti.o 53 54sun_crt1.o: ${DESTDIR}/usr/lib/crt0.o ${DESTDIR}/usr/lib/crtbegin.o 55 ${LD} -r -o $@ ${.ALLSRC} 56 57sun_crtn.o: ${DESTDIR}/usr/lib/crtend.o ${DESTDIR}/usr/lib/crtn.o 58 ${LD} -r -o $@ ${.ALLSRC} 59 60sun_crti.o: ${DESTDIR}/usr/lib/crti.o 61 ${LD} -r -o $@ ${.ALLSRC} 62 63crt0.o: crt0.c 64 ${COMPILE.c} -DCRT0 -fPIE -o $@.o ${.IMPSRC} 65 ${LD} ${_DISCARD} -r -o $@ $@.o 66 @rm -f $@.o 67 68gcrt0.o: crt0.c 69 ${COMPILE.c} -DMCRT0 -fPIE -o $@.o ${.IMPSRC} 70 ${LD} ${_DISCARD} -r -o $@ $@.o 71 @rm -f $@.o 72 73crti.o: crti.c 74 ${COMPILE.c} -g0 -fPIE -o $@.o ${.IMPSRC} 75 ${LD} ${_DISCARD} -r -o $@ $@.o 76 @rm -f $@.o 77 78crtn.o: crtn.c 79 ${COMPILE.c} -fPIE -o $@.o ${.IMPSRC} 80 ${LD} ${_DISCARD} -r -o $@ $@.o 81 @rm -f $@.o 82 83crtbegin.o: crtbegin.c 84 ${COMPILE.c} -fPIE -o $@.o ${.IMPSRC} 85 ${LD} ${_DISCARD} -r -o $@ $@.o 86 @rm -f $@.o 87 88crtbeginS.o: crtbegin.c 89 ${COMPILE.c} -DSHARED -DPIC ${PICFLAG} -o $@.o ${.IMPSRC} 90 ${LD} ${_DISCARD} -r -o $@ $@.o 91 @rm -f $@.o 92 93crtbeginT.o: crtbegin.c 94 ${COMPILE.c} -o $@.o ${.IMPSRC} 95 ${LD} ${_DISCARD} -r -o $@ $@.o 96 @rm -f $@.o 97 98crtend.o: crtend.c 99 ${COMPILE.c} -fPIE -o $@.o ${.IMPSRC} 100 ${LD} ${_DISCARD} -r -o $@ $@.o 101 @rm -f $@.o 102 103crtendS.o: crtend.c 104 ${COMPILE.c} -DSHARED -DPIC ${PICFLAG} -o $@.o ${.IMPSRC} 105 ${LD} ${_DISCARD} -r -o $@ $@.o 106 @rm -f $@.o 107 108realinstall: 109 ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ 110 -m ${NONBINMODE} ${OBJS} ${DESTDIR}/usr/lib/ 111 112.PHONY: sunstuff 113 114OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g} 115all: ${OBJS} 116 117.include <bsd.prog.mk> 118