diff options
| author | Sam Ravnborg <sam@ravnborg.org> | 2008-12-03 16:24:13 -0500 |
|---|---|---|
| committer | Sam Ravnborg <sam@ravnborg.org> | 2008-12-03 16:24:13 -0500 |
| commit | a680eedc6c621c75695c68198533fc3c98f4053b (patch) | |
| tree | c2d1751b5d7ff84aa664e4442ee1e8e2b053c6b9 /Makefile | |
| parent | f6682f915760ccfe57ef1b6cd5ff2d8f2bf8c1d4 (diff) | |
tags and cscope support really belongs in a shell script
as they do not benefit from the make functionality.
Moving the support to a shell script has several benefits:
- The readability of the code has increased a lot
- More people is able to extend the tags support
- We see less changes to the top-level Makefile
The shell script version includes improvements from:
Alexey Dobriyan <adobriyan@gmail.com> (jump to kconfig symbols)
Alexey Dobriyan <adobriyan@gmail.com> (drop ./ in paths)
Ian Campbell <ijc@hellion.org.uk> (simplified find algorithms)
This version has a few caveats:
=> It does not support ALLSOURCE_ARCHS
- it is easy to add if it is really used
=> It assumes all archs have moved to arch/$ARCH/include
- until that happens we have a few additional hits in the archs
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 117 |
1 files changed, 3 insertions, 114 deletions
| @@ -1409,123 +1409,12 @@ endif # KBUILD_EXTMOD | |||
| 1409 | 1409 | ||
| 1410 | # Generate tags for editors | 1410 | # Generate tags for editors |
| 1411 | # --------------------------------------------------------------------------- | 1411 | # --------------------------------------------------------------------------- |
| 1412 | quiet_cmd_tags = GEN $@ | ||
| 1413 | cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@ | ||
| 1412 | 1414 | ||
| 1413 | #We want __srctree to totally vanish out when KBUILD_OUTPUT is not set | 1415 | tags TAGS cscope: FORCE |
| 1414 | #(which is the most common case IMHO) to avoid unneeded clutter in the big tags file. | ||
| 1415 | #Adding $(srctree) adds about 20M on i386 to the size of the output file! | ||
| 1416 | |||
| 1417 | ifeq ($(src),$(obj)) | ||
| 1418 | __srctree = | ||
| 1419 | else | ||
| 1420 | __srctree = $(srctree)/ | ||
| 1421 | endif | ||
| 1422 | |||
| 1423 | ifeq ($(ALLSOURCE_ARCHS),) | ||
| 1424 | ifeq ($(ARCH),um) | ||
| 1425 | ALLINCLUDE_ARCHS := $(ARCH) $(SUBARCH) | ||
| 1426 | else | ||
| 1427 | ALLINCLUDE_ARCHS := $(SRCARCH) | ||
| 1428 | endif | ||
| 1429 | else | ||
| 1430 | #Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour. | ||
| 1431 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) | ||
| 1432 | endif | ||
| 1433 | |||
| 1434 | ALLSOURCE_ARCHS := $(SRCARCH) | ||
| 1435 | |||
| 1436 | define find-sources | ||
| 1437 | ( for arch in $(ALLSOURCE_ARCHS) ; do \ | ||
| 1438 | find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \ | ||
| 1439 | -wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \ | ||
| 1440 | -o -name $1 -print; \ | ||
| 1441 | done ; \ | ||
| 1442 | find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ | ||
| 1443 | -name $1 -print; \ | ||
| 1444 | find $(__srctree)include $(RCS_FIND_IGNORE) \ | ||
| 1445 | \( -name config -o -name 'asm-*' \) -prune \ | ||
| 1446 | -o -name $1 -print; \ | ||
| 1447 | for arch in $(ALLINCLUDE_ARCHS) ; do \ | ||
| 1448 | test -e $(__srctree)include/asm-$${arch} && \ | ||
| 1449 | find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \ | ||
| 1450 | -name $1 -print; \ | ||
| 1451 | test -e $(__srctree)arch/$${arch}/include/asm && \ | ||
| 1452 | find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \ | ||
| 1453 | -name $1 -print; \ | ||
| 1454 | done ; \ | ||
| 1455 | find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ | ||
| 1456 | -name $1 -print; \ | ||
| 1457 | find $(__srctree) $(RCS_FIND_IGNORE) \ | ||
| 1458 | \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \ | ||
| 1459 | -name $1 -print; \ | ||
| 1460 | ) | ||
| 1461 | endef | ||
| 1462 | |||
| 1463 | define all-sources | ||
| 1464 | $(call find-sources,'*.[chS]') | ||
| 1465 | endef | ||
| 1466 | define all-kconfigs | ||
| 1467 | $(call find-sources,'Kconfig*') | ||
| 1468 | endef | ||
| 1469 | define all-defconfigs | ||
| 1470 | $(call find-sources,'defconfig') | ||
| 1471 | endef | ||
| 1472 | |||
| 1473 | define xtags | ||
| 1474 | if $1 --version 2>&1 | grep -iq exuberant; then \ | ||
| 1475 | $(all-sources) | xargs $1 -a \ | ||
| 1476 | -I __initdata,__exitdata,__acquires,__releases \ | ||
| 1477 | -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \ | ||
| 1478 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
| 1479 | --extra=+f --c-kinds=+px \ | ||
| 1480 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \ | ||
| 1481 | $(all-kconfigs) | xargs $1 -a \ | ||
| 1482 | --langdef=kconfig \ | ||
| 1483 | --language-force=kconfig \ | ||
| 1484 | --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'; \ | ||
| 1485 | $(all-defconfigs) | xargs -r $1 -a \ | ||
| 1486 | --langdef=dotconfig \ | ||
| 1487 | --language-force=dotconfig \ | ||
| 1488 | --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/'; \ | ||
| 1489 | elif $1 --version 2>&1 | grep -iq emacs; then \ | ||
| 1490 | $(all-sources) | xargs $1 -a; \ | ||
| 1491 | $(all-kconfigs) | xargs $1 -a \ | ||
| 1492 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'; \ | ||
| 1493 | $(all-defconfigs) | xargs -r $1 -a \ | ||
| 1494 | --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ | ||
| 1495 | else \ | ||
| 1496 | $(all-sources) | xargs $1 -a; \ | ||
| 1497 | fi | ||
| 1498 | endef | ||
| 1499 | |||
| 1500 | quiet_cmd_cscope-file = FILELST cscope.files | ||
| 1501 | cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files | ||
| 1502 | |||
| 1503 | quiet_cmd_cscope = MAKE cscope.out | ||
| 1504 | cmd_cscope = cscope -b -f cscope.out | ||
| 1505 | |||
| 1506 | cscope: FORCE | ||
| 1507 | $(call cmd,cscope-file) | ||
| 1508 | $(call cmd,cscope) | ||
| 1509 | |||
| 1510 | quiet_cmd_TAGS = MAKE $@ | ||
| 1511 | define cmd_TAGS | ||
| 1512 | rm -f $@; \ | ||
| 1513 | $(call xtags,etags) | ||
| 1514 | endef | ||
| 1515 | |||
| 1516 | TAGS: FORCE | ||
| 1517 | $(call cmd,TAGS) | ||
| 1518 | |||
| 1519 | quiet_cmd_tags = MAKE $@ | ||
| 1520 | define cmd_tags | ||
| 1521 | rm -f $@; \ | ||
| 1522 | $(call xtags,ctags) | ||
| 1523 | endef | ||
| 1524 | |||
| 1525 | tags: FORCE | ||
| 1526 | $(call cmd,tags) | 1416 | $(call cmd,tags) |
| 1527 | 1417 | ||
| 1528 | |||
| 1529 | # Scripts to check various things for consistency | 1418 | # Scripts to check various things for consistency |
| 1530 | # --------------------------------------------------------------------------- | 1419 | # --------------------------------------------------------------------------- |
| 1531 | 1420 | ||
