1VERSION = 2 2PATCHLEVEL = 5 3SUBLEVEL = 28 4EXTRAVERSION = 5 6# *DOCUMENTATION* 7# Too see a list of typical targets execute "make help" 8# More info can be located in ./Documentation/kbuild 9# Comments in this file is targeted only to the developer, do not 10# expect to learn how to build the kernel reading this file. 11 12# We are using a recursive build, so we need to do a little thinking 13# to get the ordering right. 14# 15# Most importantly: sub-Makefiles should only ever modify files in 16# their own directory. If in some directory we have a dependency on 17# a file in another dir (which doesn't happen often, but it's of 18# unavoidable when linking the built-in.o targets which finally 19# turn into vmlinux), we will call a sub make in that other dir, and 20# after that we are sure that everything which is in that other dir 21# is now up to date. 22# 23# The only cases where we need to modify files which have global 24# effects are thus separated out and done before the recursive 25# descending is started. They are now explicitly listed as the 26# prepare rule. 27 28KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) 29 30ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) 31KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g") 32 33CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ 34 else if [ -x /bin/bash ]; then echo /bin/bash; \ 35 else echo sh; fi ; fi) 36TOPDIR := $(CURDIR) 37 38HPATH = $(TOPDIR)/include 39FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net 40 41HOSTCC = gcc 42HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer 43 44CROSS_COMPILE = 45 46# That's our default target when none is given on the command line 47 48all: vmlinux 49 50# Print entire command lines instead of short version 51# For now, leave the default 52 53ifndef KBUILD_VERBOSE 54 KBUILD_VERBOSE = 1 55endif 56 57# Decide whether to build built-in, modular, or both. 58# Normally, just do built-in. 59 60KBUILD_MODULES := 61KBUILD_BUILTIN := 1 62 63# If we have only "make modules", don't compile built-in objects. 64 65ifeq ($(MAKECMDGOALS),modules) 66 KBUILD_BUILTIN := 67endif 68 69# If we have "make <whatever> modules", compile modules 70# in addition to whatever we do anyway. 71 72ifneq ($(filter modules,$(MAKECMDGOALS)),) 73 KBUILD_MODULES := 1 74endif 75 76# Just "make" or "make all" shall build modules as well 77 78ifeq ($(MAKECMDGOALS),) 79 KBUILD_MODULES := 1 80endif 81 82ifneq ($(filter all,$(MAKECMDGOALS)),) 83 KBUILD_MODULES := 1 84endif 85 86export KBUILD_MODULES KBUILD_BUILTIN 87 88# Beautify output 89# --------------------------------------------------------------------------- 90# 91# Normally, we echo the whole command before executing it. By making 92# that echo $($(quiet)$(cmd)), we now have the possibility to set 93# $(quiet) to choose other forms of output instead, e.g. 94# 95# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ 96# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< 97# 98# If $(quiet) is empty, the whole command will be printed. 99# If it is set to "quiet_", only the short version will be printed. 100# If it is set to "silent_", nothing wil be printed at all, since 101# the variable $(silent_cmd_cc_o_c) doesn't exist. 102 103# If the user wants quiet mode, echo short versions of the commands 104# only and suppress the 'Entering/Leaving directory' messages 105 106ifneq ($(KBUILD_VERBOSE),1) 107 quiet=quiet_ 108 MAKEFLAGS += --no-print-directory 109endif 110 111# If the user is running make -s (silent mode), suppress echoing of 112# commands 113 114ifneq ($(findstring s,$(MAKEFLAGS)),) 115 quiet=silent_ 116endif 117 118export quiet 119 120# 121# Include the make variables (CC, etc...) 122# 123 124AS = $(CROSS_COMPILE)as 125LD = $(CROSS_COMPILE)ld 126CC = $(CROSS_COMPILE)gcc 127CPP = $(CC) -E 128AR = $(CROSS_COMPILE)ar 129NM = $(CROSS_COMPILE)nm 130STRIP = $(CROSS_COMPILE)strip 131OBJCOPY = $(CROSS_COMPILE)objcopy 132OBJDUMP = $(CROSS_COMPILE)objdump 133MAKEFILES = $(TOPDIR)/.config 134GENKSYMS = /sbin/genksyms 135DEPMOD = /sbin/depmod 136PERL = perl 137MODFLAGS = -DMODULE 138CFLAGS_MODULE = $(MODFLAGS) 139AFLAGS_MODULE = $(MODFLAGS) 140CFLAGS_KERNEL = 141AFLAGS_KERNEL = 142EXPORT_FLAGS = 143NOSTDINC_FLAGS = -nostdinc -iwithprefix include 144 145export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ 146 CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ 147 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL 148 149export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS OBJCOPYFLAGS 150export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 151export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 152 153src := . 154obj := . 155srctree := $(TOPDIR) 156objtree := $(TOPDIR) 157 158export srctree objtree 159 160SUBDIRS := init kernel mm fs ipc lib drivers sound net security 161 162 163noconfig_targets := xconfig menuconfig config oldconfig randconfig \ 164 defconfig allyesconfig allnoconfig allmodconfig \ 165 clean mrproper distclean \ 166 help tags TAGS sgmldocs psdocs pdfdocs htmldocs \ 167 checkconfig checkhelp checkincludes 168 169ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) 170 171# Here goes the main Makefile 172# =========================================================================== 173# 174# If the user gave a *config target, it'll be handled in another 175# section below, since in this case we cannot include .config 176# Same goes for other targets like clean/mrproper etc, which 177# don't need .config, either 178 179# In this section, we need .config 180 181-include .config 182 183# If .config doesn't exist - tough luck 184 185.config: 186 @echo '***' 187 @echo '*** You have not yet configured your kernel!' 188 @echo '*** Please run some configurator (do "make xconfig" or' 189 @echo '*** "make menuconfig" or "make oldconfig" or "make config").' 190 @echo '***' 191 @exit 1 192 193# 194# INSTALL_PATH specifies where to place the updated kernel and system map 195# images. Uncomment if you want to place them anywhere other than root. 196# 197 198#export INSTALL_PATH=/boot 199 200# 201# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory 202# relocations required by build roots. This is not defined in the 203# makefile but the arguement can be passed to make if needed. 204# 205 206MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 207export MODLIB 208 209# 210# standard CFLAGS 211# 212 213CPPFLAGS := -D__KERNEL__ -I$(HPATH) 214 215CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -g \ 216 -fomit-frame-pointer -fno-strict-aliasing -fno-common 217AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) 218 219ifdef CONFIG_MODULES 220EXPORT_FLAGS := -DEXPORT_SYMTAB 221endif 222 223# Link components for vmlinux 224# --------------------------------------------------------------------------- 225 226INIT := init/init.o 227CORE_FILES := kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o security/built-in.o 228LIBS := lib/lib.a 229DRIVERS := drivers/built-in.o sound/sound.o 230NETWORKS := net/network.o 231 232include arch/$(ARCH)/Makefile 233 234export NETWORKS DRIVERS LIBS HEAD LDFLAGS MAKEBOOT ASFLAGS 235 236# boot target 237# --------------------------------------------------------------------------- 238 239boot: vmlinux 240 @$(MAKE) -C arch/$(ARCH)/boot 241 242# Build vmlinux 243# --------------------------------------------------------------------------- 244 245# This is a bit tricky: If we need to relink vmlinux, we want 246# the version number incremented, which means recompile init/version.o 247# and relink init/init.o. However, we cannot do this during the 248# normal descending-into-subdirs phase, since at that time 249# we cannot yet know if we will need to relink vmlinux. 250# So we descend into init/ inside the rule for vmlinux again. 251 252vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS) 253 254quiet_cmd_link_vmlinux = LD $@ 255cmd_link_vmlinux = $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \ 256 --start-group \ 257 $(CORE_FILES) \ 258 $(LIBS) \ 259 $(DRIVERS) \ 260 $(NETWORKS) \ 261 --end-group \ 262 -o vmlinux 263 264# set -e makes the rule exit immediately on error 265 266define rule_link_vmlinux 267 set -e 268 echo ' Generating build number' 269 . scripts/mkversion > .tmpversion 270 mv -f .tmpversion .version 271 +$(MAKE) -C init 272 $(call cmd,link_vmlinux) 273 $(cmd_link_vmlinux) 274 echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd 275 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map 276endef 277 278vmlinux: $(vmlinux-objs) FORCE 279 $(call if_changed_rule,link_vmlinux) 280 281# The actual objects are generated when descending, 282# make sure no implicit rule kicks in 283 284$(sort $(vmlinux-objs)): $(SUBDIRS) ; 285 286# Handle descending into subdirectories listed in $(SUBDIRS) 287 288.PHONY: $(SUBDIRS) 289$(SUBDIRS): .hdepend prepare 290 @$(MAKE) -C $@ 291 292# Things we need done before we descend to build or make 293# module versions are listed in "prepare" 294 295.PHONY: prepare 296prepare: include/linux/version.h include/asm include/config/MARKER 297 @echo ' Starting the build. KBUILD_BUILTIN=$(KBUILD_BUILTIN) KBUILD_MODULES=$(KBUILD_MODULES)' 298 299# Single targets 300# --------------------------------------------------------------------------- 301 302%.s: %.c FORCE 303 @$(MAKE) -C $(@D) $(@F) 304%.i: %.c FORCE 305 @$(MAKE) -C $(@D) $(@F) 306%.o: %.c FORCE 307 @$(MAKE) -C $(@D) $(@F) 308%.lst: %.c FORCE 309 @$(MAKE) -C $(@D) $(@F) 310%.s: %.S FORCE 311 @$(MAKE) -C $(@D) $(@F) 312%.o: %.S FORCE 313 @$(MAKE) -C $(@D) $(@F) 314 315# FIXME: The asm symlink changes when $(ARCH) changes. That's 316# hard to detect, but I suppose "make mrproper" is a good idea 317# before switching between archs anyway. 318 319include/asm: 320 @echo ' Making asm->asm-$(ARCH) symlink' 321 @ln -s asm-$(ARCH) $@ 322 323# Split autoconf.h into include/linux/config/* 324 325include/config/MARKER: scripts/split-include include/linux/autoconf.h 326 @echo ' SPLIT include/linux/autoconf.h -> include/config/*' 327 @scripts/split-include include/linux/autoconf.h include/config 328 @touch $@ 329 330# if .config is newer than include/linux/autoconf.h, someone tinkered 331# with it and forgot to run make oldconfig 332 333include/linux/autoconf.h: .config 334 @echo '***' 335 @echo '*** You changed .config w/o running make *config?' 336 @echo '*** Please run "make oldconfig"' 337 @echo '***' 338 @exit 1 339 340# Generate some files 341# --------------------------------------------------------------------------- 342 343# version.h changes when $(KERNELRELEASE) etc change, as defined in 344# this Makefile 345 346uts_len := 64 347 348include/linux/version.h: Makefile 349 @if expr length "$(KERNELRELEASE)" \> $(uts_len) >/dev/null ; then \ 350 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ 351 exit 1; \ 352 fi; 353 @echo -n ' Generating $@' 354 @(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \ 355 echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \ 356 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \ 357 ) > $@.tmp 358 @$(update-if-changed) 359 360# Helpers built in scripts/ 361# --------------------------------------------------------------------------- 362 363scripts/fixdep scripts/split-include : scripts ; 364 365.PHONY: scripts 366scripts: 367 @$(MAKE) -C scripts 368 369# Generate module versions 370# --------------------------------------------------------------------------- 371 372# The targets are still named depend / dep for traditional 373# reasons, but the only thing we do here is generating 374# the module version checksums. 375 376.PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS)) 377 378depend dep: .hdepend 379 380# .hdepend is our (misnomed) marker for whether we've run 381# generated module versions 382 383.hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) 384 @$(MAKE) include/linux/modversions.h 385 @touch $@ 386 387ifdef CONFIG_MODVERSIONS 388 389# Update modversions.h, but only if it would change. 390 391include/linux/modversions.h: scripts/fixdep prepare FORCE 392 @rm -rf .tmp_export-objs 393 @$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) 394 @echo -n ' Generating $@' 395 @( echo "#ifndef _LINUX_MODVERSIONS_H";\ 396 echo "#define _LINUX_MODVERSIONS_H"; \ 397 echo "#include <linux/modsetver.h>"; \ 398 for f in `cd .tmp_export-objs; find modules -name SCCS -prune -o -name BitKeeper -prune -o -name \*.ver -print | sort`; do \ 399 echo "#include <linux/$${f}>"; \ 400 done; \ 401 echo "#endif"; \ 402 ) > $@.tmp; \ 403 $(update-if-changed) 404 405$(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE 406 @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep 407 408else # !CONFIG_MODVERSIONS 409 410.PHONY: include/linux/modversions.h 411 412include/linux/modversions.h: 413 414endif # CONFIG_MODVERSIONS 415 416# --------------------------------------------------------------------------- 417# Modules 418 419ifdef CONFIG_MODULES 420 421# Build modules 422 423ifdef CONFIG_MODVERSIONS 424MODFLAGS += -include $(HPATH)/linux/modversions.h 425endif 426 427.PHONY: modules 428modules: $(SUBDIRS) 429 430# Install modules 431 432.PHONY: modules_install 433modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post 434 435.PHONY: _modinst_ 436_modinst_: 437 @rm -rf $(MODLIB)/kernel 438 @rm -f $(MODLIB)/build 439 @mkdir -p $(MODLIB)/kernel 440 @ln -s $(TOPDIR) $(MODLIB)/build 441 442# If System.map exists, run depmod. This deliberately does not have a 443# dependency on System.map since that would run the dependency tree on 444# vmlinux. This depmod is only for convenience to give the initial 445# boot a modules.dep even before / is mounted read-write. However the 446# boot script depmod is the master version. 447ifeq "$(strip $(INSTALL_MOD_PATH))" "" 448depmod_opts := 449else 450depmod_opts := -b $(INSTALL_MOD_PATH) -r 451endif 452.PHONY: _modinst_post 453_modinst_post: 454 if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi 455 456.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS)) 457$(patsubst %, _modinst_%, $(SUBDIRS)) : 458 @$(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install 459 460else # CONFIG_MODULES 461 462# Modules not configured 463# --------------------------------------------------------------------------- 464 465modules modules_install: FORCE 466 @echo 467 @echo "The present kernel configuration has modules disabled." 468 @echo "Type 'make config' and enable loadable module support." 469 @echo "Then build a kernel with module support enabled." 470 @echo 471 @exit 1 472 473endif # CONFIG_MODULES 474 475# Generate asm-offsets.h 476# --------------------------------------------------------------------------- 477 478define generate-asm-offsets.h 479 (set -e; \ 480 echo "#ifndef __ASM_OFFSETS_H__"; \ 481 echo "#define __ASM_OFFSETS_H__"; \ 482 echo "/*"; \ 483 echo " * DO NOT MODIFY."; \ 484 echo " *"; \ 485 echo " * This file was generated by arch/$(ARCH)/Makefile"; \ 486 echo " *"; \ 487 echo " */"; \ 488 echo ""; \ 489 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \ 490 echo ""; \ 491 echo "#endif" ) 492endef 493 494# RPM target 495# --------------------------------------------------------------------------- 496 497# If you do a make spec before packing the tarball you can rpm -ta it 498 499spec: 500 . scripts/mkspec >kernel.spec 501 502# Build a tar ball, generate an rpm from it and pack the result 503# There arw two bits of magic here 504# 1) The use of /. to avoid tar packing just the symlink 505# 2) Removing the .dep files as they have source paths in them that 506# will become invalid 507 508rpm: clean spec 509 find . -name SCCS -prune -o -name BitKeeper -prune -o \ 510 \( -size 0 -o -name .depend -o -name .hdepend \) \ 511 -type f -print | xargs rm -f 512 set -e; \ 513 cd $(TOPDIR)/.. ; \ 514 ln -sf $(TOPDIR) $(KERNELPATH) ; \ 515 tar -cvz --exclude CVS -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \ 516 rm $(KERNELPATH) ; \ 517 cd $(TOPDIR) ; \ 518 . scripts/mkversion > .version ; \ 519 rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \ 520 rm $(TOPDIR)/../$(KERNELPATH).tar.gz 521 522else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) 523 524ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) 525 526# Targets which don't need .config 527# =========================================================================== 528# 529# These targets basically have their own Makefile - not quite, but at 530# least its own exclusive section in the same Makefile. The reason for 531# this is the following: 532# To know the configuration, the main Makefile has to include 533# .config. That's a obviously a problem when .config doesn't exist 534# yet, but that could be kludged around with only including it if it 535# exists. 536# However, the larger problem is: If you run make *config, make will 537# include the old .config, then execute your *config. It will then 538# notice that a piece it included (.config) did change and restart from 539# scratch. Which will cause execution of *config again. You get the 540# picture. 541# If we don't explicitly let the Makefile know that .config is changed 542# by *config (the old way), it won't reread .config after *config, 543# thus working with possibly stale values - we don't that either. 544# 545# So we divide things: This part here is for making *config targets, 546# and other targets which should work when no .config exists yet. 547# The main part above takes care of the rest after a .config exists. 548 549# Kernel configuration 550# --------------------------------------------------------------------------- 551 552.PHONY: oldconfig xconfig menuconfig config \ 553 make_with_config 554 555xconfig: 556 @$(MAKE) -C scripts kconfig.tk 557 wish -f scripts/kconfig.tk 558 559menuconfig: 560 @$(MAKE) -C scripts lxdialog 561 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in 562 563config: 564 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in 565 566oldconfig: 567 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in 568 569randconfig: 570 $(CONFIG_SHELL) scripts/Configure -r arch/$(ARCH)/config.in 571 572allyesconfig: 573 $(CONFIG_SHELL) scripts/Configure -y arch/$(ARCH)/config.in 574 575allnoconfig: 576 $(CONFIG_SHELL) scripts/Configure -n arch/$(ARCH)/config.in 577 578allmodconfig: 579 $(CONFIG_SHELL) scripts/Configure -m arch/$(ARCH)/config.in 580 581defconfig: 582 yes '' | $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in 583 584# Cleaning up 585# --------------------------------------------------------------------------- 586 587# files removed with 'make clean' 588CLEAN_FILES += \ 589 include/linux/compile.h \ 590 vmlinux System.map \ 591 drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \ 592 drivers/char/conmakehash \ 593 drivers/char/drm/*-mod.c \ 594 drivers/char/defkeymap.c drivers/char/qtronixmap.c \ 595 drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist \ 596 drivers/zorro/devlist.h drivers/zorro/gen-devlist \ 597 sound/oss/bin2hex sound/oss/hex2hex \ 598 drivers/atm/fore200e_mkfirm drivers/atm/{pca,sba}*{.bin,.bin1,.bin2} \ 599 drivers/scsi/aic7xxx/aic7xxx_seq.h \ 600 drivers/scsi/aic7xxx/aic7xxx_reg.h \ 601 drivers/scsi/aic7xxx/aicasm/aicasm_gram.c \ 602 drivers/scsi/aic7xxx/aicasm/aicasm_scan.c \ 603 drivers/scsi/aic7xxx/aicasm/y.tab.h \ 604 drivers/scsi/aic7xxx/aicasm/aicasm \ 605 drivers/scsi/53c700_d.h drivers/scsi/sim710_d.h \ 606 drivers/scsi/53c7xx_d.h drivers/scsi/53c7xx_u.h \ 607 drivers/scsi/53c8xx_d.h drivers/scsi/53c8xx_u.h \ 608 net/802/cl2llc.c net/802/transit/pdutr.h net/802/transit/timertr.h \ 609 net/802/pseudo/pseudocode.h \ 610 net/khttpd/make_times_h net/khttpd/times.h \ 611 submenu* 612 613# files removed with 'make mrproper' 614MRPROPER_FILES += \ 615 include/linux/autoconf.h include/linux/version.h \ 616 drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h \ 617 drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h \ 618 drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h \ 619 drivers/net/hamradio/soundmodem/gentbl \ 620 sound/oss/*_boot.h sound/oss/.*.boot \ 621 sound/oss/msndinit.c \ 622 sound/oss/msndperm.c \ 623 sound/oss/pndsperm.c \ 624 sound/oss/pndspini.c \ 625 drivers/atm/fore200e_*_fw.c drivers/atm/.fore200e_*.fw \ 626 .version .config* config.in config.old \ 627 scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp \ 628 scripts/lxdialog/*.o scripts/lxdialog/lxdialog \ 629 .menuconfig.log \ 630 include/asm \ 631 .hdepend scripts/split-include scripts/docproc \ 632 scripts/fixdep $(TOPDIR)/include/linux/modversions.h \ 633 tags TAGS kernel.spec \ 634 .tmpversion 635 636# directories removed with 'make mrproper' 637MRPROPER_DIRS += \ 638 .tmp_export-objs \ 639 include/config \ 640 $(TOPDIR)/include/linux/modules 641 642# That's our way to know about arch specific cleanup. 643 644include arch/$(ARCH)/Makefile 645 646clean: archclean 647 @echo 'Cleaning up' 648 @find . -name SCCS -prune -o -name BitKeeper -prune -o \ 649 \( -name \*.[oas] -o -name core -o -name .\*.cmd -o \ 650 -name .\*.tmp -o -name .\*.d \) -type f -print \ 651 | grep -v lxdialog/ | xargs rm -f 652 @rm -f $(CLEAN_FILES) 653 @$(MAKE) -C Documentation/DocBook clean 654 655mrproper: clean archmrproper 656 @echo 'Making mrproper' 657 @find . -name SCCS -prune -o -name BitKeeper -prune -o \ 658 \( -name .depend -o -name .\*.cmd \) \ 659 -type f -print | xargs rm -f 660 @rm -f $(MRPROPER_FILES) 661 @rm -rf $(MRPROPER_DIRS) 662 @$(MAKE) -C Documentation/DocBook mrproper 663 664distclean: mrproper 665 @echo 'Making distclean' 666 @find . -name SCCS -prune -o -name BitKeeper -prune -o \ 667 \( -not -type d \) -and \ 668 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ 669 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ 670 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f \ 671 -print | xargs rm -f 672 673# Generate tags for editors 674# --------------------------------------------------------------------------- 675 676TAGS: FORCE 677 { find include/asm-${ARCH} -name SCCS -prune -o -name BitKeeper -prune \ 678 -o -name '*.h' -print ; \ 679 find include -name SCCS -prune -o -name BitKeeper -prune -o \ 680 -type d \( -name "asm-*" -o -name config \) -prune -o \ 681 -name '*.h' -print ; \ 682 find $(SUBDIRS) init arch/${ARCH} \ 683 -name SCCS -prune -o -name BitKeeper -prune -o \ 684 -name '*.[chS]' -print ; } | grep -v SCCS | etags - 685 686# Exuberant ctags works better with -I 687tags: FORCE 688 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \ 689 ctags $$CTAGSF `find include/asm-$(ARCH) -name SCCS -prune -o -name BitKeeper -prune -o -name '*.h' -print` && \ 690 find include -name SCCS -prune -o -name BitKeeper -prune -o \ 691 -type d \( -name "asm-*" -o -name config \) -prune -o \ 692 -name '*.h' -print | xargs ctags $$CTAGSF -a && \ 693 find $(SUBDIRS) init -name SCCS -prune -o -name BitKeeper -prune -o \ 694 -name '*.[ch]' -print | xargs ctags $$CTAGSF -a 695 696# Brief documentation of the typical targets used 697# --------------------------------------------------------------------------- 698 699help: 700 @echo 'Cleaning targets:' 701 @echo ' clean - remove most generated files but keep the config' 702 @echo ' mrproper - remove all generated files including the config' 703 @echo ' distclean - mrproper + remove files generated by editors and patch' 704 @echo '' 705 @echo 'Configuration targets:' 706 @echo ' oldconfig - Update current config utilising a line-oriented program' 707 @echo ' menuconfig - Update current config utilising a menu based program' 708 @echo ' xconfig - Update current config utilising a X-based program' 709 @echo ' defconfig - New config with default answer to all options' 710 @echo ' allmodconfig - New config selecting modules when possible' 711 @echo ' allyesconfig - New config where all options are accepted with yes' 712 @echo ' allnoconfig - New minimal config' 713 @echo '' 714 @echo 'Other generic targets:' 715 @echo ' all - Build all targets marked with [*]' 716 @echo ' dep - Create module version information' 717 @echo '* vmlinux - Build the bare kernel' 718 @echo '* modules - Build all modules' 719 @echo ' dir/file.[ois]- Build specified target only' 720 @echo ' rpm - Build a kernel as an RPM package' 721 @echo ' tags/TAGS - Generate tags file for editors' 722 @echo '' 723 @echo 'Documentation targets:' 724 @$(MAKE) --no-print-directory -f Documentation/DocBook/Makefile dochelp 725 @echo '' 726 @echo 'Architecture specific targets ($(ARCH)):' 727 @$(MAKE) --no-print-directory -f arch/$(ARCH)/boot/Makefile archhelp 728 @echo '' 729 @echo 'Execute "make" or "make all" to build all targets marked with [*] ' 730 @echo 'For further info browse Documentation/kbuild/*' 731 732 733# Documentation targets 734# --------------------------------------------------------------------------- 735 736sgmldocs psdocs pdfdocs htmldocs: 737 @$(MAKE) -C Documentation/DocBook $@ 738 739 740# Scripts to check various things for consistency 741# --------------------------------------------------------------------------- 742 743checkconfig: 744 find * -name SCCS -prune -o -name BitKeeper -prune -o \ 745 -name '*.[hcS]' -type f -print | sort \ 746 | xargs $(PERL) -w scripts/checkconfig.pl 747 748checkhelp: 749 find * -name SCCS -prune -o -name BitKeeper -prune -o \ 750 -name [cC]onfig.in -print | sort \ 751 | xargs $(PERL) -w scripts/checkhelp.pl 752 753checkincludes: 754 find * -name SCCS -prune -o -name BitKeeper -prune -o \ 755 -name '*.[hcS]' -type f -print | sort \ 756 | xargs $(PERL) -w scripts/checkincludes.pl 757 758else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) 759 760# We're called with both targets which do and do not need 761# .config included. Handle them one after the other. 762# =========================================================================== 763 764%:: FORCE 765 $(MAKE) $@ 766 767endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),) 768endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) 769 770# FIXME Should go into a make.lib or something 771# =========================================================================== 772 773# read all saved command lines 774 775cmd_files := $(wildcard .*.cmd) 776ifneq ($(cmd_files),) 777 include $(cmd_files) 778endif 779 780# Usage: $(call if_changed_rule,foo) 781# will check if $(cmd_foo) changed, or any of the prequisites changed, 782# and if so will execute $(rule_foo) 783 784if_changed_rule = $(if $(strip $? \ 785 $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\ 786 $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ 787 @$(rule_$(1))) 788 789# If quiet is set, only print short version of command 790 791cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) 792 793define update-if-changed 794 if [ -r $@ ] && cmp -s $@ $@.tmp; then \ 795 echo ' (unchanged)'; \ 796 rm -f $@.tmp; \ 797 else \ 798 echo ' (updated)'; \ 799 mv -f $@.tmp $@; \ 800 fi 801endef 802 803 804FORCE: 805

