1 # Top-level Makefile for Akaros
6 # - I downloaded the kbuild guts from git://github.com/lacombar/kconfig.git,
7 # and added things from a recent linux makefile. It is from aug 2011, so
8 # some things might not match up.
9 # - Kernel output in obj/: So Linux has the ability to output into another
10 # directory, via the KBUILD_OUTPUT variable. This induces a recursive make
11 # in the output directory. I mucked with it for a little, but didn't get it
12 # to work quite right. Also, there will be other Akaros issues since this
13 # makefile is also used for userspace and tests. For now, I'm leaving things
14 # the default Linux way.
15 # - Kconfig wants to use include/ in the root directory. We can change some
16 # of the default settings that silentoldconfig uses, but I'll leave it as-is
17 # for now, and just symlink that into kern/include. It'll be easier for us,
18 # and also potentially easier if we ever move kern/ up a level. Similarly,
19 # there are default Kconfigs in arch/, not in kern/arch. I just symlinked
20 # arch->kern/arch to keep everything simple.
23 # - Consider merging the two target-detection bits (Linux's config, mixed, or
24 # dot target, and the symlink handling). Also, could consider moving around
25 # the KFS and EXT2 targets. Clean doesn't need to know about them, for
28 # - Review, with an eye for being better about $(srctree). It might only be
29 # necessary in this file, if we every do the KBUILD_OUTPUT option. But we
30 # don't always want it (like for the implicit rule for Makefile)
32 # - It's a bit crazy that we build symlinks for parlib, instead of it
33 # managing its own links based on $(ARCH)
35 # - Consider using Kbuild to build userspace and tests
37 # - There are a few other TODOs sprinkled throughout the makefile.
40 # o use make's built-in rules and variables
41 # (this increases performance and avoids hard-to-debug behaviour);
42 # o print "Entering directory ...";
43 MAKEFLAGS += -rR --no-print-directory
45 # That's our default target when none is given on the command line
46 # This can be overriden with a Makelocal
50 # Export the location of this top level directory
51 AKAROS_ROOT = $(CURDIR)
54 # Setup dumping ground for object files and any temporary files we need to
55 # generate for non-kbuild targets
59 # =========================================================================
60 # We have a few symlinks so that code can include <arch/whatever.h>. This
61 # section builds and maintains those, as best we can.
63 # When invoking make, we can pass in ARCH=some-arch. This value gets 'saved'
64 # in the symlink, so that later invocations do not need ARCH=. If this value
65 # differs from the symlink, it appears like we are changing arches, which
66 # triggers a clean and symlink reconstruction.
68 # When the user changes from one arch to another, they ought to reconfig, since
69 # many of the CONFIG_ vars will depend on the arch. If they try anything other
70 # than one of the "non-build-goals" (cleans or configs), we'll abort.
72 # Make targets that need these symlinks (like building userspace, the kernel,
73 # configs, etc, should depend on symlinks.
75 clean-goals := clean mrproper realclean userclean testclean doxyclean objclean
76 non-build-goals := %config $(clean-goals)
77 ifeq ($(filter $(non-build-goals), $(MAKECMDGOALS)),)
78 goals-has-build-targets := 1
81 PHONY += symlinks clean_symlinks
82 clean_symlinks: objclean
83 @rm -f kern/include/arch kern/boot user/parlib/include/arch
85 arch-link := $(notdir $(shell readlink kern/include/arch))
86 valid-arches := $(notdir $(wildcard kern/arch/*))
89 ifeq ($(filter $(valid-arches), $(ARCH)),)
90 $(error ARCH $(ARCH) invalid, must be one of: $(valid-arches))
92 ifneq ($(ARCH),$(arch-link))
93 ifeq ($(goals-has-build-targets),1)
94 $(error Attempted to make [$(MAKECMDGOALS)] while changing ARCH. \
95 You need to make *config.)
97 symlinks: clean_symlinks
98 @echo Making symlinks...
99 $(Q)ln -fs ../arch/$(ARCH) kern/include/arch
100 $(Q)ln -fs arch/$(ARCH)/boot kern/boot
101 $(Q)ln -fs $(ARCH) user/parlib/include/arch
102 $(Q)$(MAKE) -f $(srctree)/Makefile clean
107 endif # ifneq ($(ARCH),$(arch-link))
108 else # $(ARCH) is empty
109 ifneq ($(arch-link),)
115 ifeq ($(filter $(clean-goals), $(MAKECMDGOALS)),)
116 $(error No arch saved or specified. Make *config with ARCH=arch. \
117 'arch' must be one of: $(valid-arches))
119 ARCH := none # catch bugs
120 endif # ifneq ($(arch-link),)
121 endif # ifeq ($(ARCH),)
126 # Generic Kbuild Environment
127 # =========================================================================
129 # To put more focus on warnings, be less verbose as default
130 # Use 'make V=1' to see the full commands
132 ifeq ("$(origin V)", "command line")
133 KBUILD_VERBOSE = $(V)
135 ifndef KBUILD_VERBOSE
139 srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
142 export srctree objtree
144 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
145 else if [ -x /bin/bash ]; then echo /bin/bash; \
146 else echo sh; fi ; fi)
150 HOSTCFLAGS = -Wall -Wno-char-subscripts -Wmissing-prototypes \
151 -Wstrict-prototypes -O2 -fomit-frame-pointer
154 export CONFIG_SHELL HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS
157 # ---------------------------------------------------------------------------
159 # Normally, we echo the whole command before executing it. By making
160 # that echo $($(quiet)$(cmd)), we now have the possibility to set
161 # $(quiet) to choose other forms of output instead, e.g.
163 # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
164 # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
166 # If $(quiet) is empty, the whole command will be printed.
167 # If it is set to "quiet_", only the short version will be printed.
168 # If it is set to "silent_", nothing will be printed at all, since
169 # the variable $(silent_cmd_cc_o_c) doesn't exist.
171 # A simple variant is to prefix commands with $(Q) - that's useful
172 # for commands that shall be hidden in non-verbose mode.
176 # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
177 # If KBUILD_VERBOSE equals 1 then the above command is displayed.
179 ifeq ($(KBUILD_VERBOSE),1)
186 export quiet Q KBUILD_VERBOSE
188 # We need some generic definitions (do not try to remake the file).
189 $(srctree)/scripts/Kbuild.include: ;
190 include $(srctree)/scripts/Kbuild.include
192 # Kbuild Target/Goals Parsing
193 # =========================================================================
194 # Need to figure out if we're a config or not, and whether or not to include
195 # our .config / auto.conf. Configs are basically their own makefile, (ifeq),
196 # and cleans are allowed to proceed without worrying about the dot-config.
198 # Basic helpers built in scripts/
199 PHONY += scripts_basic
201 $(Q)$(MAKE) $(build)=scripts/basic
205 scripts: scripts_basic include/config/auto.conf include/config/tristate.conf
206 $(Q)$(MAKE) $(build)=$(@)
212 no-dot-config-targets := $(clean-goals)
214 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
215 ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
220 ifneq ($(filter config %config,$(MAKECMDGOALS)),)
222 ifneq ($(filter-out config %config,$(MAKECMDGOALS)),)
227 ifeq ($(mixed-targets),1)
228 # ===========================================================================
229 # We're called with mixed targets (*config and build targets).
230 # Handle them one by one.
233 $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
236 ifeq ($(config-targets),1)
237 # ===========================================================================
238 # *config targets only - make sure prerequisites are updated, and descend
239 # in scripts/kconfig to make the *config target
241 # Default config file, per arch. This path will resolve to
242 # arch/$ARCH/configs/defconfig (arch -> kern/arch). Each arch can override
243 # this if they want, or just symlink to one in the main root directory.
244 KBUILD_DEFCONFIG := defconfig
245 export KBUILD_DEFCONFIG
247 config: scripts_basic symlinks FORCE
248 $(Q)mkdir -p include/config
249 $(Q)$(MAKE) $(build)=scripts/kconfig $@
251 %config: scripts_basic symlinks FORCE
252 $(Q)mkdir -p include/config
253 $(Q)$(MAKE) $(build)=scripts/kconfig $@
256 # ===========================================================================
257 # Build targets only - this includes vmlinux, arch specific targets, clean
258 # targets and others. In general all targets except *config targets.
260 ifeq ($(dot-config),1)
261 KCONFIG_CONFIG ?= .config
262 export KCONFIG_CONFIG
265 -include include/config/auto.conf
267 # Read in dependencies to all Kconfig* files, make sure to run
268 # oldconfig if changes are detected.
269 -include include/config/auto.conf.cmd
271 # To avoid any implicit rule to kick in, define an empty command
272 $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
274 # If .config is newer than include/config/auto.conf, someone tinkered
275 # with it and forgot to run make oldconfig.
276 # if auto.conf.cmd is missing then we are probably in a cleaned tree so
277 # we execute the config step to be sure to catch updated Kconfig files
278 include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
279 $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
282 # Dummy target needed, because used as prerequisite
283 include/config/auto.conf: ;
284 endif # $(dot-config)
286 # Akaros Build Environment
287 # =========================================================================
288 AKAROSINCLUDE := -I$(srctree)/kern/include/
290 # CROSS_COMPILE is defined per-arch. Each arch can set other makeflags, kbuild
292 -include $(srctree)/kern/arch/$(ARCH)/Makefile
294 CC := $(CROSS_COMPILE)gcc
295 CPP := $(CROSS_COMPILE)g++
296 AS := $(CROSS_COMPILE)as
297 AR := $(CROSS_COMPILE)ar
298 LD := $(CROSS_COMPILE)ld
299 OBJCOPY := $(CROSS_COMPILE)objcopy
300 OBJDUMP := $(CROSS_COMPILE)objdump
301 NM := $(CROSS_COMPILE)nm
302 STRIP := $(CROSS_COMPILE)strip
303 KERNEL_LD ?= kernel.ld
305 # These may have bogus values if there is no compiler. The kernel and user
306 # build targets will check cc-exists. Hopefully no cleaning targets rely on
307 # these. Note that if you change configs, these will get computed once, before
308 # silentoldconfig kicks in to regenerate auto.conf, and these values will
309 # temporarily be stale.
310 gcc-lib := $(shell $(CC) -print-libgcc-file-name 2>/dev/null)
311 NOSTDINC_FLAGS += -nostdinc -isystem \
312 $(shell $(CC) -print-file-name=include 2>/dev/null)
313 XCC_TARGET_ROOT := $(dir $(shell which $(CC) 2> /dev/null))../$(patsubst %-,%,\
316 CFLAGS_KERNEL += -O2 -pipe -MD
317 CFLAGS_KERNEL += -std=gnu99 -fgnu89-inline
318 CFLAGS_KERNEL += -fno-strict-aliasing -fno-omit-frame-pointer
319 CFLAGS_KERNEL += -fno-stack-protector
320 CFLAGS_KERNEL += -Wall -Wno-format -Wno-unused
321 CFLAGS_KERNEL += -DROS_KERNEL
322 CFLAGS_KERNEL += -include include/generated/autoconf.h -include include/common.h
323 CFLAGS_KERNEL += -fplan9-extensions
324 ifeq ($(CONFIG_64BIT),y)
325 CFLAGS_KERNEL += -m64 -g
327 CFLAGS_KERNEL += -m32 -gstabs
330 # TODO: do we need this, or can we rely on the compiler's defines?
331 CFLAGS_KERNEL += -D$(ARCH)
333 # TODO: this requires our own strchr (kern/src/stdio.c), which is a potential
334 # source of bugs/problems.
335 # note we still pull in stdbool and stddef from the compiler
336 CFLAGS_KERNEL += -fno-builtin
338 AFLAGS_KERNEL := $(CFLAGS_KERNEL)
343 export AKAROSINCLUDE CROSS_COMPILE
344 export CC CPP AS AR LD OBJCOPY OBJDUMP NM STRIP
345 export CFLAGS_KERNEL AFLAGS_KERNEL
346 export NOSTDINC_FLAGS XCC_TARGET_ROOT
347 export KBUILD_BUILTIN KBUILD_CHECKSRC
349 CFLAGS_USER += -O2 -std=gnu99 -fno-stack-protector -fgnu89-inline
352 export CFLAGS_USER CXXFLAGS_USER
354 # Akaros include stuff (includes custom make targets and user overrides)
355 # =========================================================================
357 # The user can override this, though it won't apply for any of the in-tree
358 # kernel build output. Right now, it's only passed down to tests/
359 dummy-1 := $(shell mkdir -p $(OBJDIR)/kern/)
361 # Don't need to export these, since the Makelocal is included.
362 KERNEL_OBJ := $(OBJDIR)/kern/akaros-kernel
363 CMP_KERNEL_OBJ := $(KERNEL_OBJ).gz
365 # Since we're doing this outside of the dot-config part, some targets, such as
366 # clean, won't read in our .config/auto.conf, and won't know about the
367 # KFS_PATH. Future rules related to KFS will have issues (mkdir with no
368 # argument, or a find of the entire pwd). It's also possible someone provided
369 # an empty path. To deal with both, we'll just have a sensible default.
370 kfs-paths := $(subst $\",,$(CONFIG_KFS_PATHS))
372 kfs-paths := kern/kfs
375 FIRST_KFS_PATH = $(firstword $(kfs-paths))
377 export OBJDIR FIRST_KFS_PATH
379 # Avoiding implicit rules
380 $(srctree)/Makelocal: ;
381 # TODO: one issue is that we import all types of targets: build, clean, etc.
382 # That makes it a bit tougher to reorganize with ifeqs.
383 -include $(srctree)/Makelocal
385 # Akaros Kernel Build
386 # =========================================================================
387 # Add top level directories, either to an existing entry (core-y) or to its
390 # From these, we determine deps and dirs. We recursively make through the
391 # dirs, generating built-in.o at each step, which are the deps from which we
394 # We have all-arch-dirs and all-dirs, so that we can still clean even without
397 core-y += kern/src/ kern/drivers/ $(AKAROS_EXTERNAL_DIRS)
398 arch-y += kern/arch/$(ARCH)/
400 akaros-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(arch-y)))
402 all-arch-dirs := $(patsubst %,kern/arch/%/,$(valid-arches))
403 akaros-all-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(all-arch-dirs)))
405 core-y := $(patsubst %/, %/built-in.o, $(core-y))
406 arch-y := $(patsubst %/, %/built-in.o, $(arch-y))
408 kbuild_akaros_main := $(core-y) $(arch-y)
409 akaros-deps := $(kbuild_akaros_main) kern/arch/$(ARCH)/$(KERNEL_LD)
411 kern_cpio := $(OBJDIR)/kern/initramfs.cpio
412 kern_cpio_obj := $(kern_cpio).o
414 # ext2 will crash at runtime if we don't have a block device. try to catch the
415 # errors now. if it is a bad one, you're just out of luck.
416 ifneq ($(CONFIG_EXT2FS),)
417 ext2-bdev := $(patsubst "%",%,$(CONFIG_EXT2_BDEV))
419 $(error EXT2 selected with no block device [$(ext2-bdev)], fix your .config)
421 ext2_bdev_obj = $(OBJDIR)/kern/$(shell basename $(ext2-bdev)).o
424 # a bit hacky: we want to make sure the directories exist, and error out
425 # otherwise. we also want to error out before the initramfs target, otherwise
426 # we might not get the error (if initramfs files are all up to date). the
427 # trickiest thing here is that kfs-paths-check could be stale and require an
428 # oldconfig. running make twice should suffice.
429 kfs-paths-check := $(shell for i in $(kfs-paths); do \
430 if [ ! -d "$$i" ]; then \
431 echo "Can't find KFS directory $$i"; \
432 $(MAKE) -f $(srctree)/Makefile \
433 silentoldconfig > /dev/null; \
438 ifneq (ok,$(kfs-paths-check))
439 $(error $(kfs-paths-check), try make one more time in case of stale configs)
442 kern_initramfs_files := $(shell find $(kfs-paths))
444 # Need to make an empty cpio, then append each kfs-path's contents
445 $(kern_cpio) initramfs: $(kern_initramfs_files)
446 @echo " Building initramfs:"
447 @if [ "$(CONFIG_KFS_CPIO_BIN)" != "" ]; then \
448 sh $(CONFIG_KFS_CPIO_BIN); \
450 @cat /dev/null | cpio --quiet -oH newc -O $(kern_cpio)
451 $(Q)for i in $(kfs-paths); do cd $$i; \
452 echo " Adding $$i to initramfs..."; \
453 find -L . | cpio --quiet -oAH newc -O $(CURDIR)/$(kern_cpio); \
457 ld_emulation = $(shell $(OBJDUMP) -i | grep -v BFD | grep ^[a-z] |head -n1)
458 ld_arch = $(shell $(OBJDUMP) -i | grep -v BFD | grep "^ [a-z]" | head -n1)
460 # Our makefile doesn't detect a change in subarch, and old binary objects that
461 # don't need to be updated won't get rebuilt, but they also can't link with the
462 # new subarch (32 bit vs 64 bit). If we detect the wrong type, we'll force a
464 existing-cpio-emul := $(shell objdump -f $(kern_cpio_obj) 2> /dev/null | \
465 grep format | sed 's/.*format //g')
466 ifneq ($(existing-cpio-emul),)
467 ifneq ($(existing-cpio-emul),$(ld_emulation))
468 $(kern_cpio_obj): cpio-rebuild
470 $(Q)rm $(kern_cpio_obj)
474 $(kern_cpio_obj): $(kern_cpio)
475 $(Q)$(OBJCOPY) -I binary -B $(ld_arch) -O $(ld_emulation) $< $@
477 existing-ext2b-emul := $(shell objdump -f $(kern_cpio_obj) 2> /dev/null | \
478 grep format | sed 's/.*format //g')
479 ifneq ($(existing-ext2b-emul),)
480 ifneq ($(existing-ext2b-emul),$(ld_emulation))
481 $(ext2_bdev_obj): ext2b-rebuild
483 $(Q)rm $(ext2_bdev_obj)
487 $(ext2_bdev_obj): $(ext2-bdev)
488 $(Q)$(OBJCOPY) -I binary -B $(ld_arch) -O $(ld_emulation) $< $@
490 # Not the worlds most elegant link command. link-kernel takes the obj output
491 # name, then the linker script, then everything else you'd dump on the ld
492 # command line, including linker options and objects to link together.
494 # After the script is done, we run the arch-specific command directly.
495 quiet_cmd_link-akaros = LINK $@
496 cmd_link-akaros = $(CONFIG_SHELL) scripts/link-kernel.sh $@ \
497 kern/arch/$(ARCH)/$(KERNEL_LD) $(LDFLAGS_KERNEL) \
498 $(akaros-deps) $(gcc-lib) $(kern_cpio_obj) \
500 $(ARCH_POST_LINK_CMD)
502 # For some reason, the if_changed doesn't work with FORCE (like it does in
503 # Linux). It looks like it can't find the .cmd file or something (also
504 # complaints of $(targets), so that all is probably messed up).
505 $(KERNEL_OBJ): $(akaros-deps) $(kern_cpio_obj) $(ext2_bdev_obj)
506 $(call if_changed,link-akaros)
508 akaros-kernel: $(KERNEL_OBJ)
510 $(sort $(akaros-deps)): $(akaros-dirs) ;
512 # Recursively Kbuild all of our directories. If we're changing arches
513 # mid-make, we might have issues ( := on akaros-dirs, etc).
514 PHONY += $(akaros-dirs) cc_exists
515 $(akaros-dirs): scripts symlinks cc-exists
516 $(Q)$(MAKE) $(build)=$@
519 @if [ "`which $(CROSS_COMPILE)gcc`" = "" ]; then echo \
520 Could not find a $(CROSS_COMPILE) version of GCC/binutils. \
521 Be sure to build the cross-compiler and update your PATH; exit 1; fi
523 $(CMP_KERNEL_OBJ): $(KERNEL_OBJ)
524 @echo "Compressing kernel image"
527 # TODO: not sure what all we want to have available for config targets
528 # (anything after this is allowed. We currently need clean targets available
529 # (config->symlinks->clean).
530 endif #ifeq ($(config-targets),1)
531 endif #ifeq ($(mixed-targets),1)
533 # Akaros Userspace Building and Misc Helpers
534 # =========================================================================
535 # Recursively make user libraries and tests.
537 # User library makefiles are built to expect to be called from their own
538 # directories. The test code can be called from the root directory.
540 # List all userspace directories here, and state any dependencies between them,
541 # such as how pthread depends on parlib.
543 user-dirs = parlib pthread benchutil iplib ndblib bsd
545 pthread: parlib benchutil
550 PHONY += install-libs $(user-dirs)
551 install-libs: $(user-dirs) symlinks cc-exists
554 @cd user/$@ && $(MAKE) && $(MAKE) install
557 PHONY += userclean $(clean-user-dirs)
558 clean-user-dirs := $(addprefix _clean_user_,$(user-dirs))
559 userclean: $(clean-user-dirs) testclean utestclean
562 @cd user/$(patsubst _clean_user_%,%,$@) && $(MAKE) clean
566 @$(MAKE) -f tests/Makefile
570 @cd user/$@ && $(MAKE)
573 @$(MAKE) -f tests/Makefile clean
576 @cd user/utest && $(MAKE) clean
579 PHONY += fill-kfs unfill-kfs
580 XCC_SO_FILES = $(addprefix $(XCC_TARGET_ROOT)/lib/, *.so*)
582 $(OBJDIR)/.dont-force-fill-kfs:
583 $(Q)rm -rf $(addprefix $(FIRST_KFS_PATH)/lib/, $(notdir $(XCC_SO_FILES)))
584 @echo "Cross Compiler 'so' files removed from KFS"
585 @$(MAKE) -f tests/Makefile uninstall
586 @echo "Apps from /test removed from KFS"
587 @cd user/utest && $(MAKE) uninstall
588 @echo "User space tests removed from KFS"
589 @touch $(OBJDIR)/.dont-force-fill-kfs
591 fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs
592 @mkdir -p $(FIRST_KFS_PATH)/lib
593 $(Q)cp -uP $(XCC_SO_FILES) $(FIRST_KFS_PATH)/lib
594 @echo "Cross Compiler 'so' files installed to KFS"
595 @$(MAKE) -f tests/Makefile install
596 @echo "Apps from /test installed to KFS"
597 @cd user/utest && $(MAKE) install
598 @echo "User space tests installed to KFS"
600 # Use doxygen to make documentation for ROS (Untested since 2010 or so)
601 doxygen-dir := $(CUR_DIR)/Documentation/doxygen
603 @echo " Making doxygen"
604 @doxygen-dir=$(doxygen-dir) doxygen $(doxygen-dir)/rosdoc.cfg
605 @if [ ! -d $(doxygen-dir)/rosdoc/html/img ]; \
607 ln -s ../../img $(doxygen-dir)/rosdoc/html; \
611 @echo + clean [ROSDOC]
612 @rm -rf $(doxygen-dir)/rosdoc
615 @echo + clean [OBJDIR]
618 realclean: userclean mrproper doxyclean objclean
621 # =========================================================================
622 # This is mostly the Linux kernel cleaning. We could hook in to the userspace
623 # cleaning with the 'userclean' target attached to clean, though historically
624 # 'clean' means the kernel.
626 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
628 # $(Q)$(MAKE) $(clean)=dir
629 clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
631 # clean - Delete all generated files
633 clean-dirs := $(addprefix _clean_,$(akaros-all-dirs))
635 PHONY += $(clean-dirs) clean
637 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
639 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
640 -o -name .pc -o -name .hg -o -name .git \) -prune -o
642 @find $(patsubst _clean_%,%,$(clean-dirs)) $(RCS_FIND_IGNORE) \
643 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
645 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
646 -o -name '*.symtypes' -o -name 'modules.order' \
647 -o -name modules.builtin -o -name '.tmp_*.o.*' \
648 -o -name '*.gcno' \) -type f -print | xargs rm -f
650 # Could add in an archclean if we need arch-specific cleanup, or a userclean if
651 # we want to start cleaning that too.
655 # mrproper - Delete all generated files, including .config, and reset ARCH
657 mrproper-dirs := $(addprefix _mrproper_,scripts)
659 PHONY += $(mrproper-dirs) mrproper
661 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
663 mrproper: $(mrproper-dirs) clean clean_symlinks
665 @find $(patsubst _mrproper_%,%,$(mrproper-dirs)) $(RCS_FIND_IGNORE) \
666 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
668 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
669 -o -name '*.symtypes' -o -name 'modules.order' \
670 -o -name modules.builtin -o -name '.tmp_*.o.*' \
671 -o -name '*.gcno' \) -type f -print | xargs rm -f
674 # =========================================================================
679 # Don't put the srctree on this, make is looking for Makefile, not
680 # /full/path/to/Makefile.
681 Makefile: ; # avoid implicit rule on Makefile
683 # Declare the contents of the .PHONY variable as phony. We keep that
684 # information in a variable so we can use it in if_changed and friends.