xref: /linux/drivers/gpu/drm/xe/Makefile (revision 08516de501fae647fb29bf3b62718de56cc24014)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for the drm device driver.  This driver provides support for the
4# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
5
6# Add a set of useful warning flags and enable -Werror for CI to prevent
7# trivial mistakes from creeping in. We have to do this piecemeal as we reject
8# any patch that isn't warning clean, so turning on -Wall -Wextra (or W=1) we
9# need to filter out dubious warnings.  Still it is our interest
10# to keep running locally with W=1 C=1 until we are completely clean.
11#
12# Note the danger in using -Wall -Wextra is that when CI updates gcc we
13# will most likely get a sudden build breakage... Hopefully we will fix
14# new warnings before CI updates!
15subdir-ccflags-y := -Wall -Wextra
16subdir-ccflags-y += $(call cc-disable-warning, unused-parameter)
17subdir-ccflags-y += $(call cc-disable-warning, type-limits)
18subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
19subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
20# clang warnings
21subdir-ccflags-y += $(call cc-disable-warning, sign-compare)
22subdir-ccflags-y += $(call cc-disable-warning, sometimes-uninitialized)
23subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
24subdir-ccflags-y += $(call cc-disable-warning, frame-address)
25subdir-ccflags-$(CONFIG_DRM_XE_WERROR) += -Werror
26
27# Fine grained warnings disable
28CFLAGS_xe_pci.o = $(call cc-disable-warning, override-init)
29
30subdir-ccflags-y += -I$(obj) -I$(srctree)/$(src)
31
32# generated sources
33hostprogs := xe_gen_wa_oob
34
35generated_oob := $(obj)/generated/xe_wa_oob.c $(obj)/generated/xe_wa_oob.h
36
37quiet_cmd_wa_oob = GEN     $(notdir $(generated_oob))
38      cmd_wa_oob = mkdir -p $(@D); $^ $(generated_oob)
39
40$(generated_oob) &: $(obj)/xe_gen_wa_oob $(srctree)/$(src)/xe_wa_oob.rules
41	$(call cmd,wa_oob)
42
43$(obj)/xe_guc.o $(obj)/xe_wa.o: $(generated_oob)
44
45# Please keep these build lists sorted!
46
47# core driver code
48
49xe-y += xe_bb.o \
50	xe_bo.o \
51	xe_bo_evict.o \
52	xe_debugfs.o \
53	xe_devcoredump.o \
54	xe_device.o \
55	xe_dma_buf.o \
56	xe_engine.o \
57	xe_exec.o \
58	xe_execlist.o \
59	xe_force_wake.o \
60	xe_ggtt.o \
61	xe_gpu_scheduler.o \
62	xe_gt.o \
63	xe_gt_clock.o \
64	xe_gt_debugfs.o \
65	xe_gt_mcr.o \
66	xe_gt_pagefault.o \
67	xe_gt_sysfs.o \
68	xe_gt_tlb_invalidation.o \
69	xe_gt_topology.o \
70	xe_guc.o \
71	xe_guc_ads.o \
72	xe_guc_ct.o \
73	xe_guc_debugfs.o \
74	xe_guc_hwconfig.o \
75	xe_guc_log.o \
76	xe_guc_pc.o \
77	xe_guc_submit.o \
78	xe_hw_engine.o \
79	xe_hw_fence.o \
80	xe_huc.o \
81	xe_huc_debugfs.o \
82	xe_irq.o \
83	xe_lrc.o \
84	xe_migrate.o \
85	xe_mmio.o \
86	xe_mocs.o \
87	xe_module.o \
88	xe_pat.o \
89	xe_pci.o \
90	xe_pcode.o \
91	xe_pm.o \
92	xe_preempt_fence.o \
93	xe_pt.o \
94	xe_pt_walk.o \
95	xe_query.o \
96	xe_reg_sr.o \
97	xe_reg_whitelist.o \
98	xe_rtp.o \
99	xe_ring_ops.o \
100	xe_sa.o \
101	xe_sched_job.o \
102	xe_step.o \
103	xe_sync.o \
104	xe_tile.o \
105	xe_trace.o \
106	xe_ttm_sys_mgr.o \
107	xe_ttm_stolen_mgr.o \
108	xe_ttm_vram_mgr.o \
109	xe_tuning.o \
110	xe_uc.o \
111	xe_uc_debugfs.o \
112	xe_uc_fw.o \
113	xe_vm.o \
114	xe_vm_madvise.o \
115	xe_wait_user_fence.o \
116	xe_wa.o \
117	xe_wopcm.o
118
119obj-$(CONFIG_DRM_XE) += xe.o
120obj-$(CONFIG_DRM_XE_KUNIT_TEST) += tests/
121
122# header test
123hdrtest_find_args := -not -path xe_rtp_helpers.h
124
125always-$(CONFIG_DRM_XE_WERROR) += \
126	$(patsubst %.h,%.hdrtest, $(shell cd $(srctree)/$(src) && find * -name '*.h' $(hdrtest_find_args)))
127
128quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
129      cmd_hdrtest = $(CC) -DHDRTEST $(filter-out $(CFLAGS_GCOV), $(c_flags)) -S -o /dev/null -x c /dev/null -include $<; touch $@
130
131$(obj)/%.hdrtest: $(src)/%.h FORCE
132	$(call if_changed_dep,hdrtest)
133