1 # SPDX-License-Identifier: GPL-2.0-only !! 1 # $Id: Makefile,v 1.69 2001/11/19 04:09:53 davem Exp $ 2 # !! 2 # Makefile for the linux kernel. 3 # Makefile for the RISC-V Linux kernel << 4 # 3 # 5 4 6 ifdef CONFIG_FTRACE !! 5 SH = $(CONFIG_SHELL) 7 CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) << 8 CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE) << 9 CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) << 10 CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_F << 11 endif << 12 CFLAGS_syscall_table.o += $(call cc-option,-W << 13 CFLAGS_compat_syscall_table.o += $(call cc-opt << 14 6 15 ifdef CONFIG_KEXEC_CORE !! 7 USE_STANDARD_AS_RULE := true 16 AFLAGS_kexec_relocate.o := -mcmodel=medany $(c !! 8 EXTRA_AFLAGS := -ansi 17 endif << 18 9 19 # cmodel=medany and notrace when patching earl !! 10 all: kernel.o head.o init_task.o 20 ifdef CONFIG_RISCV_ALTERNATIVE_EARLY << 21 CFLAGS_alternative.o := -mcmodel=medany << 22 CFLAGS_cpufeature.o := -mcmodel=medany << 23 CFLAGS_sbi_ecall.o := -mcmodel=medany << 24 ifdef CONFIG_FTRACE << 25 CFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRAC << 26 CFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE << 27 CFLAGS_REMOVE_sbi_ecall.o = $(CC_FLAGS_FTRACE) << 28 endif << 29 ifdef CONFIG_RELOCATABLE << 30 CFLAGS_alternative.o += -fno-pie << 31 CFLAGS_cpufeature.o += -fno-pie << 32 CFLAGS_sbi_ecall.o += -fno-pie << 33 endif << 34 ifdef CONFIG_KASAN << 35 KASAN_SANITIZE_alternative.o := n << 36 KASAN_SANITIZE_cpufeature.o := n << 37 KASAN_SANITIZE_sbi_ecall.o := n << 38 endif << 39 ifdef CONFIG_FORTIFY_SOURCE << 40 CFLAGS_alternative.o += -D__NO_FORTIFY << 41 CFLAGS_cpufeature.o += -D__NO_FORTIFY << 42 CFLAGS_sbi_ecall.o += -D__NO_FORTIFY << 43 endif << 44 endif << 45 11 46 extra-y += vmlinux.lds !! 12 O_TARGET := kernel.o 47 13 48 obj-y += head.o !! 14 export-objs := sparc64_ksyms.o 49 obj-y += soc.o !! 15 obj-y := process.o setup.o cpu.o idprom.o \ 50 obj-$(CONFIG_RISCV_ALTERNATIVE) += alternative !! 16 traps.o devices.o auxio.o \ 51 obj-y += cpu.o !! 17 irq.o ptrace.o time.o sys_sparc.o signal.o \ 52 obj-y += cpufeature.o !! 18 unaligned.o central.o pci.o starfire.o semaphore.o \ 53 obj-y += entry.o !! 19 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o 54 obj-y += irq.o !! 20 55 obj-y += process.o !! 21 obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ 56 obj-y += ptrace.o !! 22 pci_psycho.o pci_sabre.o pci_schizo.o 57 obj-y += reset.o !! 23 obj-$(CONFIG_SMP) += smp.o trampoline.o 58 obj-y += return_address.o !! 24 obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o ioctl32.o 59 obj-y += setup.o !! 25 obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o 60 obj-y += signal.o !! 26 obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o 61 obj-y += syscall_table.o !! 27 62 obj-y += sys_riscv.o !! 28 ifdef CONFIG_SUNOS_EMUL 63 obj-y += sys_hwprobe.o !! 29 obj-y += sys_sunos32.o sunos_ioctl32.o 64 obj-y += time.o !! 30 else 65 obj-y += traps.o !! 31 ifdef CONFIG_SOLARIS_EMUL 66 obj-y += riscv_ksyms.o !! 32 obj-y += sys_sunos32.o sunos_ioctl32.o 67 obj-y += stacktrace.o !! 33 endif 68 obj-y += cacheinfo.o !! 34 endif 69 obj-y += patch.o !! 35 70 obj-y += vendor_extensions.o !! 36 head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \ 71 obj-y += vendor_extensions/ !! 37 etrap.S rtrap.S winfixup.S entry.S 72 obj-y += probes/ !! 38 $(CC) $(AFLAGS) -ansi -c $*.S -o $*.o 73 obj-y += tests/ !! 39 74 obj-$(CONFIG_MMU) += vdso.o vdso/ !! 40 # 75 !! 41 # This is just to get the dependencies... 76 obj-$(CONFIG_RISCV_MISALIGNED) += traps_misal !! 42 # 77 obj-$(CONFIG_RISCV_MISALIGNED) += unaligned_a !! 43 binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c 78 obj-$(CONFIG_RISCV_PROBE_UNALIGNED_ACCESS) !! 44 79 !! 45 ifneq ($(NEW_GCC),y) 80 obj-$(CONFIG_FPU) += fpu.o !! 46 CMODEL_CFLAG := -mmedlow 81 obj-$(CONFIG_FPU) += kernel_mode !! 47 else 82 obj-$(CONFIG_RISCV_ISA_V) += vector.o !! 48 CMODEL_CFLAG := -m64 -mcmodel=medlow 83 obj-$(CONFIG_RISCV_ISA_V) += kernel_mode !! 49 endif 84 obj-$(CONFIG_SMP) += smpboot.o !! 50 85 obj-$(CONFIG_SMP) += smp.o !! 51 check_asm: dummy 86 obj-$(CONFIG_SMP) += cpu_ops.o !! 52 @if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \ 87 !! 53 touch $(HPATH)/asm/asm_offsets.h ; \ 88 obj-$(CONFIG_RISCV_BOOT_SPINWAIT) += cpu_ops_s !! 54 fi 89 obj-$(CONFIG_MODULES) += module.o !! 55 @echo "/* Automatically generated. Do not edit. */" > asm_offsets.h 90 obj-$(CONFIG_MODULE_SECTIONS) += module-sect !! 56 @echo "#ifndef __ASM_OFFSETS_H__" >> asm_offsets.h 91 !! 57 @echo "#define __ASM_OFFSETS_H__" >> asm_offsets.h 92 obj-$(CONFIG_CPU_PM) += suspend_ent !! 58 @echo >> asm_offsets.h 93 obj-$(CONFIG_HIBERNATION) += hibernate.o !! 59 @echo "#include <linux/config.h>" >> asm_offsets.h 94 !! 60 @echo >> asm_offsets.h 95 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ft !! 61 @echo "#include <linux/config.h>" > tmp.c 96 obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn. !! 62 @echo "#include <linux/sched.h>" >> tmp.c 97 !! 63 $(CPP) $(CPPFLAGS) -P tmp.c -o tmp.i 98 obj-$(CONFIG_PERF_EVENTS) += perf_callch !! 64 @echo "/* Automatically generated. Do not edit. */" > check_asm_data.c 99 obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o !! 65 @echo "#include <linux/config.h>" >> check_asm_data.c 100 obj-$(CONFIG_RISCV_SBI) += sbi.o sbi_e !! 66 @echo "#include <linux/sched.h>" >> check_asm_data.c 101 ifeq ($(CONFIG_RISCV_SBI), y) !! 67 @echo 'unsigned int check_asm_data[] = {' >> check_asm_data.c 102 obj-$(CONFIG_SMP) += sbi-ipi.o !! 68 $(SH) ./check_asm.sh -data task tmp.i check_asm_data.c 103 obj-$(CONFIG_SMP) += cpu_ops_sbi.o !! 69 $(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c 104 endif !! 70 $(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c 105 obj-$(CONFIG_HOTPLUG_CPU) += cpu-hotplug !! 71 @echo '};' >> check_asm_data.c 106 obj-$(CONFIG_PARAVIRT) += paravirt.o !! 72 $(CC) $(CPPFLAGS) $(CMODEL_CFLAG) -ffixed-g4 -S -o check_asm_data.s check_asm_data.c 107 obj-$(CONFIG_KGDB) += kgdb.o !! 73 @echo "/* Automatically generated. Do not edit. */" > check_asm.c 108 obj-$(CONFIG_KEXEC_CORE) += kexec_reloc !! 74 @echo 'extern int printf(const char *fmt, ...);' >>check_asm.c 109 obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o !! 75 @echo 'unsigned int check_asm_data[] = {' >> check_asm.c 110 obj-$(CONFIG_CRASH_DUMP) += crash_dump. !! 76 $(SH) ./check_asm.sh -ints check_asm_data.s check_asm.c 111 obj-$(CONFIG_VMCORE_INFO) += vmcore_info !! 77 @echo '};' >> check_asm.c 112 !! 78 @echo 'int main(void) {' >> check_asm.c 113 obj-$(CONFIG_JUMP_LABEL) += jump_label. !! 79 @echo 'int i = 0;' >> check_asm.c 114 !! 80 $(SH) ./check_asm.sh -printf task tmp.i check_asm.c 115 obj-$(CONFIG_CFI_CLANG) += cfi.o !! 81 $(SH) ./check_asm.sh -printf mm tmp.i check_asm.c 116 !! 82 $(SH) ./check_asm.sh -printf thread tmp.i check_asm.c 117 obj-$(CONFIG_EFI) += efi.o !! 83 @echo 'return 0; }' >> check_asm.c 118 obj-$(CONFIG_COMPAT) += compat_sysc !! 84 @rm -f tmp.[ci] check_asm_data.[cs] 119 obj-$(CONFIG_COMPAT) += compat_sign !! 85 $(HOSTCC) -o check_asm check_asm.c 120 obj-$(CONFIG_COMPAT) += compat_vdso !! 86 ./check_asm >> asm_offsets.h 121 !! 87 @rm -f check_asm check_asm.c 122 obj-$(CONFIG_64BIT) += pi/ !! 88 @echo >> asm_offsets.h 123 obj-$(CONFIG_ACPI) += acpi.o !! 89 @echo "#endif /* __ASM_OFFSETS_H__ */" >> asm_offsets.h 124 obj-$(CONFIG_ACPI_NUMA) += acpi_numa.o !! 90 @if test -r $(HPATH)/asm/asm_offsets.h; then \ >> 91 if cmp -s asm_offsets.h $(HPATH)/asm/asm_offsets.h; then \ >> 92 echo $(HPATH)/asm/asm_offsets.h is unchanged; \ >> 93 rm -f asm_offsets.h; \ >> 94 else \ >> 95 mv -f asm_offsets.h $(HPATH)/asm/asm_offsets.h; \ >> 96 fi; \ >> 97 else \ >> 98 mv -f asm_offsets.h $(HPATH)/asm/asm_offsets.h; \ >> 99 fi >> 100 >> 101 include $(TOPDIR)/Rules.make
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.