aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /scripts/Makefile.build
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build85
1 files changed, 78 insertions, 7 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a1a5cf95a68d..a0fd5029cfe7 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -49,6 +49,56 @@ ifeq ($(KBUILD_NOPEDANTIC),)
49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) 49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
50 endif 50 endif
51endif 51endif
52
53#
54# make W=... settings
55#
56# W=1 - warnings that may be relevant and does not occur too often
57# W=2 - warnings that occur quite often but may still be relevant
58# W=3 - the more obscure warnings, can most likely be ignored
59#
60# $(call cc-option, -W...) handles gcc -W.. options which
61# are not supported by all versions of the compiler
62ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
63warning- := $(empty)
64
65warning-1 := -Wextra -Wunused -Wno-unused-parameter
66warning-1 += -Wmissing-declarations
67warning-1 += -Wmissing-format-attribute
68warning-1 += -Wmissing-prototypes
69warning-1 += -Wold-style-definition
70warning-1 += $(call cc-option, -Wmissing-include-dirs)
71warning-1 += $(call cc-option, -Wunused-but-set-variable)
72
73warning-2 := -Waggregate-return
74warning-2 += -Wcast-align
75warning-2 += -Wdisabled-optimization
76warning-2 += -Wnested-externs
77warning-2 += -Wshadow
78warning-2 += $(call cc-option, -Wlogical-op)
79
80warning-3 := -Wbad-function-cast
81warning-3 += -Wcast-qual
82warning-3 += -Wconversion
83warning-3 += -Wpacked
84warning-3 += -Wpadded
85warning-3 += -Wpointer-arith
86warning-3 += -Wredundant-decls
87warning-3 += -Wswitch-default
88warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
89warning-3 += $(call cc-option, -Wvla)
90
91warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
92warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
93warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
94
95ifeq ("$(strip $(warning))","")
96 $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
97endif
98
99KBUILD_CFLAGS += $(warning)
100endif
101
52include scripts/Makefile.lib 102include scripts/Makefile.lib
53 103
54ifdef host-progs 104ifdef host-progs
@@ -209,11 +259,33 @@ cmd_modversions = \
209endif 259endif
210 260
211ifdef CONFIG_FTRACE_MCOUNT_RECORD 261ifdef CONFIG_FTRACE_MCOUNT_RECORD
212cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ 262ifdef BUILD_C_RECORDMCOUNT
263ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
264 RECORDMCOUNT_FLAGS = -w
265endif
266# Due to recursion, we must skip empty.o.
267# The empty.o file is created in the make process in order to determine
268# the target endianness and word size. It is made before all other C
269# files, including recordmcount.
270sub_cmd_record_mcount = \
271 if [ $(@) != "scripts/mod/empty.o" ]; then \
272 $(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \
273 fi;
274recordmcount_source := $(srctree)/scripts/recordmcount.c \
275 $(srctree)/scripts/recordmcount.h
276else
277sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
213 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ 278 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
214 "$(if $(CONFIG_64BIT),64,32)" \ 279 "$(if $(CONFIG_64BIT),64,32)" \
215 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ 280 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
281 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
216 "$(if $(part-of-module),1,0)" "$(@)"; 282 "$(if $(part-of-module),1,0)" "$(@)";
283recordmcount_source := $(srctree)/scripts/recordmcount.pl
284endif
285cmd_record_mcount = \
286 if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \
287 $(sub_cmd_record_mcount) \
288 fi;
217endif 289endif
218 290
219define rule_cc_o_c 291define rule_cc_o_c
@@ -229,13 +301,13 @@ define rule_cc_o_c
229endef 301endef
230 302
231# Built-in and composite module parts 303# Built-in and composite module parts
232$(obj)/%.o: $(src)/%.c FORCE 304$(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
233 $(call cmd,force_checksrc) 305 $(call cmd,force_checksrc)
234 $(call if_changed_rule,cc_o_c) 306 $(call if_changed_rule,cc_o_c)
235 307
236# Single-part modules are special since we need to mark them in $(MODVERDIR) 308# Single-part modules are special since we need to mark them in $(MODVERDIR)
237 309
238$(single-used-m): $(obj)/%.o: $(src)/%.c FORCE 310$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
239 $(call cmd,force_checksrc) 311 $(call cmd,force_checksrc)
240 $(call if_changed_rule,cc_o_c) 312 $(call if_changed_rule,cc_o_c)
241 @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) 313 @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
@@ -295,7 +367,7 @@ quiet_cmd_link_o_target = LD $@
295cmd_link_o_target = $(if $(strip $(obj-y)),\ 367cmd_link_o_target = $(if $(strip $(obj-y)),\
296 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \ 368 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
297 $(cmd_secanalysis),\ 369 $(cmd_secanalysis),\
298 rm -f $@; $(AR) rcs $@) 370 rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)
299 371
300$(builtin-target): $(obj-y) FORCE 372$(builtin-target): $(obj-y) FORCE
301 $(call if_changed,link_o_target) 373 $(call if_changed,link_o_target)
@@ -321,7 +393,7 @@ $(modorder-target): $(subdir-ym) FORCE
321# 393#
322ifdef lib-target 394ifdef lib-target
323quiet_cmd_link_l_target = AR $@ 395quiet_cmd_link_l_target = AR $@
324cmd_link_l_target = rm -f $@; $(AR) rcs $@ $(lib-y) 396cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
325 397
326$(lib-target): $(lib-y) FORCE 398$(lib-target): $(lib-y) FORCE
327 $(call if_changed,link_l_target) 399 $(call if_changed,link_l_target)
@@ -387,7 +459,6 @@ ifneq ($(cmd_files),)
387 include $(cmd_files) 459 include $(cmd_files)
388endif 460endif
389 461
390
391# Declare the contents of the .PHONY variable as phony. We keep that 462# Declare the contents of the .PHONY variable as phony. We keep that
392# information in a variable se we can use it in if_changed and friends. 463# information in a variable se we can use it in if_changed and friends.
393 464