diff --git a/Makefile.config.in b/Makefile.config.in index 50b3eb1b3..4eb8e4850 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -158,6 +158,8 @@ INCLUDES = -I$(top_builddir) -I$(top_srcdir)/src COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) +MAKE_COLOR = @MAKE_COLOR@ + ### This is here because Makefile.config is usually the first thing ### we get and sometimes the all rule can be implicit, yet we want diff --git a/Makefile.lib b/Makefile.lib index e3cf4652b..bd825b5b5 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -14,36 +14,46 @@ else mquiet = quiet_ endif +# Colorize the build. +ifdef MAKE_COLOR + INFO_COLOR = \033[0;35m + CC_COLOR = \033[0;36m + LD_COLOR = \033[0;32m + LINK_COLOR = \033[1;34m + INSTALL_COLOR = \033[0;33m + END_COLOR = \033[0;0m +endif + # Show the command (quiet or non-quiet version based on the assignment # just above) and then execute it. -ncmd = $(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1)) -cmd = @$(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1)) -mcmd = @$(if $($(mquiet)cmd_$(1)),echo $($(mquiet)cmd_$(1)) &&) $(cmd_$(1)) +ncmd = $(if $($(quiet)cmd_$(1)),echo -e $($(quiet)cmd_$(1)) &&) $(cmd_$(1)) +cmd = @$(if $($(quiet)cmd_$(1)),echo -e $($(quiet)cmd_$(1)) &&) $(cmd_$(1)) +mcmd = @$(if $($(mquiet)cmd_$(1)),echo -e $($(mquiet)cmd_$(1)) &&) $(cmd_$(1)) -quiet_cmd_compile = ' [CC] $(RELPATH)$@' +quiet_cmd_compile = ' [$(CC_COLOR)CC$(END_COLOR)] $(RELPATH)$@' masq_cmd_compile = $(COMPILE) -c $< cmd_compile = $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< # Rule to compile a set of .o files into one .o file -quiet_cmd_ld_objs = " [LD] $(RELPATH)$@" +quiet_cmd_ld_objs = " [$(LD_COLOR)LD$(END_COLOR)] $(RELPATH)$@" cmd_ld_objs = $(LD) -r -o $@ $(filter $(OBJS), $^) \ $(foreach subdir,$(sort $(filter-out src,$(SUBDIRS))), \ `test -e $(subdir)/lib.o && echo $(subdir)/lib.o`) - quiet_cmd_link = ' [LINK] $(RELPATH)$@' + quiet_cmd_link = ' [$(LINK_COLOR)LINK$(END_COLOR)] $(RELPATH)$@' cmd_link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) quiet_cmd_sparse = ' [SPARSE] $(RELPATH)$(2)' cmd_sparse = $(SPARSE) $(DEFS) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) $(SPARSE_FLAGS) $(2) # Recursive make -quiet_cmd_recmake = "[MAKE $(3)] $(RELPATH)$(2)" - cmd_recmake = $(MAKE) -C $(2) $(3) +quiet_cmd_recmake = "[$(INFO_COLOR)MAKE $(3)$(END_COLOR)] $(RELPATH)$(2)" + cmd_recmake = $(MAKE) --no-print-directory -C $(2) $(3) -quiet_cmd_installdata = " [INSTALL] $(RELPATH)$(2) -> $(3)" +quiet_cmd_installdata = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH)$(2) -> $(3)" cmd_installdata = $(INSTALL_DATA) $(2) $(3) -quiet_cmd_installprog = " [INSTALL] $(RELPATH)$(2) -> $(3)" +quiet_cmd_installprog = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH)$(2) -> $(3)" cmd_installprog = $(INSTALL_PROGRAM) $(2) $(3) @@ -113,7 +123,7 @@ init-default: echo 'include $(SRC)/$(RELPATH)/$(subdir)/Makefile' > $(subdir)/Makefile;) clean-default: - -test -z "$(CLEAN)" || $(RM) $(CLEAN) + @-test -z "$(CLEAN)" || $(RM) $(CLEAN) cleanall-default: clean-default diff --git a/config/m4/features.m4 b/config/m4/features.m4 index 8c22d92e8..179f67a43 100644 --- a/config/m4/features.m4 +++ b/config/m4/features.m4 @@ -32,7 +32,7 @@ AC_DEFUN([EL_LOG_CONFIG], value="[$]$1" fi - echo "$about $dots $value" >> features.log + echo -e "$about $dots $value" >> features.log AC_SUBST([$1]) ]) diff --git a/config/mkinstalldirs b/config/mkinstalldirs index 732d62e1c..53546b4d8 100755 --- a/config/mkinstalldirs +++ b/config/mkinstalldirs @@ -21,7 +21,7 @@ do esac if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" + #echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? diff --git a/configure.in b/configure.in index cea40da85..fb37328ba 100644 --- a/configure.in +++ b/configure.in @@ -1257,6 +1257,15 @@ ALL_CFLAGS="$CFLAGS $CPPFLAGS" EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], []) EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], []) +dnl =================================================================== +dnl Colored make output +dnl =================================================================== + +if test $(`which tput` colors) -ge 4; then + MAKE_COLOR=1 + AC_SUBST(MAKE_COLOR) +fi + dnl =================================================================== dnl Generated files dnl =================================================================== diff --git a/contrib/grafthistory.sh b/contrib/grafthistory.sh index 3032e71b5..005b4b4eb 100755 --- a/contrib/grafthistory.sh +++ b/contrib/grafthistory.sh @@ -9,15 +9,22 @@ if [ -z "`which wget 2>/dev/null`" ]; then exit 1 fi -[ -d .git ] && cd .git +[ "$GIT_DIR" ] || GIT_DIR=.git +if ! [ -d "$GIT_DIR" ]; then + echo "Error: You must run this from the project root (or set GIT_DIR to your .git directory)." >&2 + exit 1 +fi +cd "$GIT_DIR" echo "[grafthistory] Downloading the history" +mkdir -p objects/pack cd objects/pack wget -c http://elinks.or.cz/elinks-history.git/objects/pack/pack-0d6c5c67aab3b9d5d9b245da5929c15d79124a48.idx wget -c http://elinks.or.cz/elinks-history.git/objects/pack/pack-0d6c5c67aab3b9d5d9b245da5929c15d79124a48.pack echo "[grafthistory] Setting up the grafts" cd ../.. +mkdir -p info # master echo 0f6d4310ad37550be3323fab80456e4953698bf0 06135dc2b8bb7ed2e441305bdaa82048396de633 >>info/grafts # REL_0_10 diff --git a/doc/Makefile b/doc/Makefile index fc440d6b3..08641d124 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -130,7 +130,7 @@ doc-dirs: # $(MAN_DIR) intentionally left out clean-local: - $(RM) -r $(HTML_DIR) $(XML_DIR) $(TXT_DIR) $(PDF_DIR) *.tmp + @$(RM) -r $(HTML_DIR) $(XML_DIR) $(TXT_DIR) $(PDF_DIR) *.tmp # Autogenerated asciidoc files. diff --git a/po/Makefile b/po/Makefile index be4177497..b1b3cd5b2 100644 --- a/po/Makefile +++ b/po/Makefile @@ -102,6 +102,6 @@ install-local: all-local ) clean-local: - rm -f $(PACKAGE).po *.new.po $(srcdir)/$(POTFILES_ABS_LIST) + @rm -f $(PACKAGE).po *.new.po $(srcdir)/$(POTFILES_ABS_LIST) include $(top_srcdir)/Makefile.lib diff --git a/src/document/dom/node.c b/src/document/dom/node.c index 87d41b61b..54a796a8f 100644 --- a/src/document/dom/node.c +++ b/src/document/dom/node.c @@ -145,10 +145,14 @@ dom_node_cmp(struct dom_node_search *search, struct dom_node *node) switch (key->type) { case DOM_NODE_ELEMENT: - return search->subtype - node->data.element.type; + if (node->data.element.type) + return search->subtype - node->data.element.type; + break; case DOM_NODE_ATTRIBUTE: - return search->subtype - node->data.attribute.type; + if (node->data.attribute.type) + return search->subtype - node->data.attribute.type; + break; default: break; diff --git a/src/document/dom/stack.c b/src/document/dom/stack.c index a5692a879..f7904b606 100644 --- a/src/document/dom/stack.c +++ b/src/document/dom/stack.c @@ -184,12 +184,11 @@ pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type, state = search_dom_stack(stack, type, string); if (state) - pop_dom_state(stack, type, state); + pop_dom_state(stack, state); } void -pop_dom_state(struct dom_stack *stack, enum dom_node_type type, - struct dom_stack_state *target) +pop_dom_state(struct dom_stack *stack, struct dom_stack_state *target) { struct dom_stack_state *state; unsigned int pos; diff --git a/src/document/dom/stack.h b/src/document/dom/stack.h index e1383cd6f..f3c624438 100644 --- a/src/document/dom/stack.h +++ b/src/document/dom/stack.h @@ -55,8 +55,8 @@ struct dom_stack { void *data; }; -#define dom_stack_has_parents(nav) \ - ((nav)->states && (nav)->depth > 0) +#define dom_stack_has_parents(stack) \ + ((stack)->states && (stack)->depth > 0) static inline struct dom_stack_state * get_dom_stack_state(struct dom_stack *stack, int top_offset) @@ -66,21 +66,21 @@ get_dom_stack_state(struct dom_stack *stack, int top_offset) return &stack->states[stack->depth - 1 - top_offset]; } -#define get_dom_stack_parent(nav) get_dom_stack_state(nav, 1) -#define get_dom_stack_top(nav) get_dom_stack_state(nav, 0) +#define get_dom_stack_parent(stack) get_dom_stack_state(stack, 1) +#define get_dom_stack_top(stack) get_dom_stack_state(stack, 0) #define get_dom_stack_state_data(stack, state) \ ((void *) &(stack)->state_objects[(state)->depth * (stack)->object_size]) /* The state iterators do not include the bottom state */ -#define foreach_dom_state(nav, item, pos) \ - for ((pos) = 1; (pos) < (nav)->depth; (pos)++) \ - if (((item) = &(nav)->states[(pos)])) +#define foreach_dom_state(stack, item, pos) \ + for ((pos) = 1; (pos) < (stack)->depth; (pos)++) \ + if (((item) = &(stack)->states[(pos)])) -#define foreachback_dom_state(nav, item, pos) \ - for ((pos) = (nav)->depth - 1; (pos) > 0; (pos)--) \ - if (((item) = &(nav)->states[(pos)])) +#define foreachback_dom_state(stack, item, pos) \ + for ((pos) = (stack)->depth - 1; (pos) > 0; (pos)--) \ + if (((item) = &(stack)->states[(pos)])) /* Dive through the stack states in search for the specified match. */ static inline struct dom_stack_state * @@ -127,9 +127,7 @@ void pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type, struct dom_string *string); /* Pop all stack states until a specific state is reached. */ -void -pop_dom_state(struct dom_stack *stack, enum dom_node_type type, - struct dom_stack_state *target); +void pop_dom_state(struct dom_stack *stack, struct dom_stack_state *target); /* Visit each node in the tree rooted at @root pre-order */ void walk_dom_nodes(struct dom_stack *stack, struct dom_node *root); diff --git a/src/document/sgml/parser.c b/src/document/sgml/parser.c index 50590553d..34bfdfb9e 100644 --- a/src/document/sgml/parser.c +++ b/src/document/sgml/parser.c @@ -255,7 +255,7 @@ parse_sgml_document(struct dom_stack *stack, struct scanner *scanner) pstate = get_dom_stack_state_data(stack, state); copy_struct(&pstate->end_token, token); - pop_dom_state(stack, DOM_NODE_ELEMENT, state); + pop_dom_state(stack, state); } } skip_scanner_token(scanner);