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_bridge/ebtables.h 42header-test- += linux/netfilter_ipv4/ipt_LOG.h 43header-test- += linux/netfilter_ipv6/ip6t_LOG.h 44header-test- += linux/nfc.h 45header-test- += linux/omap3isp.h 46header-test- += linux/omapfb.h 47header-test- += linux/patchkey.h 48header-test- += linux/phonet.h 49header-test- += linux/reiserfs_xattr.h 50header-test- += linux/scc.h 51header-test- += linux/sctp.h 52header-test- += linux/signal.h 53header-test- += linux/sysctl.h 54header-test- += linux/usb/audio.h 55header-test- += linux/v4l2-mediabus.h 56header-test- += linux/v4l2-subdev.h 57header-test- += linux/videodev2.h 58header-test- += linux/vm_sockets.h 59header-test- += scsi/scsi_bsg_fc.h 60header-test- += scsi/scsi_netlink.h 61header-test- += scsi/scsi_netlink_fc.h 62header-test- += sound/asequencer.h 63header-test- += sound/asoc.h 64header-test- += sound/asound.h 65header-test- += sound/compress_offload.h 66header-test- += sound/emu10k1.h 67header-test- += sound/sfnt_info.h 68header-test- += sound/sof/eq.h 69header-test- += sound/sof/fw.h 70header-test- += sound/sof/header.h 71header-test- += sound/sof/manifest.h 72header-test- += sound/sof/trace.h 73header-test- += xen/evtchn.h 74header-test- += xen/gntdev.h 75header-test- += xen/privcmd.h 76 77# More headers are broken in some architectures 78 79ifeq ($(SRCARCH),arc) 80header-test- += linux/bpf_perf_event.h 81endif 82 83ifeq ($(SRCARCH),ia64) 84header-test- += asm/setup.h 85header-test- += asm/sigcontext.h 86header-test- += asm/perfmon.h 87header-test- += asm/perfmon_default_smpl.h 88header-test- += linux/if_bonding.h 89endif 90 91ifeq ($(SRCARCH),mips) 92header-test- += asm/stat.h 93endif 94 95ifeq ($(SRCARCH),powerpc) 96header-test- += asm/stat.h 97header-test- += linux/bpf_perf_event.h 98endif 99 100ifeq ($(SRCARCH),riscv) 101header-test- += linux/bpf_perf_event.h 102endif 103 104ifeq ($(SRCARCH),s390) 105header-test- += asm/zcrypt.h 106endif 107 108ifeq ($(SRCARCH),sparc) 109header-test- += asm/stat.h 110header-test- += asm/uctx.h 111header-test- += asm/fbio.h 112endif 113 114# asm-generic/*.h is used by asm/*.h, and should not be included directly 115header-test- += asm-generic/% 116 117# The rest are compile-tested 118header-test-y += $(filter-out $(header-test-), \ 119 $(patsubst $(obj)/%,%, $(wildcard \ 120 $(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h)))) 121 122# For GNU Make <= 4.2.1, $(wildcard $(obj)/*/) matches to not only directories 123# but also regular files. Use $(filter %/, ...) just in case. 124clean-dirs += $(patsubst $(obj)/%/,%,$(filter %/, $(wildcard $(obj)/*/))) 125