Makefile.inc revision 1.34
11.34Schristos# $NetBSD: Makefile.inc,v 1.34 2018/12/27 18:57:15 christos Exp $ 21.1Sjoerg 31.1Sjoerg.include <bsd.own.mk> 41.1Sjoerg 51.19Suwe# XXX: FIXME: This is defined in bsd.lib.mk 61.19SuwePICFLAGS ?= -fPIC 71.19Suwe 81.3SdrochnerCOMMON_DIR:= ${.CURDIR}/common 91.1Sjoerg.PATH: ${COMMON_DIR} 101.1Sjoerg 111.33SjoergCPPFLAGS+= -I${COMMON_DIR} -I. 121.34SchristosCPPFLAGS+= -DHAVE_INITFINI_ARRAY 131.1Sjoerg 141.1SjoergOBJS+= crt0.o gcrt0.o crti.o crtn.o 151.13SjoergOBJS+= crtbegin.o crtend.o 161.28SmartinOBJS+= sysident.o 171.13Sjoerg 181.13Sjoerg.if ${MKPIC} == "yes" 191.13SjoergOBJS+= crtbeginS.o 201.15SmattCFLAGS.crtbegin.c+= -fPIE 211.13Sjoerg.endif 221.26Smrg 231.16Smatt.if ${MACHINE_ARCH} == "alpha" 241.16SmattOBJS+= crtfm.o 251.16Smatt.endif 261.1Sjoerg 271.23Smartin.if ${CSU_MACHINE_ARCH} == "sparc64" 281.21Smartin# create helper objects for the compiler to mark compiler memory models 291.21Smartin.for m in medlow medmid medany 301.21Smartinsparc_mc${m}.o: compident.S sysident_assym.h 311.21Smartin ${CC} ${ASFLAGS} -I. -DCONTENT=\"${m}\\0\\0\" -DCONTENTLENGTH=8 -c \ 321.21Smartin -o $@ ${COMMON_DIR}/compident.S 331.21Smartin.endfor 341.21SmartinOBJS += sparc_mcmedlow.o sparc_mcmedmid.o sparc_mcmedany.o 351.21Smartin.endif 361.21Smartin 371.1Sjoergrealall: ${OBJS} 381.1Sjoerg 391.10Smatt.if exists(${ARCHDIR}/crtbegin.S) 401.10Smattcrtbegin.o: crtbegin.S 411.8Smatt ${_MKTARGET_COMPILE} 421.10Smatt ${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o 431.8Smatt.else 441.10Smattcrtbegin.o: crtbegin.c crtbegin.h 451.1Sjoerg ${_MKTARGET_COMPILE} 461.15Smatt ${COMPILE.c} ${CFLAGS.crtbegin.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o 471.8Smatt.endif 481.24Smatt ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 491.1Sjoerg rm -f ${.TARGET}.o 501.1Sjoerg.if ${MKSTRIPIDENT} != "no" 511.1Sjoerg ${OBJCOPY} -R .ident ${.TARGET} 521.1Sjoerg.endif 531.1Sjoerg 541.10Smatt.if exists(${ARCHDIR}/crtbegin.S) 551.10SmattcrtbeginS.o: crtbegin.S 561.8Smatt ${_MKTARGET_COMPILE} 571.19Suwe ${COMPILE.S} ${PICFLAGS} -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o 581.8Smatt.else 591.10SmattcrtbeginS.o: crtbegin.c crtbegin.h 601.1Sjoerg ${_MKTARGET_COMPILE} 611.26Smrg ${COMPILE.c} ${CFLAGS.crtbeginS.c} ${PICFLAGS} -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o 621.8Smatt.endif 631.24Smatt ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 641.1Sjoerg rm -f ${.TARGET}.o 651.1Sjoerg.if ${MKSTRIPIDENT} != "no" 661.1Sjoerg ${OBJCOPY} -R .ident ${.TARGET} 671.1Sjoerg.endif 681.1Sjoerg 691.1Sjoergcrtend.o: crtend.S 701.1Sjoerg ${_MKTARGET_COMPILE} 711.2Sjoerg ${COMPILE.S} ${ARCHDIR}/crtend.S -o ${.TARGET}.o 721.24Smatt ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 731.1Sjoerg rm -f ${.TARGET}.o 741.1Sjoerg.if ${MKSTRIPIDENT} != "no" 751.1Sjoerg ${OBJCOPY} -R .ident ${.TARGET} 761.1Sjoerg.endif 771.1Sjoerg 781.1Sjoerg.if ${MKPIC} != "no" 791.18SjoergMY_PICFLAGS= ${PICFLAGS} 801.1Sjoerg.else 811.18SjoergMY_PICFLAGS= 821.1Sjoerg.endif 831.1Sjoerg 841.6Suwecrt0.o: crt0.S crt0-common.c 851.1Sjoerg ${_MKTARGET_COMPILE} 861.6Suwe ${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o 871.27Sskrll ${COMPILE.c} ${CFLAGS.crt0-common.c} ${MY_PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o 881.24Smatt ${LD} -r -o ${.TARGET}.o ${.TARGET}.S.o ${.TARGET}.c.o 891.24Smatt ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 901.24Smatt rm -f ${.TARGET}.S.o ${.TARGET}.c.o ${.TARGET}.o 911.1Sjoerg.if ${MKSTRIPIDENT} != "no" 921.1Sjoerg ${OBJCOPY} -R .ident ${.TARGET} 931.1Sjoerg.endif 941.1Sjoerg 951.6Suwegcrt0.o: crt0.S crt0-common.c 961.1Sjoerg ${_MKTARGET_COMPILE} 971.6Suwe ${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o 981.18Sjoerg ${COMPILE.c} ${MY_PICFLAGS} -DMCRT0 ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o 991.24Smatt ${LD} -r -o ${.TARGET}.o ${.TARGET}.S.o ${.TARGET}.c.o 1001.24Smatt ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 1011.24Smatt rm -f ${.TARGET}.S.o ${.TARGET}.c.o ${.TARGET}.o 1021.1Sjoerg.if ${MKSTRIPIDENT} != "no" 1031.1Sjoerg ${OBJCOPY} -R .ident ${.TARGET} 1041.1Sjoerg.endif 1051.1Sjoerg 1061.16Smatt.if ${MACHINE_ARCH} == "alpha" 1071.16Smatt# can't do this in Makefile.inc otherwise it will before realall: 1081.16Smattcrtfm.o: crtfm.c 1091.16Smatt ${_MKTARGET_COMPILE} 1101.16Smatt ${COMPILE.c} ${.ALLSRC} -o ${.TARGET}.o 1111.24Smatt ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 1121.16Smatt rm -f ${.TARGET}.o 1131.16Smatt.endif 1141.16Smatt 1151.17SmattGENASSYM_CONF= ${COMMON_DIR}/sysident_assym.cf 1161.20Sjoergsysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} ${NETBSDSRCDIR}/sys/sys/param.h 1171.1Sjoerg ${_MKTARGET_CREATE} 1181.1Sjoerg cat ${COMMON_DIR}/sysident_assym.cf | \ 1191.7Sjoerg ${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \ 1201.25Sjoerg ${GENASSYM_CPPFLAGS} > sysident_assym.h.tmp && \ 1211.1Sjoerg mv -f sysident_assym.h.tmp sysident_assym.h 1221.1Sjoerg 1231.1SjoergCLEANFILES+= sysident_assym.h 1241.1Sjoerg 1251.17Smattcrti.o: crti.S sysident_assym.h sysident.S 1261.1Sjoergcrtn.o: crtn.S 1271.28Smartinsysident.o: sysident.S sysident_assym.h 1281.1Sjoerg 1291.1SjoergFILES=${OBJS} 1301.1SjoergFILESDIR=${LIBDIR} 1311.1SjoergCLEANFILES+=${OBJS} 1321.13Sjoerg 1331.13Sjoerg.if ${MKPIC} == "yes" 1341.1SjoergSYMLINKS+= crtbegin.o ${LIBDIR}/crtbeginT.o 1351.1SjoergSYMLINKS+= crtend.o ${LIBDIR}/crtendS.o 1361.13Sjoerg.endif 1371.1Sjoerg 1381.1Sjoerg.include <bsd.prog.mk> 139