Thomas Gleixner | ec8f24b | 2019-05-19 13:07:45 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0-only |
Masahiro Yamada | b61442d | 2021-04-16 22:00:51 +0900 | [diff] [blame] | 2 | include ../../../build/Build.include |
Paolo Bonzini | c2390f1 | 2019-04-11 15:51:19 +0200 | [diff] [blame] | 3 | |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 4 | all: |
| 5 | |
Andrew Jones | cc68765 | 2018-09-18 19:54:26 +0200 | [diff] [blame] | 6 | top_srcdir = ../../../.. |
Shuah Khan | 211929f | 2018-12-12 20:25:14 -0700 | [diff] [blame] | 7 | KSFT_KHDR_INSTALL := 1 |
Shuah Khan | 66d69e0 | 2020-04-27 18:11:07 -0600 | [diff] [blame] | 8 | |
| 9 | # For cross-builds to work, UNAME_M has to map to ARCH and arch specific |
| 10 | # directories and targets in this Makefile. "uname -m" doesn't map to |
| 11 | # arch specific sub-directory names. |
| 12 | # |
| 13 | # UNAME_M variable to used to run the compiles pointing to the right arch |
| 14 | # directories and build the right targets for these supported architectures. |
| 15 | # |
| 16 | # TEST_GEN_PROGS and LIBKVM are set using UNAME_M variable. |
| 17 | # LINUX_TOOL_ARCH_INCLUDE is set using ARCH variable. |
| 18 | # |
| 19 | # x86_64 targets are named to include x86_64 as a suffix and directories |
| 20 | # for includes are in x86_64 sub-directory. s390x and aarch64 follow the |
| 21 | # same convention. "uname -m" doesn't result in the correct mapping for |
| 22 | # s390x and aarch64. |
| 23 | # |
| 24 | # No change necessary for x86_64 |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 25 | UNAME_M := $(shell uname -m) |
| 26 | |
Shuah Khan | 66d69e0 | 2020-04-27 18:11:07 -0600 | [diff] [blame] | 27 | # Set UNAME_M for arm64 compile/install to work |
| 28 | ifeq ($(ARCH),arm64) |
| 29 | UNAME_M := aarch64 |
| 30 | endif |
| 31 | # Set UNAME_M s390x compile/install to work |
| 32 | ifeq ($(ARCH),s390) |
| 33 | UNAME_M := s390x |
| 34 | endif |
Anup Patel | 3e06cdf | 2021-10-05 18:09:56 +0530 | [diff] [blame] | 35 | # Set UNAME_M riscv compile/install to work |
| 36 | ifeq ($(ARCH),riscv) |
| 37 | UNAME_M := riscv |
| 38 | endif |
Shuah Khan | 66d69e0 | 2020-04-27 18:11:07 -0600 | [diff] [blame] | 39 | |
Maciej S. Szmigiero | 22721a5 | 2021-04-13 16:08:27 +0200 | [diff] [blame] | 40 | LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/rbtree.c lib/sparsebit.c lib/test_util.c lib/guest_modes.c lib/perf_test_util.c |
Jim Mattson | 4c63c92 | 2021-06-04 10:26:08 -0700 | [diff] [blame] | 41 | LIBKVM_x86_64 = lib/x86_64/apic.c lib/x86_64/processor.c lib/x86_64/vmx.c lib/x86_64/svm.c lib/x86_64/ucall.c lib/x86_64/handlers.S |
Raghavendra Rao Ananta | 250b8d6 | 2021-10-07 23:34:37 +0000 | [diff] [blame] | 42 | LIBKVM_aarch64 = lib/aarch64/processor.c lib/aarch64/ucall.c lib/aarch64/handlers.S lib/aarch64/spinlock.c lib/aarch64/gic.c lib/aarch64/gic_v3.c lib/aarch64/vgic.c |
Collin Walling | efaa83a | 2020-12-07 10:41:25 -0500 | [diff] [blame] | 43 | LIBKVM_s390x = lib/s390x/processor.c lib/s390x/ucall.c lib/s390x/diag318_test_handler.c |
Anup Patel | 3e06cdf | 2021-10-05 18:09:56 +0530 | [diff] [blame] | 44 | LIBKVM_riscv = lib/riscv/processor.c lib/riscv/ucall.c |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 45 | |
Vitaly Kuznetsov | 9e6d484 | 2022-01-17 16:05:41 +0100 | [diff] [blame] | 46 | TEST_GEN_PROGS_x86_64 = x86_64/cpuid_test |
| 47 | TEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test |
Emanuele Giuseppe Esposito | 77a3aa2 | 2021-03-18 15:56:29 +0100 | [diff] [blame] | 48 | TEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features |
Vitaly Kuznetsov | 18178ff | 2018-10-16 18:50:11 +0200 | [diff] [blame] | 49 | TEST_GEN_PROGS_x86_64 += x86_64/evmcs_test |
Aaron Lewis | 39bbcc3 | 2021-05-10 07:48:34 -0700 | [diff] [blame] | 50 | TEST_GEN_PROGS_x86_64 += x86_64/emulator_error_test |
Vitaly Kuznetsov | 2c7f76b | 2021-03-18 15:09:49 +0100 | [diff] [blame] | 51 | TEST_GEN_PROGS_x86_64 += x86_64/hyperv_clock |
Vitaly Kuznetsov | 7edcb73 | 2018-12-10 18:21:59 +0100 | [diff] [blame] | 52 | TEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid |
Vitaly Kuznetsov | e2e1cc1 | 2021-05-21 11:52:04 +0200 | [diff] [blame] | 53 | TEST_GEN_PROGS_x86_64 += x86_64/hyperv_features |
Oliver Upton | 61fb1c5 | 2021-09-16 18:15:48 +0000 | [diff] [blame] | 54 | TEST_GEN_PROGS_x86_64 += x86_64/kvm_clock_test |
Oliver Upton | ac4a4d6 | 2020-10-27 16:10:44 -0700 | [diff] [blame] | 55 | TEST_GEN_PROGS_x86_64 += x86_64/kvm_pv_test |
Aaron Lewis | 9dba988 | 2019-05-31 14:14:52 +0000 | [diff] [blame] | 56 | TEST_GEN_PROGS_x86_64 += x86_64/mmio_warning_test |
Sean Christopherson | ef6a74b | 2021-06-22 13:05:29 -0700 | [diff] [blame] | 57 | TEST_GEN_PROGS_x86_64 += x86_64/mmu_role_test |
Aaron Lewis | 61cfcd5 | 2019-05-21 17:13:58 +0000 | [diff] [blame] | 58 | TEST_GEN_PROGS_x86_64 += x86_64/platform_info_test |
Jim Mattson | bef9a70 | 2022-01-14 21:24:31 -0800 | [diff] [blame] | 59 | TEST_GEN_PROGS_x86_64 += x86_64/pmu_event_filter_test |
Emanuele Giuseppe Esposito | 3df2252 | 2021-03-18 16:16:24 +0100 | [diff] [blame] | 60 | TEST_GEN_PROGS_x86_64 += x86_64/set_boot_cpu_id |
Aaron Lewis | 61cfcd5 | 2019-05-21 17:13:58 +0000 | [diff] [blame] | 61 | TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test |
| 62 | TEST_GEN_PROGS_x86_64 += x86_64/smm_test |
| 63 | TEST_GEN_PROGS_x86_64 += x86_64/state_test |
Makarand Sonare | 8d7fbf0 | 2020-05-26 14:51:07 -0700 | [diff] [blame] | 64 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_preemption_timer_test |
Andrew Jones | 94c4b76b | 2020-03-13 16:56:44 +0100 | [diff] [blame] | 65 | TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test |
Maxim Levitsky | 1ad3210 | 2021-09-14 18:48:13 +0300 | [diff] [blame] | 66 | TEST_GEN_PROGS_x86_64 += x86_64/svm_int_ctl_test |
Aaron Lewis | 61cfcd5 | 2019-05-21 17:13:58 +0000 | [diff] [blame] | 67 | TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test |
Sean Christopherson | 10e7a09 | 2021-10-25 13:13:11 -0700 | [diff] [blame] | 68 | TEST_GEN_PROGS_x86_64 += x86_64/userspace_io_test |
Aaron Lewis | 3cea189 | 2020-10-12 12:47:16 -0700 | [diff] [blame] | 69 | TEST_GEN_PROGS_x86_64 += x86_64/userspace_msr_exit_test |
Jim Mattson | 97a71a5 | 2020-10-26 11:09:22 -0700 | [diff] [blame] | 70 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_apic_access_test |
Aaron Lewis | 61cfcd5 | 2019-05-21 17:13:58 +0000 | [diff] [blame] | 71 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test |
Paolo Bonzini | 0944442 | 2019-09-26 15:01:15 +0200 | [diff] [blame] | 72 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test |
Sean Christopherson | e337f7e | 2021-12-28 23:24:37 +0000 | [diff] [blame] | 73 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_exception_with_invalid_guest_state |
Sean Christopherson | ab1ef34 | 2021-12-07 19:30:06 +0000 | [diff] [blame] | 74 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_invalid_nested_guest_state |
Aaron Lewis | da1e307 | 2019-05-02 11:31:41 -0700 | [diff] [blame] | 75 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test |
Aaron Lewis | 61cfcd5 | 2019-05-21 17:13:58 +0000 | [diff] [blame] | 76 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test |
Ilias Stamatis | efe5854 | 2021-05-26 19:44:18 +0100 | [diff] [blame] | 77 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_nested_tsc_scaling_test |
Peter Shier | 678e90a | 2020-11-05 14:38:23 -0800 | [diff] [blame] | 78 | TEST_GEN_PROGS_x86_64 += x86_64/xapic_ipi_test |
Aaron Lewis | c90992b | 2019-10-21 16:30:28 -0700 | [diff] [blame] | 79 | TEST_GEN_PROGS_x86_64 += x86_64/xss_msr_test |
Peter Xu | 449aa90 | 2020-05-05 16:50:00 -0400 | [diff] [blame] | 80 | TEST_GEN_PROGS_x86_64 += x86_64/debug_regs |
Paolo Bonzini | 0c899c2 | 2020-09-24 14:45:27 +0200 | [diff] [blame] | 81 | TEST_GEN_PROGS_x86_64 += x86_64/tsc_msrs_test |
Like Xu | f88d4f2 | 2021-02-01 13:10:39 +0800 | [diff] [blame] | 82 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_msrs_test |
David Woodhouse | 8d4e7e8 | 2020-12-04 01:02:04 +0000 | [diff] [blame] | 83 | TEST_GEN_PROGS_x86_64 += x86_64/xen_shinfo_test |
Joao Martins | 23200b7 | 2018-06-13 09:55:44 -0400 | [diff] [blame] | 84 | TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test |
Peter Gonda | 6a58150 | 2021-10-21 10:43:03 -0700 | [diff] [blame] | 85 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_pi_mmio_test |
| 86 | TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests |
Yang Zhong | bf70636 | 2021-12-23 09:53:22 -0500 | [diff] [blame] | 87 | TEST_GEN_PROGS_x86_64 += x86_64/amx_test |
David Matlack | de1956f | 2022-01-20 00:38:26 +0000 | [diff] [blame] | 88 | TEST_GEN_PROGS_x86_64 += access_tracking_perf_test |
Ben Gardon | 025eed7 | 2020-01-23 10:04:27 -0800 | [diff] [blame] | 89 | TEST_GEN_PROGS_x86_64 += demand_paging_test |
Andrew Jones | 94c4b76b | 2020-03-13 16:56:44 +0100 | [diff] [blame] | 90 | TEST_GEN_PROGS_x86_64 += dirty_log_test |
Ben Gardon | 4fd94ec | 2020-10-27 16:37:33 -0700 | [diff] [blame] | 91 | TEST_GEN_PROGS_x86_64 += dirty_log_perf_test |
Ignacio Alvarado | 1838b06 | 2021-02-13 00:14:52 +0000 | [diff] [blame] | 92 | TEST_GEN_PROGS_x86_64 += hardware_disable_test |
Paolo Bonzini | fd4198bf | 2019-07-15 12:50:46 +0200 | [diff] [blame] | 93 | TEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus |
Yanan Wang | b9c2bd5 | 2021-03-30 16:08:56 +0800 | [diff] [blame] | 94 | TEST_GEN_PROGS_x86_64 += kvm_page_table_test |
Ben Gardon | f73a344 | 2021-01-12 13:42:53 -0800 | [diff] [blame] | 95 | TEST_GEN_PROGS_x86_64 += memslot_modification_stress_test |
Maciej S. Szmigiero | cad347f | 2021-04-13 16:08:28 +0200 | [diff] [blame] | 96 | TEST_GEN_PROGS_x86_64 += memslot_perf_test |
Sean Christopherson | 61e52f1 | 2021-09-01 13:30:29 -0700 | [diff] [blame] | 97 | TEST_GEN_PROGS_x86_64 += rseq_test |
Sean Christopherson | 5b4f758 | 2020-04-10 16:17:06 -0700 | [diff] [blame] | 98 | TEST_GEN_PROGS_x86_64 += set_memory_region_test |
Andrew Jones | 94c4b76b | 2020-03-13 16:56:44 +0100 | [diff] [blame] | 99 | TEST_GEN_PROGS_x86_64 += steal_time |
Jing Zhang | 0b45d58 | 2021-06-18 22:27:08 +0000 | [diff] [blame] | 100 | TEST_GEN_PROGS_x86_64 += kvm_binary_stats_test |
Oliver Upton | 3f9808c | 2021-09-16 18:15:51 +0000 | [diff] [blame] | 101 | TEST_GEN_PROGS_x86_64 += system_counter_offset_test |
Andrew Jones | fff8dcd | 2018-09-18 19:54:32 +0200 | [diff] [blame] | 102 | |
Raghavendra Rao Ananta | 4959d86 | 2021-10-07 23:34:38 +0000 | [diff] [blame] | 103 | TEST_GEN_PROGS_aarch64 += aarch64/arch_timer |
Ricardo Koller | 4f05223 | 2021-06-10 18:10:20 -0700 | [diff] [blame] | 104 | TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions |
Andrew Jones | fd02029 | 2020-10-29 21:17:01 +0100 | [diff] [blame] | 105 | TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list |
Oliver Upton | cb97cf9 | 2021-08-18 20:21:33 +0000 | [diff] [blame] | 106 | TEST_GEN_PROGS_aarch64 += aarch64/psci_cpu_on_test |
Eric Auger | dc0e058 | 2021-04-05 18:39:41 +0200 | [diff] [blame] | 107 | TEST_GEN_PROGS_aarch64 += aarch64/vgic_init |
Ricardo Koller | 50b020c | 2021-11-08 18:38:55 -0800 | [diff] [blame] | 108 | TEST_GEN_PROGS_aarch64 += aarch64/vgic_irq |
Ben Gardon | 025eed7 | 2020-01-23 10:04:27 -0800 | [diff] [blame] | 109 | TEST_GEN_PROGS_aarch64 += demand_paging_test |
Andrew Jones | 94c4b76b | 2020-03-13 16:56:44 +0100 | [diff] [blame] | 110 | TEST_GEN_PROGS_aarch64 += dirty_log_test |
Andrew Jones | 87c5f35 | 2020-11-11 13:26:34 +0100 | [diff] [blame] | 111 | TEST_GEN_PROGS_aarch64 += dirty_log_perf_test |
Thomas Huth | 49fe9a5 | 2019-05-23 18:43:09 +0200 | [diff] [blame] | 112 | TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus |
Yanan Wang | b9c2bd5 | 2021-03-30 16:08:56 +0800 | [diff] [blame] | 113 | TEST_GEN_PROGS_aarch64 += kvm_page_table_test |
Ricardo Koller | 358928f | 2021-09-07 11:09:57 -0700 | [diff] [blame] | 114 | TEST_GEN_PROGS_aarch64 += memslot_modification_stress_test |
| 115 | TEST_GEN_PROGS_aarch64 += memslot_perf_test |
Sean Christopherson | 61e52f1 | 2021-09-01 13:30:29 -0700 | [diff] [blame] | 116 | TEST_GEN_PROGS_aarch64 += rseq_test |
Sean Christopherson | 5b4f758 | 2020-04-10 16:17:06 -0700 | [diff] [blame] | 117 | TEST_GEN_PROGS_aarch64 += set_memory_region_test |
Andrew Jones | 94c4b76b | 2020-03-13 16:56:44 +0100 | [diff] [blame] | 118 | TEST_GEN_PROGS_aarch64 += steal_time |
Jing Zhang | 0b45d58 | 2021-06-18 22:27:08 +0000 | [diff] [blame] | 119 | TEST_GEN_PROGS_aarch64 += kvm_binary_stats_test |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 120 | |
Thomas Huth | be6f55a | 2019-08-29 15:07:32 +0200 | [diff] [blame] | 121 | TEST_GEN_PROGS_s390x = s390x/memop |
Janosch Frank | b25d4cb | 2020-01-31 05:02:04 -0500 | [diff] [blame] | 122 | TEST_GEN_PROGS_s390x += s390x/resets |
Andrew Jones | 94c4b76b | 2020-03-13 16:56:44 +0100 | [diff] [blame] | 123 | TEST_GEN_PROGS_s390x += s390x/sync_regs_test |
Ben Gardon | 025eed7 | 2020-01-23 10:04:27 -0800 | [diff] [blame] | 124 | TEST_GEN_PROGS_s390x += demand_paging_test |
Andrew Jones | 94c4b76b | 2020-03-13 16:56:44 +0100 | [diff] [blame] | 125 | TEST_GEN_PROGS_s390x += dirty_log_test |
Thomas Huth | 49fe9a5 | 2019-05-23 18:43:09 +0200 | [diff] [blame] | 126 | TEST_GEN_PROGS_s390x += kvm_create_max_vcpus |
Yanan Wang | b9c2bd5 | 2021-03-30 16:08:56 +0800 | [diff] [blame] | 127 | TEST_GEN_PROGS_s390x += kvm_page_table_test |
Sean Christopherson | 61e52f1 | 2021-09-01 13:30:29 -0700 | [diff] [blame] | 128 | TEST_GEN_PROGS_s390x += rseq_test |
Sean Christopherson | 5b4f758 | 2020-04-10 16:17:06 -0700 | [diff] [blame] | 129 | TEST_GEN_PROGS_s390x += set_memory_region_test |
Jing Zhang | 0b45d58 | 2021-06-18 22:27:08 +0000 | [diff] [blame] | 130 | TEST_GEN_PROGS_s390x += kvm_binary_stats_test |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 131 | |
Anup Patel | 3e06cdf | 2021-10-05 18:09:56 +0530 | [diff] [blame] | 132 | TEST_GEN_PROGS_riscv += demand_paging_test |
| 133 | TEST_GEN_PROGS_riscv += dirty_log_test |
| 134 | TEST_GEN_PROGS_riscv += kvm_create_max_vcpus |
| 135 | TEST_GEN_PROGS_riscv += kvm_page_table_test |
| 136 | TEST_GEN_PROGS_riscv += set_memory_region_test |
| 137 | TEST_GEN_PROGS_riscv += kvm_binary_stats_test |
| 138 | |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 139 | TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) |
| 140 | LIBKVM += $(LIBKVM_$(UNAME_M)) |
| 141 | |
| 142 | INSTALL_HDR_PATH = $(top_srcdir)/usr |
| 143 | LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ |
Andrew Jones | cc68765 | 2018-09-18 19:54:26 +0200 | [diff] [blame] | 144 | LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include |
Vitaly Kuznetsov | b80db73 | 2020-06-05 16:20:28 +0200 | [diff] [blame] | 145 | ifeq ($(ARCH),x86_64) |
| 146 | LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include |
| 147 | else |
Shuah Khan | 66d69e0 | 2020-04-27 18:11:07 -0600 | [diff] [blame] | 148 | LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include |
Vitaly Kuznetsov | b80db73 | 2020-06-05 16:20:28 +0200 | [diff] [blame] | 149 | endif |
Thomas Huth | 319f6f9 | 2019-05-17 11:04:45 +0200 | [diff] [blame] | 150 | CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ |
| 151 | -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ |
Sean Christopherson | a5543d3 | 2019-12-20 20:44:56 -0800 | [diff] [blame] | 152 | -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \ |
Anup Patel | 788490e | 2021-11-26 18:33:45 +0530 | [diff] [blame] | 153 | -I$(<D) -Iinclude/$(UNAME_M) -I.. $(EXTRA_CFLAGS) |
Paolo Bonzini | c2390f1 | 2019-04-11 15:51:19 +0200 | [diff] [blame] | 154 | |
| 155 | no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \ |
Shuah Khan | 6e06983 | 2019-10-02 17:14:30 -0600 | [diff] [blame] | 156 | $(CC) -Werror -no-pie -x c - -o "$$TMP", -no-pie) |
Paolo Bonzini | c2390f1 | 2019-04-11 15:51:19 +0200 | [diff] [blame] | 157 | |
Christian Borntraeger | 8343ba2 | 2019-05-24 12:27:01 +0200 | [diff] [blame] | 158 | # On s390, build the testcases KVM-enabled |
| 159 | pgste-option = $(call try-run, echo 'int main() { return 0; }' | \ |
| 160 | $(CC) -Werror -Wl$(comma)--s390-pgste -x c - -o "$$TMP",-Wl$(comma)--s390-pgste) |
| 161 | |
| 162 | |
| 163 | LDFLAGS += -pthread $(no-pie-option) $(pgste-option) |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 164 | |
| 165 | # After inclusion, $(OUTPUT) is defined and |
| 166 | # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ |
| 167 | include ../lib.mk |
| 168 | |
| 169 | STATIC_LIBS := $(OUTPUT)/libkvm.a |
Aaron Lewis | 29faeb9 | 2020-10-12 12:47:15 -0700 | [diff] [blame] | 170 | LIBKVM_C := $(filter %.c,$(LIBKVM)) |
| 171 | LIBKVM_S := $(filter %.S,$(LIBKVM)) |
| 172 | LIBKVM_C_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_C)) |
| 173 | LIBKVM_S_OBJ := $(patsubst %.S, $(OUTPUT)/%.o, $(LIBKVM_S)) |
| 174 | EXTRA_CLEAN += $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(STATIC_LIBS) cscope.* |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 175 | |
Aaron Lewis | 29faeb9 | 2020-10-12 12:47:15 -0700 | [diff] [blame] | 176 | x := $(shell mkdir -p $(sort $(dir $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ)))) |
| 177 | $(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 178 | $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ |
| 179 | |
Aaron Lewis | 29faeb9 | 2020-10-12 12:47:15 -0700 | [diff] [blame] | 180 | $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S |
| 181 | $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ |
| 182 | |
| 183 | LIBKVM_OBJS = $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) |
| 184 | $(OUTPUT)/libkvm.a: $(LIBKVM_OBJS) |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 185 | $(AR) crs $@ $^ |
| 186 | |
Shuah Khan | 66d69e0 | 2020-04-27 18:11:07 -0600 | [diff] [blame] | 187 | x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))) |
Anders Roxell | b2d35fa | 2018-09-04 12:47:21 +0200 | [diff] [blame] | 188 | all: $(STATIC_LIBS) |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 189 | $(TEST_GEN_PROGS): $(STATIC_LIBS) |
Andrew Jones | eea192b | 2018-09-18 19:54:27 +0200 | [diff] [blame] | 190 | |
| 191 | cscope: include_paths = $(LINUX_TOOL_INCLUDE) $(LINUX_HDR_PATH) include lib .. |
| 192 | cscope: |
| 193 | $(RM) cscope.* |
| 194 | (find $(include_paths) -name '*.h' \ |
| 195 | -exec realpath --relative-base=$(PWD) {} \;; \ |
| 196 | find . -name '*.c' \ |
| 197 | -exec realpath --relative-base=$(PWD) {} \;) | sort -u > cscope.files |
| 198 | cscope -b |