From 37227dcd9464a56f25c437fda328cea216911fd0 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Wed, 25 Jan 2006 18:30:27 +0000 Subject: [PATCH] Add ctags Make target from Thomas Bleher. --- refpolicy/Changelog | 1 + refpolicy/Makefile | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/refpolicy/Changelog b/refpolicy/Changelog index 0c39d9eb3..0b9aa7bb5 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -1,3 +1,4 @@ +- Add ctags Make target from Thomas Bleher. - Collapse commands with grep piped to sed into one sed command. - Fix type_change bug in term_user_pty(). - Move ice_tmp_t from miscfiles to xserver. diff --git a/refpolicy/Makefile b/refpolicy/Makefile index 6af4ab4e6..5aff9af9e 100644 --- a/refpolicy/Makefile +++ b/refpolicy/Makefile @@ -128,6 +128,20 @@ endif override M4PARAM += -D hide_broken_symptoms +# we need exuberant ctags; unfortunately it is named +# differently on different distros +ifeq ($(DISTRO),debian) + CTAGS := ctags-exuberant +endif + +ifeq ($(DISTRO),gentoo) + CTAGS := exuberant-ctags +endif + +ifeq ($(CTAGS),) + CTAGS := ctags +endif + # determine the policy version and current kernel version if possible PV := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ') KV := $(shell cat /selinux/policyvers) @@ -317,6 +331,20 @@ install-src: mkdir -p $(SRCPATH)/policy cp -R . $(SRCPATH)/policy +######################################## +# +# Generate tags file +# +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 @@ -328,6 +356,7 @@ bare: clean rm -f $(MOD_CONF) rm -f $(BOOLEANS) rm -fR $(HTMLDIR) + rm -f tags ifneq ($(GENERATED_TE),) rm -f $(GENERATED_TE) endif @@ -338,6 +367,6 @@ ifneq ($(GENERATED_FC),) 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