Makefile.amd64 revision 1.67
11.67Smrg#	$NetBSD: Makefile.amd64,v 1.67 2018/04/07 19:38:06 mrg Exp $
21.1Sfvdl
31.1Sfvdl# Makefile for NetBSD
41.1Sfvdl#
51.1Sfvdl# This makefile is constructed from a machine description:
61.1Sfvdl#	config machineid
71.1Sfvdl# Most changes should be made in the machine description
81.1Sfvdl#	/sys/arch/amd64/conf/``machineid''
91.1Sfvdl# after which you should do
101.1Sfvdl#	config machineid
111.1Sfvdl# Machine generic makefile changes should be made in
121.1Sfvdl#	/sys/arch/amd64/conf/Makefile.amd64
131.1Sfvdl# after which config should be rerun for all machines of that type.
141.1Sfvdl#
151.1Sfvdl# To specify debugging, add the config line: makeoptions DEBUG="-g"
161.1Sfvdl# A better way is to specify -g only for a few files.
171.1Sfvdl#
181.1Sfvdl#	makeoptions DEBUGLIST="uvm* trap if_*"
191.1Sfvdl
201.1SfvdlMACHINE_ARCH=x86_64
211.1SfvdlUSETOOLS?=	no
221.1SfvdlNEED_OWN_INSTALL_TARGET?=no
231.1Sfvdl.include <bsd.own.mk>
241.1Sfvdl
251.29StronUSE_SSP?=	yes
261.29Stron
271.1Sfvdl##
281.1Sfvdl## (1) port identification
291.1Sfvdl##
301.1SfvdlAMD64=		$S/arch/amd64
311.6SchristosGENASSYM_CONF=	${AMD64}/amd64/genassym.cf
321.1Sfvdl
331.1Sfvdl##
341.1Sfvdl## (2) compile settings
351.1Sfvdl##
361.45SjakllschDEFCOPTS=	-O2 -fno-omit-frame-pointer
371.1SfvdlCPPFLAGS+=	-Damd64 -Dx86_64
381.66SmaxvCFLAGS+=	-mcmodel=kernel
391.44Sdsl# -mno-sse implies -mno-sse2 (etc), explicitly disable avx to be extra sure
401.43SdslCFLAGS+=	-mno-red-zone -mno-mmx -mno-sse -mno-avx
411.43Sdsl# make absolutely sure we don't get x87 registers used as well
421.44SdslCFLAGS+=	-msoft-float
431.44Sdsl# For gcc we might need this, but other compilers barf
441.44Sdsl# CFLAGS+=	-mno-fp-ret-in-387
451.1Sfvdl
461.67Smrg.if !empty(SPECTRE_V2_GCC_MITIGATION) && ${HAVE_GCC:U0} > 0
471.67SmrgCFLAGS+=      -mindirect-branch=thunk-inline
481.67SmrgCFLAGS+=      -mindirect-branch-register
491.67Smrg.endif
501.67Smrg
511.1Sfvdl##
521.1Sfvdl## (3) libkern and compat
531.1Sfvdl##
541.41SchristosOPT_MODULAR=	%MODULAR%
551.41Schristos.if !empty(OPT_MODULAR)
561.1SfvdlKERN_AS=	obj
571.41Schristos.else
581.41SchristosKERN_AS=	library
591.41Schristos.endif
601.1Sfvdl
611.1Sfvdl##
621.1Sfvdl## (4) local objects, compile rules, and dependencies
631.1Sfvdl##
641.1Sfvdl
651.1Sfvdl##
661.1Sfvdl## (5) link settings
671.1Sfvdl##
681.56SmaxvTEXTADDR?=	0xffffffff80200000
691.59Smaxv.if defined(KASLR)
701.64SmaxvEXTRA_LINKFLAGS=	--split-by-file=0x100000 -r -d
711.61SmaxvKERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
721.59Smaxv.else
731.57SmaxvEXTRA_LINKFLAGS=	-z max-page-size=0x200000
741.61SmaxvKERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript
751.59Smaxv.endif
761.1SfvdlLINKFLAGS_NORMAL=	-X
771.1Sfvdl
781.1Sfvdl##
791.1Sfvdl## (6) port specific target dependencies
801.1Sfvdl##
811.1Sfvdl
821.1Sfvdl# depend on CPU configuration
831.1Sfvdllocore.o machdep.o: Makefile
841.1Sfvdl
851.25Sjoergacpi_wakeup_low.o amd64func.o busfunc.o cpufunc.o cpu_in_cksum.o: assym.h
861.60Smaxvlinux_sigcode.o linux32_sigcode.o lock_stubs.o mptramp.o: assym.h
871.25Sjoergnetbsd32_sigcode.o: assym.h
881.1Sfvdl
891.1Sfvdl##
901.1Sfvdl## (7) misc settings
911.1Sfvdl##
921.1Sfvdl
931.1Sfvdl##
941.1Sfvdl## (8) config(8) generated machinery
951.1Sfvdl##
961.1Sfvdl%INCLUDES
971.1Sfvdl
981.1Sfvdl%OBJS
991.1Sfvdl
1001.1Sfvdl%CFILES
1011.1Sfvdl
1021.1Sfvdl%SFILES
1031.1Sfvdl
1041.1Sfvdl%LOAD
1051.1Sfvdl
1061.1Sfvdl%RULES
1071.26Salc
1081.1Sfvdl##
1091.1Sfvdl## (9) port independent kernel machinery
1101.1Sfvdl##
1111.1Sfvdl.include "$S/conf/Makefile.kern.inc"
1121.5Sthorpej
1131.39Schristos## Include rules for ACPI wakecode
1141.39Schristos.include "$S/arch/x86/acpi/Makefile.wakecode.inc"
1151.39Schristos
1161.5Sthorpej##
1171.5Sthorpej## (10) Appending make options.
1181.5Sthorpej##
1191.5Sthorpej%MAKEOPTIONSAPPEND
120