kbuild: remove header compile test
[linux-block.git] / usr / include / Makefile
CommitLineData
d6fc9fcb
MY
1# SPDX-License-Identifier: GPL-2.0-only
2
3# Unlike the kernel space, exported headers are written in standard C.
4# - Forbid C++ style comments
5# - Use '__inline__', '__asm__' instead of 'inline', 'asm'
6#
7# -std=c90 (equivalent to -ansi) catches the violation of those.
8# We cannot go as far as adding -Wpedantic since it emits too many warnings.
9UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration
10
11override c_flags = $(UAPI_CFLAGS) -Wp,-MD,$(depfile) -I$(objtree)/usr/include
12
13# The following are excluded for now because they fail to build.
14#
15# Do not add a new header to the blacklist without legitimate reason.
16# Please consider to fix the header first.
17#
18# Sorted alphabetically.
19header-test- += asm/ipcbuf.h
20header-test- += asm/msgbuf.h
21header-test- += asm/sembuf.h
22header-test- += asm/shmbuf.h
23header-test- += asm/signal.h
24header-test- += asm/ucontext.h
25header-test- += drm/vmwgfx_drm.h
26header-test- += linux/am437x-vpfe.h
27header-test- += linux/android/binder.h
28header-test- += linux/android/binderfs.h
d6fc9fcb 29header-test- += linux/coda.h
d6fc9fcb
MY
30header-test- += linux/elfcore.h
31header-test- += linux/errqueue.h
32header-test- += linux/fsmap.h
33header-test- += linux/hdlc/ioctl.h
34header-test- += linux/ivtv.h
d6fc9fcb
MY
35header-test- += linux/kexec.h
36header-test- += linux/matroxfb.h
d6fc9fcb 37header-test- += linux/nfc.h
d6fc9fcb
MY
38header-test- += linux/omap3isp.h
39header-test- += linux/omapfb.h
40header-test- += linux/patchkey.h
41header-test- += linux/phonet.h
42header-test- += linux/reiserfs_xattr.h
43header-test- += linux/scc.h
44header-test- += linux/sctp.h
45header-test- += linux/signal.h
46header-test- += linux/sysctl.h
47header-test- += linux/usb/audio.h
48header-test- += linux/v4l2-mediabus.h
49header-test- += linux/v4l2-subdev.h
50header-test- += linux/videodev2.h
51header-test- += linux/vm_sockets.h
d6fc9fcb
MY
52header-test- += sound/asequencer.h
53header-test- += sound/asoc.h
54header-test- += sound/asound.h
55header-test- += sound/compress_offload.h
56header-test- += sound/emu10k1.h
57header-test- += sound/sfnt_info.h
d6fc9fcb
MY
58header-test- += xen/evtchn.h
59header-test- += xen/gntdev.h
60header-test- += xen/privcmd.h
61
62# More headers are broken in some architectures
63
64ifeq ($(SRCARCH),arc)
65header-test- += linux/bpf_perf_event.h
66endif
67
68ifeq ($(SRCARCH),ia64)
69header-test- += asm/setup.h
70header-test- += asm/sigcontext.h
71header-test- += asm/perfmon.h
72header-test- += asm/perfmon_default_smpl.h
73header-test- += linux/if_bonding.h
74endif
75
76ifeq ($(SRCARCH),mips)
77header-test- += asm/stat.h
78endif
79
80ifeq ($(SRCARCH),powerpc)
81header-test- += asm/stat.h
82header-test- += linux/bpf_perf_event.h
83endif
84
85ifeq ($(SRCARCH),riscv)
86header-test- += linux/bpf_perf_event.h
87endif
88
d6fc9fcb
MY
89ifeq ($(SRCARCH),sparc)
90header-test- += asm/stat.h
91header-test- += asm/uctx.h
92header-test- += asm/fbio.h
d6fc9fcb
MY
93endif
94
95# asm-generic/*.h is used by asm/*.h, and should not be included directly
96header-test- += asm-generic/%
97
fcbb8461
MY
98extra-y := $(patsubst %.h,%.hdrtest, $(filter-out $(header-test-), \
99 $(patsubst $(obj)/%,%, $(shell find $(obj) -name '*.h'))))
100
101quiet_cmd_hdrtest = HDRTEST $<
102 cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null -include $<; touch $@
103
104$(obj)/%.hdrtest: $(obj)/%.h FORCE
105 $(call if_changed_dep,hdrtest)
d6fc9fcb 106
1634f2bf 107clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*)))