| 1 | VERSION = 4
|
| 2 | PATCHLEVEL = 10
|
| 3 | SUBLEVEL = 0
|
| 4 | EXTRAVERSION = -rc3
|
| 5 | NAME = Roaring Lionus
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 | MAKEFLAGS += -rR --include-dir=$(CURDIR)
|
| 17 |
|
| 18 |
|
| 19 | unexport LC_ALL
|
| 20 | LC_COLLATE=C
|
| 21 | LC_NUMERIC=C
|
| 22 | export LC_COLLATE LC_NUMERIC
|
| 23 |
|
| 24 |
|
| 25 | unexport GREP_OPTIONS
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 | ifeq ("$(origin V)", "command line")
|
| 70 | KBUILD_VERBOSE = $(V)
|
| 71 | endif
|
| 72 | ifndef KBUILD_VERBOSE
|
| 73 | KBUILD_VERBOSE = 0
|
| 74 | endif
|
| 75 |
|
| 76 | ifeq ($(KBUILD_VERBOSE),1)
|
| 77 | quiet =
|
| 78 | Q =
|
| 79 | else
|
| 80 | quiet=quiet_
|
| 81 | Q = @
|
| 82 | endif
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 | ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
|
| 88 | ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
|
| 89 | quiet=silent_
|
| 90 | endif
|
| 91 | else
|
| 92 | ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
|
| 93 | quiet=silent_
|
| 94 | endif
|
| 95 | endif
|
| 96 |
|
| 97 | export quiet Q KBUILD_VERBOSE
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 | ifeq ($(KBUILD_SRC),)
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 | ifeq ("$(origin O)", "command line")
|
| 121 | KBUILD_OUTPUT := $(O)
|
| 122 | endif
|
| 123 |
|
| 124 |
|
| 125 | PHONY := _all
|
| 126 | _all:
|
| 127 |
|
| 128 |
|
| 129 | $(CURDIR)/Makefile Makefile: ;
|
| 130 |
|
| 131 | ifneq ($(words $(subst :, ,$(CURDIR))), 1)
|
| 132 | $(error main directory cannot contain spaces nor colons)
|
| 133 | endif
|
| 134 |
|
| 135 | ifneq ($(KBUILD_OUTPUT),)
|
| 136 |
|
| 137 |
|
| 138 | saved-output := $(KBUILD_OUTPUT)
|
| 139 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
|
| 140 | && /bin/pwd)
|
| 141 | $(if $(KBUILD_OUTPUT),, \
|
| 142 | $(error failed to create output directory "$(saved-output)"))
|
| 143 |
|
| 144 | PHONY += $(MAKECMDGOALS) sub-make
|
| 145 |
|
| 146 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
|
| 147 | @:
|
| 148 |
|
| 149 | sub-make:
|
| 150 | $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
|
| 151 | -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
|
| 152 |
|
| 153 |
|
| 154 | skip-makefile := 1
|
| 155 | endif
|
| 156 | endif
|
| 157 |
|
| 158 |
|
| 159 | ifeq ($(skip-makefile),)
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 | MAKEFLAGS += --no-print-directory
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 | ifeq ("$(origin C)", "command line")
|
| 177 | KBUILD_CHECKSRC = $(C)
|
| 178 | endif
|
| 179 | ifndef KBUILD_CHECKSRC
|
| 180 | KBUILD_CHECKSRC = 0
|
| 181 | endif
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 | ifdef SUBDIRS
|
| 187 | KBUILD_EXTMOD ?= $(SUBDIRS)
|
| 188 | endif
|
| 189 |
|
| 190 | ifeq ("$(origin M)", "command line")
|
| 191 | KBUILD_EXTMOD := $(M)
|
| 192 | endif
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 | PHONY += all
|
| 197 | ifeq ($(KBUILD_EXTMOD),)
|
| 198 | _all: all
|
| 199 | else
|
| 200 | _all: modules
|
| 201 | endif
|
| 202 |
|
| 203 | ifeq ($(KBUILD_SRC),)
|
| 204 |
|
| 205 | srctree := .
|
| 206 | else
|
| 207 | ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
|
| 208 |
|
| 209 | srctree := ..
|
| 210 | else
|
| 211 | srctree := $(KBUILD_SRC)
|
| 212 | endif
|
| 213 | endif
|
| 214 | objtree := .
|
| 215 | src := $(srctree)
|
| 216 | obj := $(objtree)
|
| 217 |
|
| 218 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
|
| 219 |
|
| 220 | export srctree objtree VPATH
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 | SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
|
| 229 | -e s/sun4u/sparc64/ \
|
| 230 | -e s/arm.*/arm/ -e s/sa110/arm/ \
|
| 231 | -e s/s390x/s390/ -e s/parisc64/parisc/ \
|
| 232 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
|
| 233 | -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 | ARCH ?= $(SUBARCH)
|
| 256 | CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
|
| 257 |
|
| 258 |
|
| 259 | UTS_MACHINE := $(ARCH)
|
| 260 | SRCARCH := $(ARCH)
|
| 261 |
|
| 262 |
|
| 263 | ifeq ($(ARCH),i386)
|
| 264 | SRCARCH := x86
|
| 265 | endif
|
| 266 | ifeq ($(ARCH),x86_64)
|
| 267 | SRCARCH := x86
|
| 268 | endif
|
| 269 |
|
| 270 |
|
| 271 | ifeq ($(ARCH),sparc32)
|
| 272 | SRCARCH := sparc
|
| 273 | endif
|
| 274 | ifeq ($(ARCH),sparc64)
|
| 275 | SRCARCH := sparc
|
| 276 | endif
|
| 277 |
|
| 278 |
|
| 279 | ifeq ($(ARCH),sh64)
|
| 280 | SRCARCH := sh
|
| 281 | endif
|
| 282 |
|
| 283 |
|
| 284 | ifeq ($(ARCH),tilepro)
|
| 285 | SRCARCH := tile
|
| 286 | endif
|
| 287 | ifeq ($(ARCH),tilegx)
|
| 288 | SRCARCH := tile
|
| 289 | endif
|
| 290 |
|
| 291 |
|
| 292 | hdr-arch := $(SRCARCH)
|
| 293 |
|
| 294 | KCONFIG_CONFIG ?= .config
|
| 295 | export KCONFIG_CONFIG
|
| 296 |
|
| 297 |
|
| 298 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
| 299 | else if [ -x /bin/bash ]; then echo /bin/bash; \
|
| 300 | else echo sh; fi ; fi)
|
| 301 |
|
| 302 | HOSTCC = gcc
|
| 303 | HOSTCXX = g++
|
| 304 | HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
|
| 305 | HOSTCXXFLAGS = -O2
|
| 306 |
|
| 307 | ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
|
| 308 | HOSTCFLAGS += -Wno-unused-value -Wno-unused-parameter \
|
| 309 | -Wno-missing-field-initializers -fno-delete-null-pointer-checks
|
| 310 | endif
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 | KBUILD_MODULES :=
|
| 316 | KBUILD_BUILTIN := 1
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 | ifeq ($(MAKECMDGOALS),modules)
|
| 324 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
|
| 325 | endif
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 | ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
|
| 332 | KBUILD_MODULES := 1
|
| 333 | endif
|
| 334 |
|
| 335 | ifeq ($(MAKECMDGOALS),)
|
| 336 | KBUILD_MODULES := 1
|
| 337 | endif
|
| 338 |
|
| 339 | export KBUILD_MODULES KBUILD_BUILTIN
|
| 340 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
|
| 341 |
|
| 342 |
|
| 343 | scripts/Kbuild.include: ;
|
| 344 | include scripts/Kbuild.include
|
| 345 |
|
| 346 |
|
| 347 | AS = $(CROSS_COMPILE)as
|
| 348 | LD = $(CROSS_COMPILE)ld
|
| 349 | CC = $(CROSS_COMPILE)gcc
|
| 350 | CPP = $(CC) -E
|
| 351 | AR = $(CROSS_COMPILE)ar
|
| 352 | NM = $(CROSS_COMPILE)nm
|
| 353 | STRIP = $(CROSS_COMPILE)strip
|
| 354 | OBJCOPY = $(CROSS_COMPILE)objcopy
|
| 355 | OBJDUMP = $(CROSS_COMPILE)objdump
|
| 356 | AWK = awk
|
| 357 | GENKSYMS = scripts/genksyms/genksyms
|
| 358 | INSTALLKERNEL := installkernel
|
| 359 | DEPMOD = /sbin/depmod
|
| 360 | PERL = perl
|
| 361 | PYTHON = python
|
| 362 | CHECK = sparse
|
| 363 |
|
| 364 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
|
| 365 | -Wbitwise -Wno-return-void $(CF)
|
| 366 | NOSTDINC_FLAGS =
|
| 367 | CFLAGS_MODULE =
|
| 368 | AFLAGS_MODULE =
|
| 369 | LDFLAGS_MODULE =
|
| 370 | CFLAGS_KERNEL =
|
| 371 | AFLAGS_KERNEL =
|
| 372 | LDFLAGS_vmlinux =
|
| 373 | CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized
|
| 374 | CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,)
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 | USERINCLUDE := \
|
| 379 | -I$(srctree)/arch/$(hdr-arch)/include/uapi \
|
| 380 | -I$(objtree)/arch/$(hdr-arch)/include/generated/uapi \
|
| 381 | -I$(srctree)/include/uapi \
|
| 382 | -I$(objtree)/include/generated/uapi \
|
| 383 | -include $(srctree)/include/linux/kconfig.h
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 | LINUXINCLUDE := \
|
| 388 | -I$(srctree)/arch/$(hdr-arch)/include \
|
| 389 | -I$(objtree)/arch/$(hdr-arch)/include/generated/uapi \
|
| 390 | -I$(objtree)/arch/$(hdr-arch)/include/generated \
|
| 391 | $(if $(KBUILD_SRC), -I$(srctree)/include) \
|
| 392 | -I$(objtree)/include
|
| 393 |
|
| 394 | LINUXINCLUDE += $(filter-out $(LINUXINCLUDE),$(USERINCLUDE))
|
| 395 |
|
| 396 | KBUILD_CPPFLAGS := -D__KERNEL__
|
| 397 |
|
| 398 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
| 399 | -fno-strict-aliasing -fno-common \
|
| 400 | -Werror-implicit-function-declaration \
|
| 401 | -Wno-format-security \
|
| 402 | -std=gnu89 $(call cc-option,-fno-PIE)
|
| 403 |
|
| 404 |
|
| 405 | KBUILD_AFLAGS_KERNEL :=
|
| 406 | KBUILD_CFLAGS_KERNEL :=
|
| 407 | KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-fno-PIE)
|
| 408 | KBUILD_AFLAGS_MODULE := -DMODULE
|
| 409 | KBUILD_CFLAGS_MODULE := -DMODULE
|
| 410 | KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
|
| 411 |
|
| 412 |
|
| 413 | KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
|
| 414 | KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
|
| 415 |
|
| 416 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
|
| 417 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
|
| 418 | export CPP AR NM STRIP OBJCOPY OBJDUMP
|
| 419 | export MAKE AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE
|
| 420 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
|
| 421 |
|
| 422 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
|
| 423 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KCOV CFLAGS_KASAN CFLAGS_UBSAN
|
| 424 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
|
| 425 | export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
|
| 426 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
|
| 427 | export KBUILD_ARFLAGS
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 | export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
|
| 437 | -name CVS -o -name .pc -o -name .hg -o -name .git \) \
|
| 438 | -prune -o
|
| 439 | export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
|
| 440 | --exclude CVS --exclude .pc --exclude .hg --exclude .git
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 | PHONY += scripts_basic
|
| 447 | scripts_basic:
|
| 448 | $(Q)$(MAKE) $(build)=scripts/basic
|
| 449 | $(Q)rm -f .tmp_quiet_recordmcount
|
| 450 |
|
| 451 |
|
| 452 | scripts/basic/%: scripts_basic ;
|
| 453 |
|
| 454 | PHONY += outputmakefile
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 | outputmakefile:
|
| 459 | ifneq ($(KBUILD_SRC),)
|
| 460 | $(Q)ln -fsn $(srctree) source
|
| 461 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
|
| 462 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
|
| 463 | endif
|
| 464 |
|
| 465 |
|
| 466 | PHONY += asm-generic
|
| 467 | asm-generic:
|
| 468 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
| 469 | src=asm obj=arch/$(SRCARCH)/include/generated/asm
|
| 470 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
|
| 471 | src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 | version_h := include/generated/uapi/linux/version.h
|
| 482 | old_version_h := include/linux/version.h
|
| 483 |
|
| 484 | no-dot-config-targets := clean mrproper distclean \
|
| 485 | cscope gtags TAGS tags help% %docs check% coccicheck \
|
| 486 | $(version_h) headers_% archheaders archscripts \
|
| 487 | kernelversion %src-pkg
|
| 488 |
|
| 489 | config-targets := 0
|
| 490 | mixed-targets := 0
|
| 491 | dot-config := 1
|
| 492 |
|
| 493 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
| 494 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
|
| 495 | dot-config := 0
|
| 496 | endif
|
| 497 | endif
|
| 498 |
|
| 499 | ifeq ($(KBUILD_EXTMOD),)
|
| 500 | ifneq ($(filter config %config,$(MAKECMDGOALS)),)
|
| 501 | config-targets := 1
|
| 502 | ifneq ($(words $(MAKECMDGOALS)),1)
|
| 503 | mixed-targets := 1
|
| 504 | endif
|
| 505 | endif
|
| 506 | endif
|
| 507 |
|
| 508 | ifneq ($(filter install,$(MAKECMDGOALS)),)
|
| 509 | ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
|
| 510 | mixed-targets := 1
|
| 511 | endif
|
| 512 | endif
|
| 513 |
|
| 514 | ifeq ($(mixed-targets),1)
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 | PHONY += $(MAKECMDGOALS) __build_one_by_one
|
| 520 |
|
| 521 | $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
|
| 522 | @:
|
| 523 |
|
| 524 | __build_one_by_one:
|
| 525 | $(Q)set -e; \
|
| 526 | for i in $(MAKECMDGOALS); do \
|
| 527 | $(MAKE) -f $(srctree)/Makefile $$i; \
|
| 528 | done
|
| 529 |
|
| 530 | else
|
| 531 | ifeq ($(config-targets),1)
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 | include arch/$(SRCARCH)/Makefile
|
| 540 | export KBUILD_DEFCONFIG KBUILD_KCONFIG
|
| 541 |
|
| 542 | config: scripts_basic outputmakefile FORCE
|
| 543 | $(Q)$(MAKE) $(build)=scripts/kconfig $@
|
| 544 |
|
| 545 | %config: scripts_basic outputmakefile FORCE
|
| 546 | $(Q)$(MAKE) $(build)=scripts/kconfig $@
|
| 547 |
|
| 548 | else
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 | ifeq ($(KBUILD_EXTMOD),)
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 | PHONY += scripts
|
| 558 | scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \
|
| 559 | asm-generic gcc-plugins
|
| 560 | $(Q)$(MAKE) $(build)=$(@)
|
| 561 |
|
| 562 |
|
| 563 | init-y := init/
|
| 564 | drivers-y := drivers/ sound/ firmware/
|
| 565 | net-y := net/
|
| 566 | libs-y := lib/
|
| 567 | core-y := usr/
|
| 568 | virt-y := virt/
|
| 569 | endif
|
| 570 |
|
| 571 | ifeq ($(dot-config),1)
|
| 572 |
|
| 573 | -include include/config/auto.conf
|
| 574 |
|
| 575 | ifeq ($(KBUILD_EXTMOD),)
|
| 576 |
|
| 577 |
|
| 578 | -include include/config/auto.conf.cmd
|
| 579 |
|
| 580 |
|
| 581 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 | include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
|
| 588 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
|
| 589 | else
|
| 590 |
|
| 591 |
|
| 592 | PHONY += include/config/auto.conf
|
| 593 |
|
| 594 | include/config/auto.conf:
|
| 595 | $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \
|
| 596 | echo >&2; \
|
| 597 | echo >&2 " ERROR: Kernel configuration is invalid."; \
|
| 598 | echo >&2 " include/generated/autoconf.h or $@ are missing.";\
|
| 599 | echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
|
| 600 | echo >&2 ; \
|
| 601 | /bin/false)
|
| 602 |
|
| 603 | endif
|
| 604 |
|
| 605 | else
|
| 606 |
|
| 607 | include/config/auto.conf: ;
|
| 608 | endif
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 | ifdef CONFIG_TRIM_UNUSED_KSYMS
|
| 614 | KBUILD_MODULES := 1
|
| 615 | endif
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 | all: vmlinux
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 | ARCH_CPPFLAGS :=
|
| 626 | ARCH_AFLAGS :=
|
| 627 | ARCH_CFLAGS :=
|
| 628 | include arch/$(SRCARCH)/Makefile
|
| 629 |
|
| 630 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
|
| 631 | KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
|
| 632 |
|
| 633 | ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
|
| 634 | KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,)
|
| 635 | KBUILD_CFLAGS += $(call cc-option,-fdata-sections,)
|
| 636 | endif
|
| 637 |
|
| 638 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
| 639 | KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
|
| 640 | else
|
| 641 | ifdef CONFIG_PROFILE_ALL_BRANCHES
|
| 642 | KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
|
| 643 | else
|
| 644 | KBUILD_CFLAGS += -O2
|
| 645 | endif
|
| 646 | endif
|
| 647 |
|
| 648 | KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
|
| 649 | $(call cc-disable-warning,maybe-uninitialized,))
|
| 650 |
|
| 651 |
|
| 652 | KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
| 653 |
|
| 654 | include scripts/Makefile.gcc-plugins
|
| 655 |
|
| 656 | ifdef CONFIG_READABLE_ASM
|
| 657 |
|
| 658 |
|
| 659 |
|
| 660 |
|
| 661 | KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
|
| 662 | $(call cc-option,-fno-ipa-cp-clone,) \
|
| 663 | $(call cc-option,-fno-partial-inlining)
|
| 664 | endif
|
| 665 |
|
| 666 | ifneq ($(CONFIG_FRAME_WARN),0)
|
| 667 | KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
|
| 668 | endif
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 | ifdef CONFIG_CC_STACKPROTECTOR_REGULAR
|
| 674 | stackp-flag := -fstack-protector
|
| 675 | stackp-name := REGULAR
|
| 676 | else
|
| 677 | ifdef CONFIG_CC_STACKPROTECTOR_STRONG
|
| 678 | stackp-flag := -fstack-protector-strong
|
| 679 | stackp-name := STRONG
|
| 680 | else
|
| 681 |
|
| 682 | stackp-flag := $(call cc-option, -fno-stack-protector)
|
| 683 | endif
|
| 684 | endif
|
| 685 |
|
| 686 | ifdef CONFIG_CC_STACKPROTECTOR
|
| 687 | stackp-path := $(srctree)/scripts/gcc-$(SRCARCH)_$(BITS)-has-stack-protector.sh
|
| 688 | stackp-check := $(wildcard $(stackp-path))
|
| 689 | endif
|
| 690 | KBUILD_CFLAGS += $(stackp-flag)
|
| 691 |
|
| 692 | ifeq ($(cc-name),clang)
|
| 693 | KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
|
| 694 | KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
|
| 695 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
|
| 696 | KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
|
| 697 | KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
|
| 698 |
|
| 699 | KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 | KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
|
| 704 | KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
|
| 705 | else
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
|
| 710 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
|
| 711 | endif
|
| 712 |
|
| 713 | ifdef CONFIG_FRAME_POINTER
|
| 714 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
|
| 715 | else
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
|
| 721 | ifndef CONFIG_FUNCTION_TRACER
|
| 722 | KBUILD_CFLAGS += -fomit-frame-pointer
|
| 723 | endif
|
| 724 | endif
|
| 725 |
|
| 726 | KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
|
| 727 |
|
| 728 | ifdef CONFIG_DEBUG_INFO
|
| 729 | ifdef CONFIG_DEBUG_INFO_SPLIT
|
| 730 | KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g)
|
| 731 | else
|
| 732 | KBUILD_CFLAGS += -g
|
| 733 | endif
|
| 734 | KBUILD_AFLAGS += -Wa,-gdwarf-2
|
| 735 | endif
|
| 736 | ifdef CONFIG_DEBUG_INFO_DWARF4
|
| 737 | KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,)
|
| 738 | endif
|
| 739 |
|
| 740 | ifdef CONFIG_DEBUG_INFO_REDUCED
|
| 741 | KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
|
| 742 | $(call cc-option,-fno-var-tracking)
|
| 743 | endif
|
| 744 |
|
| 745 | ifdef CONFIG_FUNCTION_TRACER
|
| 746 | ifndef CC_FLAGS_FTRACE
|
| 747 | CC_FLAGS_FTRACE := -pg
|
| 748 | endif
|
| 749 | export CC_FLAGS_FTRACE
|
| 750 | ifdef CONFIG_HAVE_FENTRY
|
| 751 | CC_USING_FENTRY := $(call cc-option, -mfentry -DCC_USING_FENTRY)
|
| 752 | endif
|
| 753 | KBUILD_CFLAGS += $(CC_FLAGS_FTRACE) $(CC_USING_FENTRY)
|
| 754 | KBUILD_AFLAGS += $(CC_USING_FENTRY)
|
| 755 | ifdef CONFIG_DYNAMIC_FTRACE
|
| 756 | ifdef CONFIG_HAVE_C_RECORDMCOUNT
|
| 757 | BUILD_C_RECORDMCOUNT := y
|
| 758 | export BUILD_C_RECORDMCOUNT
|
| 759 | endif
|
| 760 | endif
|
| 761 | endif
|
| 762 |
|
| 763 |
|
| 764 | ifdef CONFIG_DEBUG_SECTION_MISMATCH
|
| 765 | KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
|
| 766 | endif
|
| 767 |
|
| 768 |
|
| 769 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
|
| 770 | CHECKFLAGS += $(NOSTDINC_FLAGS)
|
| 771 |
|
| 772 |
|
| 773 | KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
| 774 |
|
| 775 |
|
| 776 | KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
|
| 777 |
|
| 778 |
|
| 779 | KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
|
| 780 |
|
| 781 |
|
| 782 | KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
|
| 783 |
|
| 784 |
|
| 785 | KBUILD_CFLAGS += $(call cc-option,-Werror=implicit-int)
|
| 786 |
|
| 787 |
|
| 788 | KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes)
|
| 789 |
|
| 790 |
|
| 791 | KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
|
| 792 |
|
| 793 |
|
| 794 | KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
|
| 795 |
|
| 796 |
|
| 797 | KBUILD_ARFLAGS := $(call ar-option,D)
|
| 798 |
|
| 799 |
|
| 800 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
|
| 801 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
|
| 802 | KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
|
| 803 | endif
|
| 804 |
|
| 805 | include scripts/Makefile.kasan
|
| 806 | include scripts/Makefile.extrawarn
|
| 807 | include scripts/Makefile.ubsan
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 | KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS)
|
| 812 | KBUILD_AFLAGS += $(ARCH_AFLAGS) $(KAFLAGS)
|
| 813 | KBUILD_CFLAGS += $(ARCH_CFLAGS) $(KCFLAGS)
|
| 814 |
|
| 815 |
|
| 816 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
|
| 817 | $(call cc-ldoption, -Wl$(comma)--build-id,))
|
| 818 | KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
|
| 819 | LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
|
| 820 |
|
| 821 | ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
|
| 822 | LDFLAGS_vmlinux += $(call ld-option, --gc-sections,)
|
| 823 | endif
|
| 824 |
|
| 825 | ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
|
| 826 | LDFLAGS_vmlinux += $(call ld-option, -X,)
|
| 827 | endif
|
| 828 |
|
| 829 |
|
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 | export KBUILD_IMAGE ?= vmlinux
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 | export INSTALL_PATH ?= /boot
|
| 840 |
|
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 | export INSTALL_DTBS_PATH ?= $(INSTALL_PATH)/dtbs/$(KERNELRELEASE)
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
|
| 854 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
|
| 855 | export MODLIB
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 | ifdef INSTALL_MOD_STRIP
|
| 864 | ifeq ($(INSTALL_MOD_STRIP),1)
|
| 865 | mod_strip_cmd = $(STRIP) --strip-debug
|
| 866 | else
|
| 867 | mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP)
|
| 868 | endif # INSTALL_MOD_STRIP=1
|
| 869 | else
|
| 870 | mod_strip_cmd = true
|
| 871 | endif
|
| 872 | export mod_strip_cmd
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 | mod_compress_cmd = true
|
| 879 | ifdef CONFIG_MODULE_COMPRESS
|
| 880 | ifdef CONFIG_MODULE_COMPRESS_GZIP
|
| 881 | mod_compress_cmd = gzip -n -f
|
| 882 | endif
|
| 883 | ifdef CONFIG_MODULE_COMPRESS_XZ
|
| 884 | mod_compress_cmd = xz -f
|
| 885 | endif
|
| 886 | endif
|
| 887 | export mod_compress_cmd
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 | INITRD_COMPRESS-y := gzip
|
| 893 | INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
|
| 894 | INITRD_COMPRESS-$(CONFIG_RD_LZMA) := lzma
|
| 895 | INITRD_COMPRESS-$(CONFIG_RD_XZ) := xz
|
| 896 | INITRD_COMPRESS-$(CONFIG_RD_LZO) := lzo
|
| 897 | INITRD_COMPRESS-$(CONFIG_RD_LZ4) := lz4
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 | ifdef CONFIG_MODULE_SIG_ALL
|
| 903 | $(eval $(call config_filename,MODULE_SIG_KEY))
|
| 904 |
|
| 905 | mod_sign_cmd = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509
|
| 906 | else
|
| 907 | mod_sign_cmd = true
|
| 908 | endif
|
| 909 | export mod_sign_cmd
|
| 910 |
|
| 911 |
|
| 912 | ifeq ($(KBUILD_EXTMOD),)
|
| 913 | core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
|
| 914 |
|
| 915 | vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
|
| 916 | $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
|
| 917 | $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y)))
|
| 918 |
|
| 919 | vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
|
| 920 | $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))
|
| 921 |
|
| 922 | init-y := $(patsubst %/, %/built-in.o, $(init-y))
|
| 923 | core-y := $(patsubst %/, %/built-in.o, $(core-y))
|
| 924 | drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y))
|
| 925 | net-y := $(patsubst %/, %/built-in.o, $(net-y))
|
| 926 | libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
|
| 927 | libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
|
| 928 | libs-y := $(libs-y1) $(libs-y2)
|
| 929 | virt-y := $(patsubst %/, %/built-in.o, $(virt-y))
|
| 930 |
|
| 931 |
|
| 932 | export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
|
| 933 | export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(virt-y)
|
| 934 | export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
|
| 935 | export LDFLAGS_vmlinux
|
| 936 |
|
| 937 | export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
|
| 938 |
|
| 939 | vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN)
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
|
| 944 | PHONY += vmlinux_prereq
|
| 945 | vmlinux_prereq: $(vmlinux-deps) FORCE
|
| 946 | ifdef CONFIG_HEADERS_CHECK
|
| 947 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
|
| 948 | endif
|
| 949 | ifdef CONFIG_GDB_SCRIPTS
|
| 950 | $(Q)ln -fsn `cd $(srctree) && /bin/pwd`/scripts/gdb/vmlinux-gdb.py
|
| 951 | endif
|
| 952 | ifdef CONFIG_TRIM_UNUSED_KSYMS
|
| 953 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
|
| 954 | "$(MAKE) -f $(srctree)/Makefile vmlinux"
|
| 955 | endif
|
| 956 |
|
| 957 |
|
| 958 | include/generated/autoksyms.h: FORCE
|
| 959 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true
|
| 960 |
|
| 961 | ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
|
| 962 |
|
| 963 |
|
| 964 | cmd_link-vmlinux = \
|
| 965 | $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \
|
| 966 | $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
|
| 967 |
|
| 968 | vmlinux: scripts/link-vmlinux.sh vmlinux_prereq $(vmlinux-deps) FORCE
|
| 969 | +$(call if_changed,link-vmlinux)
|
| 970 |
|
| 971 |
|
| 972 | ifdef CONFIG_SAMPLES
|
| 973 | vmlinux-dirs += samples
|
| 974 | endif
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 | $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
|
| 979 |
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
|
| 986 | PHONY += $(vmlinux-dirs)
|
| 987 | $(vmlinux-dirs): prepare scripts
|
| 988 | $(Q)$(MAKE) $(build)=$@
|
| 989 |
|
| 990 | define filechk_kernel.release
|
| 991 | echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
| 992 | endef
|
| 993 |
|
| 994 |
|
| 995 | include/config/kernel.release: include/config/auto.conf FORCE
|
| 996 | $(call filechk,kernel.release)
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
|
| 1005 |
|
| 1006 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
|
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
|
| 1011 | prepare3: include/config/kernel.release
|
| 1012 | ifneq ($(KBUILD_SRC),)
|
| 1013 | @$(kecho) ' Using $(srctree) as source for kernel'
|
| 1014 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
|
| 1015 | echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
|
| 1016 | echo >&2 " in the '$(srctree)' directory.";\
|
| 1017 | /bin/false; \
|
| 1018 | fi;
|
| 1019 | endif
|
| 1020 |
|
| 1021 |
|
| 1022 |
|
| 1023 |
|
| 1024 | prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic
|
| 1025 |
|
| 1026 | prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
|
| 1027 | include/config/auto.conf
|
| 1028 | $(cmd_crmodverdir)
|
| 1029 |
|
| 1030 | archprepare: archheaders archscripts prepare1 scripts_basic
|
| 1031 |
|
| 1032 | prepare0: archprepare gcc-plugins
|
| 1033 | $(Q)$(MAKE) $(build)=.
|
| 1034 |
|
| 1035 |
|
| 1036 | prepare: prepare0 prepare-objtool
|
| 1037 |
|
| 1038 | ifdef CONFIG_STACK_VALIDATION
|
| 1039 | has_libelf := $(call try-run,\
|
| 1040 | echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
|
| 1041 | ifeq ($(has_libelf),1)
|
| 1042 | objtool_target := tools/objtool FORCE
|
| 1043 | else
|
| 1044 | $(warning "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel")
|
| 1045 | SKIP_STACK_VALIDATION := 1
|
| 1046 | export SKIP_STACK_VALIDATION
|
| 1047 | endif
|
| 1048 | endif
|
| 1049 |
|
| 1050 | PHONY += prepare-objtool
|
| 1051 | prepare-objtool: $(objtool_target)
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 | PHONY += prepare-compiler-check
|
| 1062 | prepare-compiler-check: FORCE
|
| 1063 |
|
| 1064 | ifdef stackp-name
|
| 1065 | ifeq ($(call cc-option, $(stackp-flag)),)
|
| 1066 | @echo Cannot use CONFIG_CC_STACKPROTECTOR_$(stackp-name): \
|
| 1067 | $(stackp-flag) not supported by compiler >&2 && exit 1
|
| 1068 | endif
|
| 1069 | endif
|
| 1070 |
|
| 1071 | ifdef stackp-check
|
| 1072 | ifneq ($(shell $(CONFIG_SHELL) $(stackp-check) $(CC) $(KBUILD_CPPFLAGS) $(biarch)),y)
|
| 1073 | @echo Cannot use CONFIG_CC_STACKPROTECTOR_$(stackp-name): \
|
| 1074 | $(stackp-flag) available but compiler is broken >&2 && exit 1
|
| 1075 | endif
|
| 1076 | endif
|
| 1077 | @:
|
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 | uts_len := 64
|
| 1086 | define filechk_utsrelease.h
|
| 1087 | if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
|
| 1088 | echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
|
| 1089 | exit 1; \
|
| 1090 | fi; \
|
| 1091 | (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
|
| 1092 | endef
|
| 1093 |
|
| 1094 | define filechk_version.h
|
| 1095 | (echo \#define LINUX_VERSION_CODE $(shell \
|
| 1096 | expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
|
| 1097 | echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
|
| 1098 | endef
|
| 1099 |
|
| 1100 | $(version_h): $(srctree)/Makefile FORCE
|
| 1101 | $(call filechk,version.h)
|
| 1102 | $(Q)rm -f $(old_version_h)
|
| 1103 |
|
| 1104 | include/generated/utsrelease.h: include/config/kernel.release FORCE
|
| 1105 | $(call filechk,utsrelease.h)
|
| 1106 |
|
| 1107 | PHONY += headerdep
|
| 1108 | headerdep:
|
| 1109 | $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
|
| 1110 | $(srctree)/scripts/headerdep.pl -I$(srctree)/include
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 | INSTALL_FW_PATH=$(INSTALL_MOD_PATH)/lib/firmware
|
| 1115 | export INSTALL_FW_PATH
|
| 1116 |
|
| 1117 | PHONY += firmware_install
|
| 1118 | firmware_install:
|
| 1119 | @mkdir -p $(objtree)/firmware
|
| 1120 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_install
|
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 | export INSTALL_HDR_PATH = $(objtree)/usr
|
| 1127 |
|
| 1128 |
|
| 1129 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
|
| 1130 |
|
| 1131 | PHONY += archheaders
|
| 1132 | archheaders:
|
| 1133 |
|
| 1134 | PHONY += archscripts
|
| 1135 | archscripts:
|
| 1136 |
|
| 1137 | PHONY += __headers
|
| 1138 | __headers: $(version_h) scripts_basic asm-generic archheaders archscripts
|
| 1139 | $(Q)$(MAKE) $(build)=scripts build_unifdef
|
| 1140 |
|
| 1141 | PHONY += headers_install_all
|
| 1142 | headers_install_all:
|
| 1143 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
|
| 1144 |
|
| 1145 | PHONY += headers_install
|
| 1146 | headers_install: __headers
|
| 1147 | $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
|
| 1148 | $(error Headers not exportable for the $(SRCARCH) architecture))
|
| 1149 | $(Q)$(MAKE) $(hdr-inst)=include/uapi
|
| 1150 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst)
|
| 1151 |
|
| 1152 | PHONY += headers_check_all
|
| 1153 | headers_check_all: headers_install_all
|
| 1154 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
|
| 1155 |
|
| 1156 | PHONY += headers_check
|
| 1157 | headers_check: headers_install
|
| 1158 | $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
|
| 1159 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1
|
| 1160 |
|
| 1161 |
|
| 1162 |
|
| 1163 |
|
| 1164 | PHONY += kselftest
|
| 1165 | kselftest:
|
| 1166 | $(Q)$(MAKE) -C tools/testing/selftests run_tests
|
| 1167 |
|
| 1168 | kselftest-clean:
|
| 1169 | $(Q)$(MAKE) -C tools/testing/selftests clean
|
| 1170 |
|
| 1171 | PHONY += kselftest-merge
|
| 1172 | kselftest-merge:
|
| 1173 | $(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!))
|
| 1174 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
|
| 1175 | -m $(objtree)/.config \
|
| 1176 | $(srctree)/tools/testing/selftests/*/config
|
| 1177 | +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 | ifdef CONFIG_MODULES
|
| 1183 |
|
| 1184 |
|
| 1185 |
|
| 1186 | all: modules
|
| 1187 |
|
| 1188 |
|
| 1189 |
|
| 1190 |
|
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 | PHONY += modules
|
| 1195 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
|
| 1196 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
|
| 1197 | @$(kecho) ' Building modules, stage 2.';
|
| 1198 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
| 1199 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
|
| 1200 |
|
| 1201 | modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
|
| 1202 | $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
|
| 1203 |
|
| 1204 | %/modules.builtin: include/config/auto.conf
|
| 1205 | $(Q)$(MAKE) $(modbuiltin)=$*
|
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 | PHONY += modules_prepare
|
| 1210 | modules_prepare: prepare scripts
|
| 1211 |
|
| 1212 |
|
| 1213 | PHONY += modules_install
|
| 1214 | modules_install: _modinst_ _modinst_post
|
| 1215 |
|
| 1216 | PHONY += _modinst_
|
| 1217 | _modinst_:
|
| 1218 | @rm -rf $(MODLIB)/kernel
|
| 1219 | @rm -f $(MODLIB)/source
|
| 1220 | @mkdir -p $(MODLIB)/kernel
|
| 1221 | @ln -s `cd $(srctree) && /bin/pwd` $(MODLIB)/source
|
| 1222 | @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
|
| 1223 | rm -f $(MODLIB)/build ; \
|
| 1224 | ln -s $(CURDIR) $(MODLIB)/build ; \
|
| 1225 | fi
|
| 1226 | @cp -f $(objtree)/modules.order $(MODLIB)/
|
| 1227 | @cp -f $(objtree)/modules.builtin $(MODLIB)/
|
| 1228 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
| 1229 |
|
| 1230 |
|
| 1231 |
|
| 1232 |
|
| 1233 | PHONY += _modinst_post
|
| 1234 | _modinst_post: _modinst_
|
| 1235 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst
|
| 1236 | $(call cmd,depmod)
|
| 1237 |
|
| 1238 | ifeq ($(CONFIG_MODULE_SIG), y)
|
| 1239 | PHONY += modules_sign
|
| 1240 | modules_sign:
|
| 1241 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
|
| 1242 | endif
|
| 1243 |
|
| 1244 | else
|
| 1245 |
|
| 1246 |
|
| 1247 |
|
| 1248 |
|
| 1249 | PHONY += modules modules_install
|
| 1250 | modules modules_install:
|
| 1251 | @echo >&2
|
| 1252 | @echo >&2 "The present kernel configuration has modules disabled."
|
| 1253 | @echo >&2 "Type 'make config' and enable loadable module support."
|
| 1254 | @echo >&2 "Then build a kernel with module support enabled."
|
| 1255 | @echo >&2
|
| 1256 | @exit 1
|
| 1257 |
|
| 1258 | endif
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
|
| 1263 |
|
| 1264 |
|
| 1265 |
|
| 1266 |
|
| 1267 |
|
| 1268 | CLEAN_DIRS += $(MODVERDIR)
|
| 1269 |
|
| 1270 |
|
| 1271 | MRPROPER_DIRS += include/config usr/include include/generated \
|
| 1272 | arch/*/include/generated .tmp_objdiff
|
| 1273 | MRPROPER_FILES += .config .config.old .version .old_version \
|
| 1274 | Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
|
| 1275 | signing_key.pem signing_key.priv signing_key.x509 \
|
| 1276 | x509.genkey extra_certificates signing_key.x509.keyid \
|
| 1277 | signing_key.x509.signer vmlinux-gdb.py
|
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 | clean: rm-dirs := $(CLEAN_DIRS)
|
| 1282 | clean: rm-files := $(CLEAN_FILES)
|
| 1283 | clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation samples)
|
| 1284 |
|
| 1285 | PHONY += $(clean-dirs) clean archclean vmlinuxclean
|
| 1286 | $(clean-dirs):
|
| 1287 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
| 1288 |
|
| 1289 | vmlinuxclean:
|
| 1290 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
|
| 1291 | $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
|
| 1292 |
|
| 1293 | clean: archclean vmlinuxclean
|
| 1294 |
|
| 1295 |
|
| 1296 |
|
| 1297 | mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
|
| 1298 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
|
| 1299 | mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts)
|
| 1300 |
|
| 1301 | PHONY += $(mrproper-dirs) mrproper archmrproper
|
| 1302 | $(mrproper-dirs):
|
| 1303 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
|
| 1304 |
|
| 1305 | mrproper: clean archmrproper $(mrproper-dirs)
|
| 1306 | $(call cmd,rmdirs)
|
| 1307 | $(call cmd,rmfiles)
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 | PHONY += distclean
|
| 1312 |
|
| 1313 | distclean: mrproper
|
| 1314 | @find $(srctree) $(RCS_FIND_IGNORE) \
|
| 1315 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
|
| 1316 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
|
| 1317 | -o -name '.*.rej' -o -name '*%' -o -name 'core' \) \
|
| 1318 | -type f -print | xargs rm -f
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 | package-dir := scripts/package
|
| 1325 |
|
| 1326 | %src-pkg: FORCE
|
| 1327 | $(Q)$(MAKE) $(build)=$(package-dir) $@
|
| 1328 | %pkg: include/config/kernel.release FORCE
|
| 1329 | $(Q)$(MAKE) $(build)=$(package-dir) $@
|
| 1330 | rpm: include/config/kernel.release FORCE
|
| 1331 | $(Q)$(MAKE) $(build)=$(package-dir) $@
|
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 | boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig)
|
| 1338 | boards := $(sort $(notdir $(boards)))
|
| 1339 | board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig))
|
| 1340 | board-dirs := $(sort $(notdir $(board-dirs:/=)))
|
| 1341 |
|
| 1342 | PHONY += help
|
| 1343 | help:
|
| 1344 | @echo 'Cleaning targets:'
|
| 1345 | @echo ' clean - Remove most generated files but keep the config and'
|
| 1346 | @echo ' enough build support to build external modules'
|
| 1347 | @echo ' mrproper - Remove all generated files + config + various backup files'
|
| 1348 | @echo ' distclean - mrproper + remove editor backup and patch files'
|
| 1349 | @echo ''
|
| 1350 | @echo 'Configuration targets:'
|
| 1351 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
|
| 1352 | @echo ''
|
| 1353 | @echo 'Other generic targets:'
|
| 1354 | @echo ' all - Build all targets marked with [*]'
|
| 1355 | @echo '* vmlinux - Build the bare kernel'
|
| 1356 | @echo '* modules - Build all modules'
|
| 1357 | @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
|
| 1358 | @echo ' firmware_install- Install all firmware to INSTALL_FW_PATH'
|
| 1359 | @echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)'
|
| 1360 | @echo ' dir/ - Build all files in dir and below'
|
| 1361 | @echo ' dir/file.[ois] - Build specified target only'
|
| 1362 | @echo ' dir/file.lst - Build specified mixed source/assembly target only'
|
| 1363 | @echo ' (requires a recent binutils and recent build (System.map))'
|
| 1364 | @echo ' dir/file.ko - Build module including final link'
|
| 1365 | @echo ' modules_prepare - Set up for building external modules'
|
| 1366 | @echo ' tags/TAGS - Generate tags file for editors'
|
| 1367 | @echo ' cscope - Generate cscope index'
|
| 1368 | @echo ' gtags - Generate GNU GLOBAL index'
|
| 1369 | @echo ' kernelrelease - Output the release version string (use with make -s)'
|
| 1370 | @echo ' kernelversion - Output the version stored in Makefile (use with make -s)'
|
| 1371 | @echo ' image_name - Output the image name (use with make -s)'
|
| 1372 | @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
|
| 1373 | echo ' (default: $(INSTALL_HDR_PATH))'; \
|
| 1374 | echo ''
|
| 1375 | @echo 'Static analysers'
|
| 1376 | @echo ' checkstack - Generate a list of stack hogs'
|
| 1377 | @echo ' namespacecheck - Name space analysis on compiled kernel'
|
| 1378 | @echo ' versioncheck - Sanity check on version.h usage'
|
| 1379 | @echo ' includecheck - Check for duplicate included header files'
|
| 1380 | @echo ' export_report - List the usages of all exported symbols'
|
| 1381 | @echo ' headers_check - Sanity check on exported headers'
|
| 1382 | @echo ' headerdep - Detect inclusion cycles in headers'
|
| 1383 | @$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help
|
| 1384 | @echo ''
|
| 1385 | @echo 'Kernel selftest'
|
| 1386 | @echo ' kselftest - Build and run kernel selftest (run as root)'
|
| 1387 | @echo ' Build, install, and boot kernel before'
|
| 1388 | @echo ' running kselftest on it'
|
| 1389 | @echo ' kselftest-clean - Remove all generated kselftest files'
|
| 1390 | @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existed'
|
| 1391 | @echo ' .config.'
|
| 1392 | @echo ''
|
| 1393 | @echo 'Kernel packaging:'
|
| 1394 | @$(MAKE) $(build)=$(package-dir) help
|
| 1395 | @echo ''
|
| 1396 | @echo 'Documentation targets:'
|
| 1397 | @$(MAKE) -f $(srctree)/Documentation/Makefile.sphinx dochelp
|
| 1398 | @echo ''
|
| 1399 | @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
|
| 1400 | @echo ''
|
| 1401 | @echo 'Architecture specific targets ($(SRCARCH)):'
|
| 1402 | @$(if $(archhelp),$(archhelp),\
|
| 1403 | echo ' No architecture specific help defined for $(SRCARCH)')
|
| 1404 | @echo ''
|
| 1405 | @$(if $(boards), \
|
| 1406 | $(foreach b, $(boards), \
|
| 1407 | printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
|
| 1408 | echo '')
|
| 1409 | @$(if $(board-dirs), \
|
| 1410 | $(foreach b, $(board-dirs), \
|
| 1411 | printf " %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
|
| 1412 | printf " %-16s - Show all of the above\\n" help-boards; \
|
| 1413 | echo '')
|
| 1414 |
|
| 1415 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
|
| 1416 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
|
| 1417 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
|
| 1418 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
|
| 1419 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
|
| 1420 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
|
| 1421 | @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where'
|
| 1422 | @echo ' 1: warnings which may be relevant and do not occur too often'
|
| 1423 | @echo ' 2: warnings which occur quite often but may still be relevant'
|
| 1424 | @echo ' 3: more obscure warnings, can most likely be ignored'
|
| 1425 | @echo ' Multiple levels can be combined with W=12 or W=123'
|
| 1426 | @echo ''
|
| 1427 | @echo 'Execute "make" or "make all" to build all targets marked with [*] '
|
| 1428 | @echo 'For further info see the ./README file'
|
| 1429 |
|
| 1430 |
|
| 1431 | help-board-dirs := $(addprefix help-,$(board-dirs))
|
| 1432 |
|
| 1433 | help-boards: $(help-board-dirs)
|
| 1434 |
|
| 1435 | boards-per-dir = $(sort $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)))
|
| 1436 |
|
| 1437 | $(help-board-dirs): help-%:
|
| 1438 | @echo 'Architecture specific targets ($(SRCARCH) $*):'
|
| 1439 | @$(if $(boards-per-dir), \
|
| 1440 | $(foreach b, $(boards-per-dir), \
|
| 1441 | printf " %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \
|
| 1442 | echo '')
|
| 1443 |
|
| 1444 |
|
| 1445 |
|
| 1446 |
|
| 1447 | DOC_TARGETS := xmldocs sgmldocs psdocs latexdocs pdfdocs htmldocs mandocs installmandocs epubdocs cleandocs
|
| 1448 | PHONY += $(DOC_TARGETS)
|
| 1449 | $(DOC_TARGETS): scripts_basic FORCE
|
| 1450 | $(Q)$(MAKE) $(build)=scripts build_docproc build_check-lc_ctype
|
| 1451 | $(Q)$(MAKE) $(build)=Documentation -f $(srctree)/Documentation/Makefile.sphinx $@
|
| 1452 | $(Q)$(MAKE) $(build)=Documentation/DocBook $@
|
| 1453 |
|
| 1454 | else
|
| 1455 |
|
| 1456 |
|
| 1457 |
|
| 1458 |
|
| 1459 |
|
| 1460 |
|
| 1461 |
|
| 1462 |
|
| 1463 |
|
| 1464 |
|
| 1465 |
|
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 | KBUILD_MODULES := 1
|
| 1475 | PHONY += crmodverdir
|
| 1476 | crmodverdir:
|
| 1477 | $(cmd_crmodverdir)
|
| 1478 |
|
| 1479 | PHONY += $(objtree)/Module.symvers
|
| 1480 | $(objtree)/Module.symvers:
|
| 1481 | @test -e $(objtree)/Module.symvers || ( \
|
| 1482 | echo; \
|
| 1483 | echo " WARNING: Symbol version dump $(objtree)/Module.symvers"; \
|
| 1484 | echo " is missing; modules will have no dependencies and modversions."; \
|
| 1485 | echo )
|
| 1486 |
|
| 1487 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
|
| 1488 | PHONY += $(module-dirs) modules
|
| 1489 | $(module-dirs): crmodverdir $(objtree)/Module.symvers
|
| 1490 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
|
| 1491 |
|
| 1492 | modules: $(module-dirs)
|
| 1493 | @$(kecho) ' Building modules, stage 2.';
|
| 1494 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
| 1495 |
|
| 1496 | PHONY += modules_install
|
| 1497 | modules_install: _emodinst_ _emodinst_post
|
| 1498 |
|
| 1499 | install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
|
| 1500 | PHONY += _emodinst_
|
| 1501 | _emodinst_:
|
| 1502 | $(Q)mkdir -p $(MODLIB)/$(install-dir)
|
| 1503 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
|
| 1504 |
|
| 1505 | PHONY += _emodinst_post
|
| 1506 | _emodinst_post: _emodinst_
|
| 1507 | $(call cmd,depmod)
|
| 1508 |
|
| 1509 | clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
|
| 1510 |
|
| 1511 | PHONY += $(clean-dirs) clean
|
| 1512 | $(clean-dirs):
|
| 1513 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
| 1514 |
|
| 1515 | clean: rm-dirs := $(MODVERDIR)
|
| 1516 | clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
|
| 1517 |
|
| 1518 | PHONY += help
|
| 1519 | help:
|
| 1520 | @echo ' Building external modules.'
|
| 1521 | @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target'
|
| 1522 | @echo ''
|
| 1523 | @echo ' modules - default target, build the module(s)'
|
| 1524 | @echo ' modules_install - install the module'
|
| 1525 | @echo ' clean - remove generated files in module directory only'
|
| 1526 | @echo ''
|
| 1527 |
|
| 1528 |
|
| 1529 | PHONY += prepare scripts
|
| 1530 | prepare: ;
|
| 1531 | scripts: ;
|
| 1532 | endif
|
| 1533 |
|
| 1534 | clean: $(clean-dirs)
|
| 1535 | $(call cmd,rmdirs)
|
| 1536 | $(call cmd,rmfiles)
|
| 1537 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
|
| 1538 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
|
| 1539 | -o -name '*.ko.*' \
|
| 1540 | -o -name '*.dwo' \
|
| 1541 | -o -name '*.su' \
|
| 1542 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
| 1543 | -o -name '*.symtypes' -o -name 'modules.order' \
|
| 1544 | -o -name modules.builtin -o -name '.tmp_*.o.*' \
|
| 1545 | -o -name '*.c.[012]*.*' \
|
| 1546 | -o -name '*.gcno' \) -type f -print | xargs rm -f
|
| 1547 |
|
| 1548 |
|
| 1549 |
|
| 1550 | quiet_cmd_tags = GEN $@
|
| 1551 | cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@
|
| 1552 |
|
| 1553 | tags TAGS cscope gtags: FORCE
|
| 1554 | $(call cmd,tags)
|
| 1555 |
|
| 1556 |
|
| 1557 |
|
| 1558 |
|
| 1559 | PHONY += includecheck versioncheck coccicheck namespacecheck export_report
|
| 1560 |
|
| 1561 | includecheck:
|
| 1562 | find $(srctree)/* $(RCS_FIND_IGNORE) \
|
| 1563 | -name '*.[hcS]' -type f -print | sort \
|
| 1564 | | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
|
| 1565 |
|
| 1566 | versioncheck:
|
| 1567 | find $(srctree)/* $(RCS_FIND_IGNORE) \
|
| 1568 | -name '*.[hcS]' -type f -print | sort \
|
| 1569 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
|
| 1570 |
|
| 1571 | coccicheck:
|
| 1572 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
|
| 1573 |
|
| 1574 | namespacecheck:
|
| 1575 | $(PERL) $(srctree)/scripts/namespace.pl
|
| 1576 |
|
| 1577 | export_report:
|
| 1578 | $(PERL) $(srctree)/scripts/export_report.pl
|
| 1579 |
|
| 1580 | endif
|
| 1581 | endif
|
| 1582 |
|
| 1583 | PHONY += checkstack kernelrelease kernelversion image_name
|
| 1584 |
|
| 1585 |
|
| 1586 |
|
| 1587 |
|
| 1588 |
|
| 1589 | ifeq ($(ARCH), um)
|
| 1590 | CHECKSTACK_ARCH := $(SUBARCH)
|
| 1591 | else
|
| 1592 | CHECKSTACK_ARCH := $(ARCH)
|
| 1593 | endif
|
| 1594 | checkstack:
|
| 1595 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
|
| 1596 | $(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
|
| 1597 |
|
| 1598 | kernelrelease:
|
| 1599 | @echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
|
| 1600 |
|
| 1601 | kernelversion:
|
| 1602 | @echo $(KERNELVERSION)
|
| 1603 |
|
| 1604 | image_name:
|
| 1605 | @echo $(KBUILD_IMAGE)
|
| 1606 |
|
| 1607 |
|
| 1608 | tools/: FORCE
|
| 1609 | $(Q)mkdir -p $(objtree)/tools
|
| 1610 | $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
|
| 1611 |
|
| 1612 | tools/%: FORCE
|
| 1613 | $(Q)mkdir -p $(objtree)/tools
|
| 1614 | $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
|
| 1615 |
|
| 1616 |
|
| 1617 |
|
| 1618 |
|
| 1619 |
|
| 1620 |
|
| 1621 |
|
| 1622 |
|
| 1623 |
|
| 1624 |
|
| 1625 |
|
| 1626 | ifeq ($(KBUILD_EXTMOD),)
|
| 1627 | build-dir = $(patsubst %/,%,$(dir $@))
|
| 1628 | target-dir = $(dir $@)
|
| 1629 | else
|
| 1630 | zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
|
| 1631 | build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
|
| 1632 | target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
|
| 1633 | endif
|
| 1634 |
|
| 1635 | %.s: %.c prepare scripts FORCE
|
| 1636 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
| 1637 | %.i: %.c prepare scripts FORCE
|
| 1638 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
| 1639 | %.o: %.c prepare scripts FORCE
|
| 1640 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
| 1641 | %.lst: %.c prepare scripts FORCE
|
| 1642 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
| 1643 | %.s: %.S prepare scripts FORCE
|
| 1644 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
| 1645 | %.o: %.S prepare scripts FORCE
|
| 1646 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
| 1647 | %.symtypes: %.c prepare scripts FORCE
|
| 1648 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
|
| 1649 |
|
| 1650 |
|
| 1651 | /: prepare scripts FORCE
|
| 1652 | $(cmd_crmodverdir)
|
| 1653 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
| 1654 | $(build)=$(build-dir)
|
| 1655 |
|
| 1656 | Documentation/ samples/: headers_install
|
| 1657 | %/: prepare scripts FORCE
|
| 1658 | $(cmd_crmodverdir)
|
| 1659 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
| 1660 | $(build)=$(build-dir)
|
| 1661 | %.ko: prepare scripts FORCE
|
| 1662 | $(cmd_crmodverdir)
|
| 1663 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
|
| 1664 | $(build)=$(build-dir) $(@:.ko=.o)
|
| 1665 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
| 1666 |
|
| 1667 |
|
| 1668 |
|
| 1669 |
|
| 1670 | quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
|
| 1671 | cmd_rmdirs = rm -rf $(rm-dirs)
|
| 1672 |
|
| 1673 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
|
| 1674 | cmd_rmfiles = rm -f $(rm-files)
|
| 1675 |
|
| 1676 |
|
| 1677 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
|
| 1678 | cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
|
| 1679 | $(KERNELRELEASE) "$(patsubst y,_,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))"
|
| 1680 |
|
| 1681 |
|
| 1682 |
|
| 1683 | cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
|
| 1684 | $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
|
| 1685 |
|
| 1686 |
|
| 1687 |
|
| 1688 | targets := $(wildcard $(sort $(targets)))
|
| 1689 | cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
| 1690 |
|
| 1691 | ifneq ($(cmd_files),)
|
| 1692 | $(cmd_files): ;
|
| 1693 | include $(cmd_files)
|
| 1694 | endif
|
| 1695 |
|
| 1696 | endif
|
| 1697 |
|
| 1698 | PHONY += FORCE
|
| 1699 | FORCE:
|
| 1700 |
|
| 1701 |
|
| 1702 |
|
| 1703 | .PHONY: $(PHONY)
|