xref: /linux/scripts/gcc-plugins/Makefile (revision 313dd1b629219db50cad532dba6a3b3b22ffe622)
16b90bd4bSEmese RevfyGCC_PLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
26b90bd4bSEmese Revfy
36b90bd4bSEmese Revfyifeq ($(PLUGINCC),$(HOSTCC))
46b90bd4bSEmese Revfy  HOSTLIBS := hostlibs
56b90bd4bSEmese Revfy  HOST_EXTRACFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu99 -ggdb
66b90bd4bSEmese Revfy  export HOST_EXTRACFLAGS
76b90bd4bSEmese Revfyelse
86b90bd4bSEmese Revfy  HOSTLIBS := hostcxxlibs
96b90bd4bSEmese Revfy  HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
106b90bd4bSEmese Revfy  HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
116b90bd4bSEmese Revfy  HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
126b90bd4bSEmese Revfy  export HOST_EXTRACXXFLAGS
136b90bd4bSEmese Revfyendif
146b90bd4bSEmese Revfy
15543c37cbSEmese Revfyifneq ($(CFLAGS_KCOV), $(SANCOV_PLUGIN))
16543c37cbSEmese Revfy  GCC_PLUGIN := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGIN))
17543c37cbSEmese Revfyendif
18543c37cbSEmese Revfy
19caefd8c9SEmese Revfyexport HOSTLIBS
20caefd8c9SEmese Revfy
21*313dd1b6SKees Cook$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
22*313dd1b6SKees Cookquiet_cmd_create_randomize_layout_seed = GENSEED $@
23*313dd1b6SKees Cookcmd_create_randomize_layout_seed = \
24*313dd1b6SKees Cook  $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h
25*313dd1b6SKees Cook$(objtree)/$(obj)/randomize_layout_seed.h: FORCE
26*313dd1b6SKees Cook	$(call if_changed,create_randomize_layout_seed)
27*313dd1b6SKees Cooktargets = randomize_layout_seed.h randomize_layout_hash.h
28*313dd1b6SKees Cook
29caefd8c9SEmese Revfy$(HOSTLIBS)-y := $(foreach p,$(GCC_PLUGIN),$(if $(findstring /,$(p)),,$(p)))
306b90bd4bSEmese Revfyalways := $($(HOSTLIBS)-y)
316b90bd4bSEmese Revfy
327040c83bSEmese Revfy$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
33543c37cbSEmese Revfy
34caefd8c9SEmese Revfysubdir-y := $(GCC_PLUGIN_SUBDIR)
35caefd8c9SEmese Revfysubdir-  += $(GCC_PLUGIN_SUBDIR)
36caefd8c9SEmese Revfy
376b90bd4bSEmese Revfyclean-files += *.so
38