Refpolicy: Add target to create tags file
Subsystems (2)
The attached patch adds a target to the makefile to create a tags-file. It is ported from the old policy, with a few changes for refpolicy. It allows vim (and others) to quickly jump to the definition of interfaces, booleans, and so on.
Another neat feature: You can autocomplete all interface-names in vim with C-N and C-P if you have an appropriate tags-file. I find this very useful with the new (rather long) interface names.
Please apply.
Thomas
Makefile +24 -1
@@ -319,6 +319,28 @@ ######################################## # +# Generate tags file +# + +# we need exuberant ctags; unfortunately it is named differently on different distros, sigh... +pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH))))) # taken from make-docs +CTAGS := $(call pathsearch,ctags-exuberant) # debian naming scheme +ifeq ($(strip $(CTAGS)),) +CTAGS := $(call pathsearch,ctags) # suse naming scheme +endif + +tags: + @($(CTAGS) --version | grep -q Exuberant) || (echo ERROR: Need exuberant-ctags to function!; exit 1) + @LC_ALL=C $(CTAGS) --langdef=te --langmap=te:..te.if.spt \ + --regex-te='/^type[ \t]+(\w+)(,|;)/\1/t,type/' \ + --regex-te='/^typealias[ \t]+\w+[ \t+]+alias[ \t]+(\w+);/\1/t,type/' \ + --regex-te='/^attribute[ \t]+(\w+);/\1/a,attribute/' \ + --regex-te='/^[ \t]*define\(`(\w+)/\1/d,define/' \ + --regex-te='/^[ \t]*interface\(`(\w+)/\1/i,interface/' \ + --regex-te='/^[ \t]*bool[ \t]+(\w+)/\1/b,bool/' policy/modules/*/*.{if,te} policy/support/*.spt + +######################################## +# # Clean everything # bare: clean
@@ -328,6 +350,7 @@ rm -f $(MOD_CONF) rm -f $(BOOLEANS) rm -fR $(HTMLDIR) + rm -f tags ifneq ($(GENERATED_TE),) rm -f $(GENERATED_TE) endif
@@ -338,6 +361,6 @@ rm -f $(GENERATED_FC) endif -.PHONY: install-src install-appconfig conf html bare +.PHONY: install-src install-appconfig conf html bare tags .SUFFIXES: .SUFFIXES: .c
Quoted 4 lines · Thomas Bleher
The attached patch adds a target to the makefile to create a tags-file. It is ported from the old policy, with a few changes for refpolicy. It allows vim (and others) to quickly jump to the definition of interfaces, booleans, and so on.
Merged.
Quoted 3 lines
Another neat feature: You can autocomplete all interface-names in vim with C-N and C-P if you have an appropriate tags-file. I find this very useful with the new (rather long) interface names.
If you think they're long, you should have seen very early prototypes of refpolicy; many of the names were 50%-100% longer than they are now. :)
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 7 lines · Christopher J. PeBenito
Quoted 4 lines · Thomas Bleher
The attached patch adds a target to the makefile to create a tags-file. It is ported from the old policy, with a few changes for refpolicy. It allows vim (and others) to quickly jump to the definition of interfaces, booleans, and so on.
Merged.
I forgot to mention that I changed the ctags program detection to be based on the DISTRO setting, since Gentoo has a different command too, and I made "ctags" the fallback command.
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.