patch: tags Makefile target
Subsystems (2)
This patch adds a Makefile target which creates a tags file. I find this extremely handy when working on SELinux policy as I can directly jump to the definition of a macro or type in the editor.
Thomas
Signature · 2 lines
http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA D09E C562 2BAE B2F4 ABE7
Makefile +18 -0
@@ -162,8 +162,26 @@ @grep "^/root" [email protected] >> $@ @-rm [email protected] [email protected] +# Create a tags-file for the policy: +# 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: $(wildcard *.te types/*.te domains/*.te domains/misc/*.te domains/program/*.te domains/program/unused/*.te macros/*.te macros/program/*.te) + @($(CTAGS) --version | grep -q Exuberant) || (echo ERROR: Need exuberant-ctags to function!; exit 1) + @LC_ALL=C $(CTAGS) --langdef=te --langmap=te:..te \ + --regex-te='/^[ \t]*type[ \t]+(\w+)(,|;)/\1/t,type/' \ + --regex-te='/^[ \t]*typealias[ \t]+\w+[ \t+]+alias[ \t]+(\w+);/\1/t,type/' \ + --regex-te='/^[ \t]*attribute[ \t]+(\w+);/\1/a,attribute/' \ + --regex-te='/^[ \t]*define\(`(\w+)/\1/d,define/' \ + --regex-te='/^[ \t]*bool[ \t]+(\w+)/\1/b,bool/' $^ + clean: rm -f policy.conf $(POLICYVER) + rm -f tags rm -f tmp/* rm -f $(FC) rm -f flask/*.h
Merged.
Quoted 5 lines · Thomas Bleher
This patch adds a
Makefiletarget which creates a tags file. I find this extremely handy when working on SELinux policy as I can directly jump to the definition of a macro or type in the editor.Thomas
Signature · 7 lines
James Carter <[email protected]> National Security Agency -- 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.