xref: /linux/scripts/gcc-plugins/Makefile (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
26b90bd4bSEmese RevfyGCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
36b90bd4bSEmese Revfy
46b90bd4bSEmese Revfyifeq ($(PLUGINCC),$(HOSTCC))
56b90bd4bSEmese Revfy  HOSTLIBS := hostlibs
66b90bd4bSEmese Revfy  HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb
76b90bd4bSEmese Revfy  export HOST_EXTRACFLAGS
86b90bd4bSEmese Revfyelse
96b90bd4bSEmese Revfy  HOSTLIBS := hostcxxlibs
106b90bd4bSEmese Revfy  HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
116b90bd4bSEmese Revfy  HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
126b90bd4bSEmese Revfy  HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
136b90bd4bSEmese Revfy  export HOST_EXTRACXXFLAGS
146b90bd4bSEmese Revfyendif
156b90bd4bSEmese Revfy
16543c37cbSEmese Revfyifneq ($(CFLAGS_KCOV), $(SANCOV_PLUGIN))
17543c37cbSEmese Revfy  GCC_PLUGIN := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGIN))
18543c37cbSEmese Revfyendif
19543c37cbSEmese Revfy
20caefd8c9SEmese Revfyexport HOSTLIBS
21caefd8c9SEmese Revfy
22313dd1b6SKees Cook$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
23313dd1b6SKees Cookquiet_cmd_create_randomize_layout_seed = GENSEED $@
24313dd1b6SKees Cookcmd_create_randomize_layout_seed = \
25313dd1b6SKees Cook  $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h
26313dd1b6SKees Cook$(objtree)/$(obj)/randomize_layout_seed.h: FORCE
27313dd1b6SKees Cook	$(call if_changed,create_randomize_layout_seed)
28313dd1b6SKees Cooktargets = randomize_layout_seed.h randomize_layout_hash.h
29313dd1b6SKees Cook
30caefd8c9SEmese Revfy$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
316b90bd4bSEmese Revfyalways := $($(HOSTLIBS)-y)
326b90bd4bSEmese Revfy
337040c83bSEmese Revfy$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
34543c37cbSEmese Revfy
35caefd8c9SEmese Revfysubdir-y := $(GCC_PLUGIN_SUBDIR)
36caefd8c9SEmese Revfysubdir-  += $(GCC_PLUGIN_SUBDIR)
37caefd8c9SEmese Revfy
386b90bd4bSEmese Revfyclean-files += *.so
39