From 4fb8cb0cd5c5341caaedd7b9052e76c52a6e6d2c Mon Sep 17 00:00:00 2001 From: Vitor Antunes Date: Mon, 10 Aug 2015 22:04:38 +0100 Subject: [PATCH 1/3] build: Simplify message display during make This was only implemented in the main Makefile and mk_mingw. The normal verbose output can be enabled by calling make as following: make V=1 --- Makefile.in | 51 +++++++++++++++++++++++++++++++++++---------------- mk_mingw.mak | 31 ++++++++++++++++++++++++------- 2 files changed, 59 insertions(+), 23 deletions(-) diff --git a/Makefile.in b/Makefile.in index 95188aa38f..2f9ede1fff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -156,16 +156,31 @@ DEST_READ_INC = $(incdir)/$(READ_INC) DEST_CMAN = $(man1dir)/$(CMAN) DEST_EMAN = $(man1dir)/$(EMAN) +# +# Silent/verbose commands +# +# when V is not set the output of commands is ommited or simplified +# +V ?= 0 + +SILENT = $(SILENT_$(V)) +SILENT_0 = @ +SILENT_1 = + +V_CC = $(V_CC_$(V)) +V_CC_0 = @echo [CC] $@; $(CC) +V_CC_1 = $(CC) + # # primary rules # all: $(CTAGS_EXEC) $(READ_LIB) $(READ_CMD) $(CTAGS_EXEC): $(OBJECTS) - $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) + $(V_CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) $(READ_CMD): readtags.c readtags.h - $(CC) -DREADTAGS_MAIN -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/readtags.c + $(V_CC) -DREADTAGS_MAIN -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/readtags.c $(OBJECTS): $(HEADERS) config.h Makefile @@ -174,16 +189,16 @@ $(OBJECTS): $(HEADERS) config.h Makefile # works with GNU make but should be harmless for other implementations. %: Makefile Makefile: Makefile.in config.status - ./config.status --file $@ + $(SILENT) ./config.status --file $@ config.h: config.h.in config.status - ./config.status --header $@ + $(SILENT) ./config.status --header $@ # Regenerate the build system whenever it changed config.status: configure - ./config.status --recheck + $(SILENT) ./config.status --recheck configure: configure.ac - cd $(srcdir) && autoreconf -vi + $(SILENT) cd $(srcdir) && autoreconf -vi # # generic install rules @@ -336,8 +351,9 @@ TAGS: $(CTAGS_EXEC) ./$(CTAGS_EXEC) -e $(srcdir)/* clean: clean-units clean-gcov clean-tmain - rm -f $(OBJECTS) $(CTAGS_EXEC) tags TAGS $(READ_LIB) - rm -f $(SOURCES:.c=.gcno) + $(SILENT) echo Cleaning top level + $(SILENT) rm -f $(OBJECTS) $(CTAGS_EXEC) tags TAGS $(READ_LIB) + $(SILENT) rm -f $(SOURCES:.c=.gcno) mostlyclean: clean @@ -352,8 +368,8 @@ maintainerclean: distclean # implicit rules # .c.$(OBJEXT): - dir="$$(dirname $@)"; [ -d "$$dir" ] || $(MKDIR_P) "$$dir" - $(CC) -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $< + $(SILENT) dir="$$(dirname $@)"; [ -d "$$dir" ] || $(MKDIR_P) "$$dir" + $(V_CC) -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $< $(addsuffix .$(OBJEXT),$(basename $(notdir $(REGEX_SOURCES)))): ALL_CPPFLAGS += \ -D_GNU_SOURCE -D__USE_GNU -Dbool=int -Dfalse=0 -Dtrue=1 @@ -441,8 +457,9 @@ units: $(CTAGS_TEST) $(SHELL) $${c} $(srcdir)/Units $${builddir}/Units clean-units: - builddir=$$(pwd); \ - $(SHELL) $(srcdir)/misc/units clean $${builddir}/Units + $(SILENT) echo Cleaning test units + $(SILENT) builddir=$$(pwd); \ + $(SHELL) $(srcdir)/misc/units clean $${builddir}/Units # # Test main part, not parsers @@ -462,8 +479,9 @@ tmain: $(CTAGS_TEST) $(SHELL) $${c} $(srcdir)/Tmain $${builddir}/Tmain clean-tmain: - builddir=$$(pwd); \ - $(SHELL) $(srcdir)/misc/units clean-tmain $${builddir}/Tmain + $(SILENT) echo Cleaning main part tests + $(SILENT) builddir=$$(pwd); \ + $(SHELL) $(srcdir)/misc/units clean-tmain $${builddir}/Tmain # # Test installation @@ -490,7 +508,8 @@ run-gcov: gcov $$(find -name '*.gcda') clean-gcov: - rm -f $(SOURCES:.c=.gcda) - rm -f $(srcdir)/*.gcov + $(SILENT) echo Cleaning coverage reports + $(SILENT) rm -f $(SOURCES:.c=.gcda) + $(SILENT) rm -f $(srcdir)/*.gcov # vi:set tabstop=8: diff --git a/mk_mingw.mak b/mk_mingw.mak index 7826d7bf49..cbfb0ec3ec 100644 --- a/mk_mingw.mak +++ b/mk_mingw.mak @@ -25,20 +25,37 @@ dctags.exe: SOURCES += debug.c .SUFFIXES: .c.o +# +# Silent/verbose commands +# +# when V is not set the output of commands is ommited or simplified +# +V ?= 0 + +SILENT = $(SILENT_$(V)) +SILENT_0 = @ +SILENT_1 = + +V_CC = $(V_CC_$(V)) +V_CC_0 = @echo [CC] $@; $(CC) +V_CC_1 = $(CC) + + .c.o: - $(CC) -c $(OPT) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< + $(V_CC) -c $(OPT) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< ctags: ctags.exe dctags: dctags.exe ctags.exe dctags.exe: $(OBJECTS) $(HEADERS) $(REGEX_HEADERS) $(FNMATCH_HEADERS) - $(CC) $(OPT) $(CFLAGS) $(LDFLAGS) $(DEFINES) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) + $(V_CC) $(OPT) $(CFLAGS) $(LDFLAGS) $(DEFINES) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) readtags.exe: readtags.c - $(CC) $(OPT) $(CFLAGS) -DREADTAGS_MAIN $(DEFINES) $(INCLUDES) -o $@ $< + $(V_CC) $(OPT) $(CFLAGS) -DREADTAGS_MAIN $(DEFINES) $(INCLUDES) -o $@ $< clean: - - rm -f ctags.exe - - rm -f dctags.exe - - rm -f tags - - rm -f main/*.o parsers/*.o gnu_regex/*.o fnmatch/*.o + $(SILENT) echo Cleaning + $(SILENT) rm -f ctags.exe + $(SILENT) rm -f dctags.exe + $(SILENT) rm -f tags + $(SILENT) rm -f main/*.o parsers/*.o gnu_regex/*.o fnmatch/*.o From 5d45a673914b4cd5ad052cac6f0c1574b765a9b1 Mon Sep 17 00:00:00 2001 From: Vitor Antunes Date: Tue, 15 Sep 2015 22:25:49 +0200 Subject: [PATCH 2/3] build: Do not include $(CC) call in $(V_CC) --- Makefile.in | 10 +++++----- mk_mingw.mak | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2f9ede1fff..6803b7d9c5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -168,8 +168,8 @@ SILENT_0 = @ SILENT_1 = V_CC = $(V_CC_$(V)) -V_CC_0 = @echo [CC] $@; $(CC) -V_CC_1 = $(CC) +V_CC_0 = @echo [CC] $@; +V_CC_1 = # # primary rules @@ -177,10 +177,10 @@ V_CC_1 = $(CC) all: $(CTAGS_EXEC) $(READ_LIB) $(READ_CMD) $(CTAGS_EXEC): $(OBJECTS) - $(V_CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) + $(V_CC) $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) $(READ_CMD): readtags.c readtags.h - $(V_CC) -DREADTAGS_MAIN -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/readtags.c + $(V_CC) $(CC) -DREADTAGS_MAIN -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(srcdir)/readtags.c $(OBJECTS): $(HEADERS) config.h Makefile @@ -369,7 +369,7 @@ maintainerclean: distclean # .c.$(OBJEXT): $(SILENT) dir="$$(dirname $@)"; [ -d "$$dir" ] || $(MKDIR_P) "$$dir" - $(V_CC) -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $< + $(V_CC) $(CC) -I. -I$(srcdir) -I$(srcdir)/main $(DEFS) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $< $(addsuffix .$(OBJEXT),$(basename $(notdir $(REGEX_SOURCES)))): ALL_CPPFLAGS += \ -D_GNU_SOURCE -D__USE_GNU -Dbool=int -Dfalse=0 -Dtrue=1 diff --git a/mk_mingw.mak b/mk_mingw.mak index cbfb0ec3ec..73e0395c60 100644 --- a/mk_mingw.mak +++ b/mk_mingw.mak @@ -37,21 +37,21 @@ SILENT_0 = @ SILENT_1 = V_CC = $(V_CC_$(V)) -V_CC_0 = @echo [CC] $@; $(CC) -V_CC_1 = $(CC) +V_CC_0 = @echo [CC] $@; +V_CC_1 = .c.o: - $(V_CC) -c $(OPT) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< + $(V_CC) $(CC) -c $(OPT) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< ctags: ctags.exe dctags: dctags.exe ctags.exe dctags.exe: $(OBJECTS) $(HEADERS) $(REGEX_HEADERS) $(FNMATCH_HEADERS) - $(V_CC) $(OPT) $(CFLAGS) $(LDFLAGS) $(DEFINES) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) + $(V_CC) $(CC) $(OPT) $(CFLAGS) $(LDFLAGS) $(DEFINES) $(INCLUDES) -o $@ $(OBJECTS) $(LIBS) readtags.exe: readtags.c - $(V_CC) $(OPT) $(CFLAGS) -DREADTAGS_MAIN $(DEFINES) $(INCLUDES) -o $@ $< + $(V_CC) $(CC) $(OPT) $(CFLAGS) -DREADTAGS_MAIN $(DEFINES) $(INCLUDES) -o $@ $< clean: $(SILENT) echo Cleaning From 42008d02d32a34d421dd034ba06cb9d6c20aff5c Mon Sep 17 00:00:00 2001 From: Vitor Antunes Date: Mon, 14 Sep 2015 01:25:21 +0100 Subject: [PATCH 3/3] build: Add "help" target to Makefile.in --- Makefile.in | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 6803b7d9c5..24ea19a462 100644 --- a/Makefile.in +++ b/Makefile.in @@ -401,7 +401,7 @@ ifdef TRAVIS SHOW_DIFF_OUTPUT=--show-diff-output endif -.PHONY: check units fuzz noise tmain tinst clean-units clean-tmain clean-gcov run-gcov codecheck +.PHONY: check units fuzz noise tmain tinst clean-units clean-tmain clean-gcov run-gcov codecheck help check: tmain units # @@ -512,4 +512,27 @@ clean-gcov: $(SILENT) rm -f $(SOURCES:.c=.gcda) $(SILENT) rm -f $(srcdir)/*.gcov +# +# Help +# +help: + @echo "Compilation targets:" + @echo "" + @echo "make - Build $(CTAGS_PROG)" + @echo "make V=1 - Build $(CTAGS_PROG) - verbose output" + @echo "make -f mk_mingw.mak - Build $(CTAGS_PROG) using MinGW" + @echo "make -f mk_mingw.mak V=1 - Build $(CTAGS_PROG) using MinGW - verbose output" + @echo "" + @echo "Testing targets:" + @echo "" + @echo "make units - Run parser unit test cases" + @echo "make tmain - Run ctags main functionality test cases" + @echo "make fuzz - Verify that all parsers are able to properly process each available test unit" + @echo "make noise - TODO" + @echo + @echo "Arguments that can be used in testing targets:" + @echo "VG=1 - Run test cases with Valgrind memory profiler" + @echo "LANGUAGES=[,] - Only run test cases of the selected languages" + @echo "CATEGORIES= - Only run tests available under folder Units/.r" + # vi:set tabstop=8: