1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 2b61442dfSMasahiro Yamadainclude ../../../build/Build.include 3c2390f16SPaolo Bonzini 4783e9e51SPaolo Bonziniall: 5783e9e51SPaolo Bonzini 6cc68765dSAndrew Jonestop_srcdir = ../../../.. 7baea2ce5SPaolo Bonziniinclude $(top_srcdir)/scripts/subarch.include 8baea2ce5SPaolo BonziniARCH ?= $(SUBARCH) 966d69e08SShuah Khan 106a5db83aSSean Christophersonifeq ($(ARCH),x86) 116a5db83aSSean Christopherson ARCH_DIR := x86_64 126a5db83aSSean Christophersonelse ifeq ($(ARCH),arm64) 136a5db83aSSean Christopherson ARCH_DIR := aarch64 146a5db83aSSean Christophersonelse ifeq ($(ARCH),s390) 156a5db83aSSean Christopherson ARCH_DIR := s390x 166a5db83aSSean Christophersonelse 176a5db83aSSean Christopherson ARCH_DIR := $(ARCH) 183e06cdf1SAnup Patelendif 1966d69e08SShuah Khan 20cf97d5e9SDavid MatlackLIBKVM += lib/assert.c 21cf97d5e9SDavid MatlackLIBKVM += lib/elf.c 22cf97d5e9SDavid MatlackLIBKVM += lib/guest_modes.c 23cf97d5e9SDavid MatlackLIBKVM += lib/io.c 24cf97d5e9SDavid MatlackLIBKVM += lib/kvm_util.c 259fda6753SDavid MatlackLIBKVM += lib/memstress.c 26e5119382SAaron LewisLIBKVM += lib/guest_sprintf.c 27cf97d5e9SDavid MatlackLIBKVM += lib/rbtree.c 28cf97d5e9SDavid MatlackLIBKVM += lib/sparsebit.c 29cf97d5e9SDavid MatlackLIBKVM += lib/test_util.c 3070466381SSean ChristophersonLIBKVM += lib/ucall_common.c 31a93871d0SRicardo KollerLIBKVM += lib/userfaultfd_util.c 32cf97d5e9SDavid Matlack 336b6f7148SSean ChristophersonLIBKVM_STRING += lib/string_override.c 346b6f7148SSean Christopherson 35cf97d5e9SDavid MatlackLIBKVM_x86_64 += lib/x86_64/apic.c 36cf97d5e9SDavid MatlackLIBKVM_x86_64 += lib/x86_64/handlers.S 37e8f3d23cSVitaly KuznetsovLIBKVM_x86_64 += lib/x86_64/hyperv.c 389fda6753SDavid MatlackLIBKVM_x86_64 += lib/x86_64/memstress.c 39cf97d5e9SDavid MatlackLIBKVM_x86_64 += lib/x86_64/processor.c 40cf97d5e9SDavid MatlackLIBKVM_x86_64 += lib/x86_64/svm.c 41cf97d5e9SDavid MatlackLIBKVM_x86_64 += lib/x86_64/ucall.c 42cf97d5e9SDavid MatlackLIBKVM_x86_64 += lib/x86_64/vmx.c 43cf97d5e9SDavid Matlack 44cf97d5e9SDavid MatlackLIBKVM_aarch64 += lib/aarch64/gic.c 45cf97d5e9SDavid MatlackLIBKVM_aarch64 += lib/aarch64/gic_v3.c 46cf97d5e9SDavid MatlackLIBKVM_aarch64 += lib/aarch64/handlers.S 47cf97d5e9SDavid MatlackLIBKVM_aarch64 += lib/aarch64/processor.c 48cf97d5e9SDavid MatlackLIBKVM_aarch64 += lib/aarch64/spinlock.c 49cf97d5e9SDavid MatlackLIBKVM_aarch64 += lib/aarch64/ucall.c 50cf97d5e9SDavid MatlackLIBKVM_aarch64 += lib/aarch64/vgic.c 51cf97d5e9SDavid Matlack 52cf97d5e9SDavid MatlackLIBKVM_s390x += lib/s390x/diag318_test_handler.c 53cf97d5e9SDavid MatlackLIBKVM_s390x += lib/s390x/processor.c 54cf97d5e9SDavid MatlackLIBKVM_s390x += lib/s390x/ucall.c 55cf97d5e9SDavid Matlack 56cf97d5e9SDavid MatlackLIBKVM_riscv += lib/riscv/processor.c 57cf97d5e9SDavid MatlackLIBKVM_riscv += lib/riscv/ucall.c 58783e9e51SPaolo Bonzini 598448ec59SBen Gardon# Non-compiled test targets 608448ec59SBen GardonTEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh 618448ec59SBen Gardon 628448ec59SBen Gardon# Compiled test targets 639e6d484fSVitaly KuznetsovTEST_GEN_PROGS_x86_64 = x86_64/cpuid_test 649e6d484fSVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/cr4_cpuid_sync_test 65dfa78a20SBen GardonTEST_GEN_PROGS_x86_64 += x86_64/dirty_log_page_splitting_test 6677a3aa26SEmanuele Giuseppe EspositoTEST_GEN_PROGS_x86_64 += x86_64/get_msr_index_features 673ae5b759SDavid MatlackTEST_GEN_PROGS_x86_64 += x86_64/exit_on_emulation_failure_test 686c2fa8b2SOliver UptonTEST_GEN_PROGS_x86_64 += x86_64/fix_hypercall_test 692c7f76b4SVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/hyperv_clock 707edcb734SVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/hyperv_cpuid 710fa32dadSVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/hyperv_evmcs 7260325261SVipin SharmaTEST_GEN_PROGS_x86_64 += x86_64/hyperv_extended_hypercalls 73e2e1cc1fSVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/hyperv_features 7499848924SVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/hyperv_ipi 75e67bd7dfSVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/hyperv_svm_test 769e7726a8SVitaly KuznetsovTEST_GEN_PROGS_x86_64 += x86_64/hyperv_tlb_flush 7761fb1c54SOliver UptonTEST_GEN_PROGS_x86_64 += x86_64/kvm_clock_test 78ac4a4d6dSOliver UptonTEST_GEN_PROGS_x86_64 += x86_64/kvm_pv_test 799dba988eSAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/mmio_warning_test 802325d4ddSSean ChristophersonTEST_GEN_PROGS_x86_64 += x86_64/monitor_mwait_test 8128c40b2cSSean ChristophersonTEST_GEN_PROGS_x86_64 += x86_64/nested_exceptions_test 8261cfcd54SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/platform_info_test 83bef9a701SJim MattsonTEST_GEN_PROGS_x86_64 += x86_64/pmu_event_filter_test 843df22524SEmanuele Giuseppe EspositoTEST_GEN_PROGS_x86_64 += x86_64/set_boot_cpu_id 8561cfcd54SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test 8652d3a4fbSDavid MatlackTEST_GEN_PROGS_x86_64 += x86_64/smaller_maxphyaddr_emulation_test 8761cfcd54SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/smm_test 8861cfcd54SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/state_test 898d7fbf01SMakarand SonareTEST_GEN_PROGS_x86_64 += x86_64/vmx_preemption_timer_test 9094c4b76bSAndrew JonesTEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test 911ad32105SMaxim LevitskyTEST_GEN_PROGS_x86_64 += x86_64/svm_int_ctl_test 920bd2d3f4SMaxim LevitskyTEST_GEN_PROGS_x86_64 += x86_64/svm_nested_shutdown_test 93d8969871SMaciej S. SzmigieroTEST_GEN_PROGS_x86_64 += x86_64/svm_nested_soft_inject_test 94e467b0deSDavid WoodhouseTEST_GEN_PROGS_x86_64 += x86_64/tsc_scaling_sync 9561cfcd54SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test 96eede2065SJue WangTEST_GEN_PROGS_x86_64 += x86_64/ucna_injection_test 9710e7a099SSean ChristophersonTEST_GEN_PROGS_x86_64 += x86_64/userspace_io_test 983cea1891SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/userspace_msr_exit_test 9997a71a54SJim MattsonTEST_GEN_PROGS_x86_64 += x86_64/vmx_apic_access_test 10061cfcd54SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test 10109444420SPaolo BonziniTEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test 102e337f7e0SSean ChristophersonTEST_GEN_PROGS_x86_64 += x86_64/vmx_exception_with_invalid_guest_state 103ce30d8b9SSean ChristophersonTEST_GEN_PROGS_x86_64 += x86_64/vmx_msrs_test 104ab1ef344SSean ChristophersonTEST_GEN_PROGS_x86_64 += x86_64/vmx_invalid_nested_guest_state 105da1e3071SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test 10661cfcd54SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test 107efe58549SIlias StamatisTEST_GEN_PROGS_x86_64 += x86_64/vmx_nested_tsc_scaling_test 108678e90a3SPeter ShierTEST_GEN_PROGS_x86_64 += x86_64/xapic_ipi_test 10985c68eb4SSean ChristophersonTEST_GEN_PROGS_x86_64 += x86_64/xapic_state_test 11003a405b7SAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/xcr0_cpuid_test 111c90992bfSAaron LewisTEST_GEN_PROGS_x86_64 += x86_64/xss_msr_test 112449aa906SPeter XuTEST_GEN_PROGS_x86_64 += x86_64/debug_regs 1130c899c25SPaolo BonziniTEST_GEN_PROGS_x86_64 += x86_64/tsc_msrs_test 114825be3b5SYang WeijiangTEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_caps_test 1158d4e7e80SDavid WoodhouseTEST_GEN_PROGS_x86_64 += x86_64/xen_shinfo_test 11623200b7aSJoao MartinsTEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test 1176a581508SPeter GondaTEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests 118bf70636dSYang ZhongTEST_GEN_PROGS_x86_64 += x86_64/amx_test 119753dcf7aSZeng GuangTEST_GEN_PROGS_x86_64 += x86_64/max_vcpuid_cap_test 12030267b43SChenyi QiangTEST_GEN_PROGS_x86_64 += x86_64/triple_fault_event_test 12147d2804bSMichal LuczajTEST_GEN_PROGS_x86_64 += x86_64/recalc_apic_map_test 122de1956f4SDavid MatlackTEST_GEN_PROGS_x86_64 += access_tracking_perf_test 123025eed7bSBen GardonTEST_GEN_PROGS_x86_64 += demand_paging_test 12494c4b76bSAndrew JonesTEST_GEN_PROGS_x86_64 += dirty_log_test 1254fd94ec7SBen GardonTEST_GEN_PROGS_x86_64 += dirty_log_perf_test 1265d1d46f9SAaron LewisTEST_GEN_PROGS_x86_64 += guest_print_test 1271838b06bSIgnacio AlvaradoTEST_GEN_PROGS_x86_64 += hardware_disable_test 128fd4198bfSPaolo BonziniTEST_GEN_PROGS_x86_64 += kvm_create_max_vcpus 129b9c2bd50SYanan WangTEST_GEN_PROGS_x86_64 += kvm_page_table_test 130b58c55d5SSean ChristophersonTEST_GEN_PROGS_x86_64 += max_guest_memory_test 131f73a3446SBen GardonTEST_GEN_PROGS_x86_64 += memslot_modification_stress_test 132cad347faSMaciej S. SzmigieroTEST_GEN_PROGS_x86_64 += memslot_perf_test 13361e52f16SSean ChristophersonTEST_GEN_PROGS_x86_64 += rseq_test 1345b4f758fSSean ChristophersonTEST_GEN_PROGS_x86_64 += set_memory_region_test 13594c4b76bSAndrew JonesTEST_GEN_PROGS_x86_64 += steal_time 1360b45d587SJing ZhangTEST_GEN_PROGS_x86_64 += kvm_binary_stats_test 1373f9808caSOliver UptonTEST_GEN_PROGS_x86_64 += system_counter_offset_test 138fff8dcd7SAndrew Jones 1398448ec59SBen Gardon# Compiled outputs used by test targets 1408448ec59SBen GardonTEST_GEN_PROGS_EXTENDED_x86_64 += x86_64/nx_huge_pages_test 1418448ec59SBen Gardon 142797b8451SOliver UptonTEST_GEN_PROGS_aarch64 += aarch64/aarch32_id_regs 1434959d865SRaghavendra Rao AnantaTEST_GEN_PROGS_aarch64 += aarch64/arch_timer 1444f05223aSRicardo KollerTEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions 1455ca24697SRaghavendra Rao AnantaTEST_GEN_PROGS_aarch64 += aarch64/hypercalls 14635c58101SRicardo KollerTEST_GEN_PROGS_aarch64 += aarch64/page_fault_test 147bf08515dSOliver UptonTEST_GEN_PROGS_aarch64 += aarch64/psci_test 14860e7dadeSOliver UptonTEST_GEN_PROGS_aarch64 += aarch64/smccc_filter 1492f5d27e6SReiji WatanabeTEST_GEN_PROGS_aarch64 += aarch64/vcpu_width_config 150dc0e058eSEric AugerTEST_GEN_PROGS_aarch64 += aarch64/vgic_init 15150b020cdSRicardo KollerTEST_GEN_PROGS_aarch64 += aarch64/vgic_irq 15245681804SOliver UptonTEST_GEN_PROGS_aarch64 += access_tracking_perf_test 153025eed7bSBen GardonTEST_GEN_PROGS_aarch64 += demand_paging_test 15494c4b76bSAndrew JonesTEST_GEN_PROGS_aarch64 += dirty_log_test 15587c5f35eSAndrew JonesTEST_GEN_PROGS_aarch64 += dirty_log_perf_test 1565d1d46f9SAaron LewisTEST_GEN_PROGS_aarch64 += guest_print_test 15717da79e0SAndrew JonesTEST_GEN_PROGS_aarch64 += get-reg-list 15849fe9a5dSThomas HuthTEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus 159b9c2bd50SYanan WangTEST_GEN_PROGS_aarch64 += kvm_page_table_test 160358928fdSRicardo KollerTEST_GEN_PROGS_aarch64 += memslot_modification_stress_test 161358928fdSRicardo KollerTEST_GEN_PROGS_aarch64 += memslot_perf_test 16261e52f16SSean ChristophersonTEST_GEN_PROGS_aarch64 += rseq_test 1635b4f758fSSean ChristophersonTEST_GEN_PROGS_aarch64 += set_memory_region_test 16494c4b76bSAndrew JonesTEST_GEN_PROGS_aarch64 += steal_time 1650b45d587SJing ZhangTEST_GEN_PROGS_aarch64 += kvm_binary_stats_test 166783e9e51SPaolo Bonzini 167be6f55a6SThomas HuthTEST_GEN_PROGS_s390x = s390x/memop 168b25d4cb4SJanosch FrankTEST_GEN_PROGS_s390x += s390x/resets 16994c4b76bSAndrew JonesTEST_GEN_PROGS_s390x += s390x/sync_regs_test 170c7ef9ebbSJanis Schoetterl-GlauschTEST_GEN_PROGS_s390x += s390x/tprot 171e325ba22SNico BoehrTEST_GEN_PROGS_s390x += s390x/cmma_test 172*642dbc03SIlya LeoshkevichTEST_GEN_PROGS_s390x += s390x/debug_test 173025eed7bSBen GardonTEST_GEN_PROGS_s390x += demand_paging_test 17494c4b76bSAndrew JonesTEST_GEN_PROGS_s390x += dirty_log_test 1755d1d46f9SAaron LewisTEST_GEN_PROGS_s390x += guest_print_test 17649fe9a5dSThomas HuthTEST_GEN_PROGS_s390x += kvm_create_max_vcpus 177b9c2bd50SYanan WangTEST_GEN_PROGS_s390x += kvm_page_table_test 17861e52f16SSean ChristophersonTEST_GEN_PROGS_s390x += rseq_test 1795b4f758fSSean ChristophersonTEST_GEN_PROGS_s390x += set_memory_region_test 1800b45d587SJing ZhangTEST_GEN_PROGS_s390x += kvm_binary_stats_test 181783e9e51SPaolo Bonzini 1823e06cdf1SAnup PatelTEST_GEN_PROGS_riscv += demand_paging_test 1833e06cdf1SAnup PatelTEST_GEN_PROGS_riscv += dirty_log_test 1845d1d46f9SAaron LewisTEST_GEN_PROGS_riscv += guest_print_test 18547706939SHaibo XuTEST_GEN_PROGS_riscv += get-reg-list 1863e06cdf1SAnup PatelTEST_GEN_PROGS_riscv += kvm_create_max_vcpus 1873e06cdf1SAnup PatelTEST_GEN_PROGS_riscv += kvm_page_table_test 1883e06cdf1SAnup PatelTEST_GEN_PROGS_riscv += set_memory_region_test 1893e06cdf1SAnup PatelTEST_GEN_PROGS_riscv += kvm_binary_stats_test 1903e06cdf1SAnup Patel 19117da79e0SAndrew JonesSPLIT_TESTS += get-reg-list 19217da79e0SAndrew Jones 1936a5db83aSSean ChristophersonTEST_PROGS += $(TEST_PROGS_$(ARCH_DIR)) 1946a5db83aSSean ChristophersonTEST_GEN_PROGS += $(TEST_GEN_PROGS_$(ARCH_DIR)) 1956a5db83aSSean ChristophersonTEST_GEN_PROGS_EXTENDED += $(TEST_GEN_PROGS_EXTENDED_$(ARCH_DIR)) 1966a5db83aSSean ChristophersonLIBKVM += $(LIBKVM_$(ARCH_DIR)) 197783e9e51SPaolo Bonzini 1985ed19528SYu ZhangOVERRIDE_TARGETS = 1 1995ed19528SYu Zhang 2005efb946bSSean Christopherson# lib.mak defines $(OUTPUT), prepends $(OUTPUT)/ to $(TEST_GEN_PROGS), and most 2015efb946bSSean Christopherson# importantly defines, i.e. overwrites, $(CC) (unless `make -e` or `make CC=`, 2025efb946bSSean Christopherson# which causes the environment variable to override the makefile). 2035efb946bSSean Christophersoninclude ../lib.mk 2045efb946bSSean Christopherson 205783e9e51SPaolo BonziniINSTALL_HDR_PATH = $(top_srcdir)/usr 206783e9e51SPaolo BonziniLINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ 207cc68765dSAndrew JonesLINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include 208b80db73dSVitaly Kuznetsovifeq ($(ARCH),x86_64) 209b80db73dSVitaly KuznetsovLINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include 210b80db73dSVitaly Kuznetsovelse 21166d69e08SShuah KhanLINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include 212b80db73dSVitaly Kuznetsovendif 213319f6f97SThomas HuthCFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ 2145ed19528SYu Zhang -Wno-gnu-variable-sized-type-not-at-end -MD\ 2157cf2e737SSean Christopherson -fno-builtin-memcmp -fno-builtin-memcpy -fno-builtin-memset \ 216a1c1b55eSAaron Lewis -fno-builtin-strnlen \ 217319f6f97SThomas Huth -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ 218a5543d34SSean Christopherson -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \ 2196a5db83aSSean Christopherson -I$(<D) -Iinclude/$(ARCH_DIR) -I ../rseq -I.. $(EXTRA_CFLAGS) \ 22066d42ac7SGavin Shan $(KHDR_INCLUDES) 221d7b9dc14SNina Schoetterl-Glauschifeq ($(ARCH),s390) 222d7b9dc14SNina Schoetterl-Glausch CFLAGS += -march=z10 223d7b9dc14SNina Schoetterl-Glauschendif 224c2390f16SPaolo Bonzini 2255dc38777SSean Christophersonno-pie-option := $(call try-run, echo 'int main(void) { return 0; }' | \ 2262b2d8afcSSean Christopherson $(CC) -Werror $(CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie) 227c2390f16SPaolo Bonzini 2288343ba2dSChristian Borntraeger# On s390, build the testcases KVM-enabled 2295dc38777SSean Christophersonpgste-option = $(call try-run, echo 'int main(void) { return 0; }' | \ 2308343ba2dSChristian Borntraeger $(CC) -Werror -Wl$(comma)--s390-pgste -x c - -o "$$TMP",-Wl$(comma)--s390-pgste) 2318343ba2dSChristian Borntraeger 23266d42ac7SGavin ShanLDLIBS += -ldl 2338343ba2dSChristian BorntraegerLDFLAGS += -pthread $(no-pie-option) $(pgste-option) 234783e9e51SPaolo Bonzini 23529faeb96SAaron LewisLIBKVM_C := $(filter %.c,$(LIBKVM)) 23629faeb96SAaron LewisLIBKVM_S := $(filter %.S,$(LIBKVM)) 23729faeb96SAaron LewisLIBKVM_C_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_C)) 23829faeb96SAaron LewisLIBKVM_S_OBJ := $(patsubst %.S, $(OUTPUT)/%.o, $(LIBKVM_S)) 2396b6f7148SSean ChristophersonLIBKVM_STRING_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_STRING)) 2406b6f7148SSean ChristophersonLIBKVM_OBJS = $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(LIBKVM_STRING_OBJ) 24117da79e0SAndrew JonesSPLIT_TESTS_TARGETS := $(patsubst %, $(OUTPUT)/%, $(SPLIT_TESTS)) 24217da79e0SAndrew JonesSPLIT_TESTS_OBJS := $(patsubst %, $(ARCH_DIR)/%.o, $(SPLIT_TESTS)) 243cdc979daSDavid Matlack 2445ed19528SYu ZhangTEST_GEN_OBJ = $(patsubst %, %.o, $(TEST_GEN_PROGS)) 2455ed19528SYu ZhangTEST_GEN_OBJ += $(patsubst %, %.o, $(TEST_GEN_PROGS_EXTENDED)) 2465ed19528SYu ZhangTEST_DEP_FILES = $(patsubst %.o, %.d, $(TEST_GEN_OBJ)) 2475ed19528SYu ZhangTEST_DEP_FILES += $(patsubst %.o, %.d, $(LIBKVM_OBJS)) 24817da79e0SAndrew JonesTEST_DEP_FILES += $(patsubst %.o, %.d, $(SPLIT_TESTS_OBJS)) 2495ed19528SYu Zhang-include $(TEST_DEP_FILES) 2505ed19528SYu Zhang 2515ed19528SYu Zhang$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): %: %.o 2525ed19528SYu Zhang $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LIBKVM_OBJS) $(LDLIBS) -o $@ 2535ed19528SYu Zhang$(TEST_GEN_OBJ): $(OUTPUT)/%.o: %.c 2545ed19528SYu Zhang $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ 2555ed19528SYu Zhang 25617da79e0SAndrew Jones$(SPLIT_TESTS_TARGETS): %: %.o $(SPLIT_TESTS_OBJS) 25717da79e0SAndrew Jones $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@ 25817da79e0SAndrew Jones 25917da79e0SAndrew JonesEXTRA_CLEAN += $(LIBKVM_OBJS) $(TEST_DEP_FILES) $(TEST_GEN_OBJ) $(SPLIT_TESTS_OBJS) cscope.* 260783e9e51SPaolo Bonzini 26129faeb96SAaron Lewisx := $(shell mkdir -p $(sort $(dir $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ)))) 26229faeb96SAaron Lewis$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c 263783e9e51SPaolo Bonzini $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ 264783e9e51SPaolo Bonzini 26529faeb96SAaron Lewis$(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S 26629faeb96SAaron Lewis $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ 26729faeb96SAaron Lewis 2686b6f7148SSean Christopherson# Compile the string overrides as freestanding to prevent the compiler from 2696b6f7148SSean Christopherson# generating self-referential code, e.g. without "freestanding" the compiler may 2706b6f7148SSean Christopherson# "optimize" memcmp() by invoking memcmp(), thus causing infinite recursion. 2716b6f7148SSean Christopherson$(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c 2726b6f7148SSean Christopherson $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@ 2736b6f7148SSean Christopherson 27466d69e08SShuah Khanx := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS)))) 275cdc979daSDavid Matlack$(TEST_GEN_PROGS): $(LIBKVM_OBJS) 2768448ec59SBen Gardon$(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS) 277eea192bfSAndrew Jones 278eea192bfSAndrew Jonescscope: include_paths = $(LINUX_TOOL_INCLUDE) $(LINUX_HDR_PATH) include lib .. 279eea192bfSAndrew Jonescscope: 280eea192bfSAndrew Jones $(RM) cscope.* 281eea192bfSAndrew Jones (find $(include_paths) -name '*.h' \ 282eea192bfSAndrew Jones -exec realpath --relative-base=$(PWD) {} \;; \ 283eea192bfSAndrew Jones find . -name '*.c' \ 284eea192bfSAndrew Jones -exec realpath --relative-base=$(PWD) {} \;) | sort -u > cscope.files 285eea192bfSAndrew Jones cscope -b 286