| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 | UAPI_CFLAGS := -std=c90 -Werror=implicit-function-declaration
|
| 10 | UAPI_ARCH := $(or $(HEADER_ARCH),$(SRCARCH))
|
| 11 |
|
| 12 | override c_flags = $(KBUILD_USERCFLAGS) $(UAPI_CFLAGS) -Wp,-MMD,$(depfile)
|
| 13 | cxx_flags = $(filter-out -Wmissing-prototypes -Wstrict-prototypes -std=%, $(KBUILD_USERCFLAGS)) -std=c++98
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 | no-header-test += asm/ucontext.h
|
| 22 | no-header-test += drm/vmwgfx_drm.h
|
| 23 | no-header-test += linux/am437x-vpfe.h
|
| 24 | no-header-test += linux/coda.h
|
| 25 | no-header-test += linux/cyclades.h
|
| 26 | no-header-test += linux/errqueue.h
|
| 27 | no-header-test += linux/hdlc/ioctl.h
|
| 28 | no-header-test += linux/ivtv.h
|
| 29 | no-header-test += linux/matroxfb.h
|
| 30 | no-header-test += linux/omap3isp.h
|
| 31 | no-header-test += linux/omapfb.h
|
| 32 | no-header-test += linux/patchkey.h
|
| 33 | no-header-test += linux/phonet.h
|
| 34 | no-header-test += linux/sctp.h
|
| 35 | no-header-test += linux/sysctl.h
|
| 36 | no-header-test += linux/usb/audio.h
|
| 37 | no-header-test += linux/v4l2-mediabus.h
|
| 38 | no-header-test += linux/v4l2-subdev.h
|
| 39 | no-header-test += linux/videodev2.h
|
| 40 | no-header-test += linux/vm_sockets.h
|
| 41 | no-header-test += sound/asequencer.h
|
| 42 | no-header-test += sound/asoc.h
|
| 43 | no-header-test += sound/asound.h
|
| 44 | no-header-test += sound/compress_offload.h
|
| 45 | no-header-test += sound/emu10k1.h
|
| 46 | no-header-test += sound/sfnt_info.h
|
| 47 | no-header-test += xen/evtchn.h
|
| 48 | no-header-test += xen/gntdev.h
|
| 49 | no-header-test += xen/privcmd.h
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 | ifneq ($(filter arc openrisc xtensa nios2, $(UAPI_ARCH)),)
|
| 54 | no-header-test += linux/bpf_perf_event.h
|
| 55 | endif
|
| 56 |
|
| 57 | ifeq ($(UAPI_ARCH),sparc)
|
| 58 | no-header-test += asm/uctx.h
|
| 59 | no-header-test += asm/fbio.h
|
| 60 | endif
|
| 61 |
|
| 62 |
|
| 63 | no-header-test += asm-generic/%
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 | no-header-test-cxx += linux/auto_dev-ioctl.h
|
| 72 | no-header-test-cxx += linux/map_to_14segment.h
|
| 73 | no-header-test-cxx += linux/map_to_7segment.h
|
| 74 | no-header-test-cxx += linux/netfilter/xt_sctp.h
|
| 75 | no-header-test-cxx += linux/target_core_user.h
|
| 76 | no-header-test-cxx += linux/vhost.h
|
| 77 | no-header-test-cxx += linux/vhost_types.h
|
| 78 | no-header-test-cxx += linux/virtio_net.h
|
| 79 | no-header-test-cxx += linux/virtio_ring.h
|
| 80 | no-header-test-cxx += scsi/fc/fc_els.h
|
| 81 |
|
| 82 | ifeq ($(UAPI_ARCH),x86)
|
| 83 | no-header-test-cxx += asm/elf.h
|
| 84 | endif
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 | uses-libc += linux/a.out.h
|
| 93 | uses-libc += linux/atmbr2684.h
|
| 94 | uses-libc += linux/auto_dev-ioctl.h
|
| 95 | uses-libc += linux/auto_fs.h
|
| 96 | uses-libc += linux/auto_fs4.h
|
| 97 | uses-libc += linux/btrfs_tree.h
|
| 98 | uses-libc += linux/cec-funcs.h
|
| 99 | uses-libc += linux/cec.h
|
| 100 | uses-libc += linux/dvb/dmx.h
|
| 101 | uses-libc += linux/dvb/video.h
|
| 102 | uses-libc += linux/ethtool.h
|
| 103 | uses-libc += linux/ethtool_netlink.h
|
| 104 | uses-libc += linux/fuse.h
|
| 105 | uses-libc += linux/gsmmux.h
|
| 106 | uses-libc += linux/icmp.h
|
| 107 | uses-libc += linux/idxd.h
|
| 108 | uses-libc += linux/if.h
|
| 109 | uses-libc += linux/if_arp.h
|
| 110 | uses-libc += linux/if_bonding.h
|
| 111 | uses-libc += linux/if_pppox.h
|
| 112 | uses-libc += linux/if_tunnel.h
|
| 113 | uses-libc += linux/input.h
|
| 114 | uses-libc += linux/ip6_tunnel.h
|
| 115 | uses-libc += linux/joystick.h
|
| 116 | uses-libc += linux/llc.h
|
| 117 | uses-libc += linux/mctp.h
|
| 118 | uses-libc += linux/mdio.h
|
| 119 | uses-libc += linux/mii.h
|
| 120 | uses-libc += linux/mptcp.h
|
| 121 | uses-libc += linux/netdevice.h
|
| 122 | uses-libc += linux/netfilter/xt_RATEEST.h
|
| 123 | uses-libc += linux/netfilter/xt_hashlimit.h
|
| 124 | uses-libc += linux/netfilter/xt_physdev.h
|
| 125 | uses-libc += linux/netfilter/xt_rateest.h
|
| 126 | uses-libc += linux/netfilter_arp/arp_tables.h
|
| 127 | uses-libc += linux/netfilter_arp/arpt_mangle.h
|
| 128 | uses-libc += linux/netfilter_bridge.h
|
| 129 | uses-libc += linux/netfilter_bridge/ebtables.h
|
| 130 | uses-libc += linux/netfilter_ipv4.h
|
| 131 | uses-libc += linux/netfilter_ipv4/ip_tables.h
|
| 132 | uses-libc += linux/netfilter_ipv6.h
|
| 133 | uses-libc += linux/netfilter_ipv6/ip6_tables.h
|
| 134 | uses-libc += linux/route.h
|
| 135 | uses-libc += linux/shm.h
|
| 136 | uses-libc += linux/soundcard.h
|
| 137 | uses-libc += linux/string.h
|
| 138 | uses-libc += linux/tipc_config.h
|
| 139 | uses-libc += linux/uhid.h
|
| 140 | uses-libc += linux/uinput.h
|
| 141 | uses-libc += linux/vhost.h
|
| 142 | uses-libc += linux/vhost_types.h
|
| 143 | uses-libc += linux/virtio_ring.h
|
| 144 | uses-libc += linux/wireless.h
|
| 145 | uses-libc += regulator/regulator.h
|
| 146 | uses-libc += scsi/fc/fc_els.h
|
| 147 |
|
| 148 | ifeq ($(UAPI_ARCH),hexagon)
|
| 149 | uses-libc += asm/sigcontext.h
|
| 150 | endif
|
| 151 |
|
| 152 | ifeq ($(UAPI_ARCH),nios2)
|
| 153 | uses-libc += asm/ptrace.h
|
| 154 | endif
|
| 155 |
|
| 156 | ifeq ($(UAPI_ARCH),s390)
|
| 157 | uses-libc += asm/chpid.h
|
| 158 | uses-libc += asm/chsc.h
|
| 159 | endif
|
| 160 |
|
| 161 | always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/dev/null))
|
| 162 |
|
| 163 |
|
| 164 | cc-can-compile-cxx := $(call try-run,$(CC) $(CLANG_FLAGS) -c -x c++ /dev/null -o "$$TMP", 1)
|
| 165 |
|
| 166 | target-libc = $(filter $(uses-libc), $*.h)
|
| 167 | target-can-compile = $(filter-out $(no-header-test), $*.h)
|
| 168 | target-can-compile-cxx = $(and $(cc-can-compile-cxx), $(target-can-compile), $(filter-out $(no-header-test-cxx), $*.h))
|
| 169 |
|
| 170 | hdrtest-flags = -fsyntax-only -Werror \
|
| 171 | -nostdinc -I $(obj) $(if $(target-libc), -I $(srctree)/usr/dummy-include)
|
| 172 |
|
| 173 |
|
| 174 | quiet_cmd_hdrtest = HDRTEST $<
|
| 175 | cmd_hdrtest = \
|
| 176 | $(CC) $(c_flags) $(hdrtest-flags) -x c /dev/null \
|
| 177 | $(if $(target-can-compile), -include $< -include $<); \
|
| 178 | $(if $(target-can-compile-cxx), \
|
| 179 | $(CC) $(cxx_flags) $(hdrtest-flags) -x c++ /dev/null -include $<;) \
|
| 180 | $(PERL) $(src)/headers_check.pl $(obj) $<; \
|
| 181 | touch $@
|
| 182 |
|
| 183 | $(obj)/%.hdrtest: $(obj)/%.h $(src)/headers_check.pl FORCE
|
| 184 | $(call if_changed_dep,hdrtest)
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 | clean-files += $(filter-out Makefile headers_check.pl, $(notdir $(wildcard $(obj)/*)))
|