Linux Audio

Check our new training course

Loading...
v6.2
 1# SPDX-License-Identifier: GPL-2.0
 2
 3$(obj)/randomize_layout_plugin.so: $(obj)/randomize_layout_seed.h
 4quiet_cmd_create_randomize_layout_seed = SEEDHDR $@
 5cmd_create_randomize_layout_seed = \
 6	SEED=$$(cat $(filter-out FORCE,$^) </dev/null); \
 7	echo '/*' > $@; \
 8	echo ' * This file is automatically generated. Keep it private.' >> $@; \
 9	echo ' * Exposing this value will expose the layout of randomized structures.' >> $@; \
10	echo ' */' >> $@; \
11	echo "const char *randstruct_seed = \"$$SEED\";" >> $@
12$(obj)/randomize_layout_seed.h: $(objtree)/scripts/basic/randstruct.seed FORCE
13	$(call if_changed,create_randomize_layout_seed)
14targets += randomize_layout_seed.h
15
16# Build rules for plugins
17#
18# No extra code is needed for single-file plugins.
19# For multi-file plugins, use *-objs syntax to list the objects.
20#
21# If the plugin foo.so is compiled from foo.c and foo2.c, you can do:
22#
23# foo-objs := foo.o foo2.o
24
25always-y += $(GCC_PLUGIN)
26
27GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
28
29plugin_cxxflags	= -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
30		  -include $(srctree)/include/linux/compiler-version.h \
31		  -DPLUGIN_VERSION=$(call stringify,$(KERNELVERSION)) \
32		  -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
33		  -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \
34		  -ggdb -Wno-narrowing -Wno-unused-variable \
35		  -Wno-format-diag
36
37plugin_ldflags	= -shared
38
39plugin-single	:= $(foreach m, $(GCC_PLUGIN), $(if $($(m:%.so=%-objs)),,$(m)))
40plugin-multi	:= $(filter-out $(plugin-single), $(GCC_PLUGIN))
41plugin-objs	:= $(sort $(foreach m, $(plugin-multi), $($(m:%.so=%-objs))))
42
43targets += $(plugin-single) $(plugin-multi) $(plugin-objs)
44clean-files += *.so
45
46plugin-single	:= $(addprefix $(obj)/, $(plugin-single))
47plugin-multi	:= $(addprefix $(obj)/, $(plugin-multi))
48plugin-objs	:= $(addprefix $(obj)/, $(plugin-objs))
49
50quiet_cmd_plugin_cxx_so_c = HOSTCXX $@
51      cmd_plugin_cxx_so_c = $(HOSTCXX) $(plugin_cxxflags) $(plugin_ldflags) -o $@ $<
52
53$(plugin-single): $(obj)/%.so: $(src)/%.c FORCE
54	$(call if_changed_dep,plugin_cxx_so_c)
55
56quiet_cmd_plugin_ld_so_o = HOSTLD  $@
57      cmd_plugin_ld_so_o = $(HOSTCXX) $(plugin_ldflags) -o $@ \
58			   $(addprefix $(obj)/, $($(target-stem)-objs))
59
60$(plugin-multi): FORCE
61	$(call if_changed,plugin_ld_so_o)
62$(foreach m, $(notdir $(plugin-multi)), $(eval $(obj)/$m: $(addprefix $(obj)/, $($(m:%.so=%-objs)))))
63
64quiet_cmd_plugin_cxx_o_c = HOSTCXX $@
65      cmd_plugin_cxx_o_c = $(HOSTCXX) $(plugin_cxxflags) -c -o $@ $<
66
67$(plugin-objs): $(obj)/%.o: $(src)/%.c FORCE
68	$(call if_changed_dep,plugin_cxx_o_c)
v5.14.15
 1# SPDX-License-Identifier: GPL-2.0
 2
 3$(obj)/randomize_layout_plugin.so: $(objtree)/$(obj)/randomize_layout_seed.h
 4quiet_cmd_create_randomize_layout_seed = GENSEED $@
 5cmd_create_randomize_layout_seed = \
 6  $(CONFIG_SHELL) $(srctree)/$(src)/gen-random-seed.sh $@ $(objtree)/include/generated/randomize_layout_hash.h
 7$(objtree)/$(obj)/randomize_layout_seed.h: FORCE
 
 
 
 
 
 8	$(call if_changed,create_randomize_layout_seed)
 9targets += randomize_layout_seed.h randomize_layout_hash.h
10
11# Build rules for plugins
12#
13# No extra code is needed for single-file plugins.
14# For multi-file plugins, use *-objs syntax to list the objects.
15#
16# If the plugin foo.so is compiled from foo.c and foo2.c, you can do:
17#
18# foo-objs := foo.o foo2.o
19
20always-y += $(GCC_PLUGIN)
21
22GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
23
24plugin_cxxflags	= -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
25		  -include $(srctree)/include/linux/compiler-version.h \
26		   -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
27		   -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \
28		   -ggdb -Wno-narrowing -Wno-unused-variable \
29		   -Wno-format-diag
 
30
31plugin_ldflags	= -shared
32
33plugin-single	:= $(foreach m, $(GCC_PLUGIN), $(if $($(m:%.so=%-objs)),,$(m)))
34plugin-multi	:= $(filter-out $(plugin-single), $(GCC_PLUGIN))
35plugin-objs	:= $(sort $(foreach m, $(plugin-multi), $($(m:%.so=%-objs))))
36
37targets += $(plugin-single) $(plugin-multi) $(plugin-objs)
38clean-files += *.so
39
40plugin-single	:= $(addprefix $(obj)/, $(plugin-single))
41plugin-multi	:= $(addprefix $(obj)/, $(plugin-multi))
42plugin-objs	:= $(addprefix $(obj)/, $(plugin-objs))
43
44quiet_cmd_plugin_cxx_so_c = HOSTCXX $@
45      cmd_plugin_cxx_so_c = $(HOSTCXX) $(plugin_cxxflags) $(plugin_ldflags) -o $@ $<
46
47$(plugin-single): $(obj)/%.so: $(src)/%.c FORCE
48	$(call if_changed_dep,plugin_cxx_so_c)
49
50quiet_cmd_plugin_ld_so_o = HOSTLD  $@
51      cmd_plugin_ld_so_o = $(HOSTCXX) $(plugin_ldflags) -o $@ \
52			   $(addprefix $(obj)/, $($(target-stem)-objs))
53
54$(plugin-multi): FORCE
55	$(call if_changed,plugin_ld_so_o)
56$(foreach m, $(notdir $(plugin-multi)), $(eval $(obj)/$m: $(addprefix $(obj)/, $($(m:%.so=%-objs)))))
57
58quiet_cmd_plugin_cxx_o_c = HOSTCXX $@
59      cmd_plugin_cxx_o_c = $(HOSTCXX) $(plugin_cxxflags) -c -o $@ $<
60
61$(plugin-objs): $(obj)/%.o: $(src)/%.c FORCE
62	$(call if_changed_dep,plugin_cxx_o_c)