xref: /linux/usr/include/Makefile (revision 0889d07f3e4b171c453b2aaf2b257f9074cdf624)
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
29header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
30header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
31header-test- += linux/coda.h
32header-test- += linux/coda_psdev.h
33header-test- += linux/elfcore.h
34header-test- += linux/errqueue.h
35header-test- += linux/fsmap.h
36header-test- += linux/hdlc/ioctl.h
37header-test- += linux/ivtv.h
38header-test- += linux/jffs2.h
39header-test- += linux/kexec.h
40header-test- += linux/matroxfb.h
41header-test- += linux/netfilter_ipv4/ipt_LOG.h
42header-test- += linux/netfilter_ipv6/ip6t_LOG.h
43header-test- += linux/nfc.h
44header-test- += linux/omap3isp.h
45header-test- += linux/omapfb.h
46header-test- += linux/patchkey.h
47header-test- += linux/phonet.h
48header-test- += linux/reiserfs_xattr.h
49header-test- += linux/scc.h
50header-test- += linux/sctp.h
51header-test- += linux/signal.h
52header-test- += linux/sysctl.h
53header-test- += linux/usb/audio.h
54header-test- += linux/v4l2-mediabus.h
55header-test- += linux/v4l2-subdev.h
56header-test- += linux/videodev2.h
57header-test- += linux/vm_sockets.h
58header-test- += scsi/scsi_bsg_fc.h
59header-test- += scsi/scsi_netlink.h
60header-test- += scsi/scsi_netlink_fc.h
61header-test- += sound/asequencer.h
62header-test- += sound/asoc.h
63header-test- += sound/asound.h
64header-test- += sound/compress_offload.h
65header-test- += sound/emu10k1.h
66header-test- += sound/sfnt_info.h
67header-test- += sound/sof/eq.h
68header-test- += sound/sof/fw.h
69header-test- += sound/sof/header.h
70header-test- += sound/sof/manifest.h
71header-test- += sound/sof/trace.h
72header-test- += xen/evtchn.h
73header-test- += xen/gntdev.h
74header-test- += xen/privcmd.h
75
76# More headers are broken in some architectures
77
78ifeq ($(SRCARCH),arc)
79header-test- += linux/bpf_perf_event.h
80endif
81
82ifeq ($(SRCARCH),ia64)
83header-test- += asm/setup.h
84header-test- += asm/sigcontext.h
85header-test- += asm/perfmon.h
86header-test- += asm/perfmon_default_smpl.h
87header-test- += linux/if_bonding.h
88endif
89
90ifeq ($(SRCARCH),mips)
91header-test- += asm/stat.h
92endif
93
94ifeq ($(SRCARCH),powerpc)
95header-test- += asm/stat.h
96header-test- += linux/bpf_perf_event.h
97endif
98
99ifeq ($(SRCARCH),riscv)
100header-test- += linux/bpf_perf_event.h
101endif
102
103ifeq ($(SRCARCH),sparc)
104header-test- += asm/stat.h
105header-test- += asm/uctx.h
106header-test- += asm/fbio.h
107endif
108
109# asm-generic/*.h is used by asm/*.h, and should not be included directly
110header-test- += asm-generic/%
111
112# The rest are compile-tested
113header-test-y += $(filter-out $(header-test-), \
114			$(patsubst $(obj)/%,%, $(wildcard \
115			$(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h))))
116
117clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*)))
118