diff --git a/Makefile.config.in b/Makefile.config.in index 02fec130..583d8b15 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -1,25 +1,20 @@ # This is the automake's playground of our cool build system. -# $Id$ # # TODO: Make part of it autogenerated based on AC_SUBST() or something. SHELL = @SHELL@ -CURPATH = $(shell pwd) -TOPPATH = $(shell cd $(top_builddir) && pwd) -RELPATH = $(shell echo '$(CURPATH)' | sed 's,$(TOPPATH),,;s,^/,,;s,\([a-z0-9]\)$$,\1/,') - -PATHSCRIPT = case '@top_srcdir@' in /*) ;; *) echo $(top_builddir)/;; esac -PATHPREFIX = $(shell $(PATHSCRIPT)) - +TOPPATH = $(shell cd $(top_builddir) && pwd) +RELPATH = $(subst $(TOPPATH)/,,$(CURDIR)/) +PATHPREFIX = $(if $(patsubst /%,,@top_srcdir@),$(top_builddir)/) top_srcdir = $(PATHPREFIX)@top_srcdir@ -SRCPATH = $(shell cd $(top_srcdir)/$(RELPATH) && pwd) -ifeq ($(SRCPATH),$(CURPATH)) -srcdir = +ifeq (@top_srcdir@,.) +srcdir = else srcdir = $(top_srcdir)/$(RELPATH) endif + prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -93,11 +88,15 @@ XMLTO = @XMLTO@ X_CFLAGS = @X_CFLAGS@ XGETTEXT = @XGETTEXT@ -# :r !grep AC_SUBST\(CONFIG_ configure.in | sed 's/.*(\(.*\))$/\1 = @\1@/' | sort | uniq +#Warning: this one is not in configure.in so following line will not generate it +CONFIG_NLS = @CONFIG_NLS@ + +# :r !grep '(CONFIG_[A-Z0-9_]\+[^A-Z0-9_]' configure.in | sed 's/^.*(\(CONFIG_[A-Z0-9_]\+\)[^A-Z0-9_].*$/\1 = @\1@/' | sort | uniq + CONFIG_256_COLORS = @CONFIG_256_COLORS@ +CONFIG_88_COLORS = @CONFIG_88_COLORS@ CONFIG_ASCIIDOC = @CONFIG_ASCIIDOC@ CONFIG_BACKTRACE = @CONFIG_BACKTRACE@ -CONFIG_OS_BEOS = @CONFIG_OS_BEOS@ CONFIG_BITTORRENT = @CONFIG_BITTORRENT@ CONFIG_BOOKMARKS = @CONFIG_BOOKMARKS@ CONFIG_BZIP2 = @CONFIG_BZIP2@ @@ -106,8 +105,10 @@ CONFIG_COOKIES = @CONFIG_COOKIES@ CONFIG_CSS = @CONFIG_CSS@ CONFIG_DATA = @CONFIG_DATA@ CONFIG_DEBUG = @CONFIG_DEBUG@ +CONFIG_DOC = @CONFIG_DOC@ CONFIG_DOM = @CONFIG_DOM@ CONFIG_ECMASCRIPT = @CONFIG_ECMASCRIPT@ +CONFIG_ECMASCRIPT_SEE = @CONFIG_ECMASCRIPT_SEE@ CONFIG_ECMASCRIPT_SMJS = @CONFIG_ECMASCRIPT_SMJS@ CONFIG_EXMODE = @CONFIG_EXMODE@ CONFIG_FASTMEM = @CONFIG_FASTMEM@ @@ -116,44 +117,47 @@ CONFIG_FORMHIST = @CONFIG_FORMHIST@ CONFIG_FTP = @CONFIG_FTP@ CONFIG_GLOBHIST = @CONFIG_GLOBHIST@ CONFIG_GNUTLS = @CONFIG_GNUTLS@ +CONFIG_GNUTLS_OPENSSL_COMPAT = @CONFIG_GNUTLS_OPENSSL_COMPAT@ CONFIG_GOPHER = @CONFIG_GOPHER@ -CONFIG_SCRIPTING_GUILE = @CONFIG_SCRIPTING_GUILE@ +CONFIG_GPM = @CONFIG_GPM@ CONFIG_GZIP = @CONFIG_GZIP@ CONFIG_HTML_HIGHLIGHT = @CONFIG_HTML_HIGHLIGHT@ +CONFIG_IDN = @CONFIG_IDN@ CONFIG_INTERLINK = @CONFIG_INTERLINK@ CONFIG_IPV6 = @CONFIG_IPV6@ CONFIG_JW = @CONFIG_JW@ CONFIG_LEDS = @CONFIG_LEDS@ -CONFIG_SCRIPTING_LUA = @CONFIG_SCRIPTING_LUA@ CONFIG_MAILCAP = @CONFIG_MAILCAP@ +CONFIG_MANUAL = @CONFIG_MANUAL@ CONFIG_MARKS = @CONFIG_MARKS@ CONFIG_MD5 = @CONFIG_MD5@ CONFIG_MIMETYPES = @CONFIG_MIMETYPES@ CONFIG_MOUSE = @CONFIG_MOUSE@ -CONFIG_NLS = @CONFIG_NLS@ CONFIG_NNTP = @CONFIG_NNTP@ CONFIG_NO_ROOT_EXEC = @CONFIG_NO_ROOT_EXEC@ CONFIG_OPENSSL = @CONFIG_OPENSSL@ +CONFIG_OS_BEOS = @CONFIG_OS_BEOS@ CONFIG_OS_OS2 = @CONFIG_OS_OS2@ -CONFIG_OWN_LIBC = @CONFIG_OWN_LIBC@ -CONFIG_SCRIPTING_PERL = @CONFIG_SCRIPTING_PERL@ -CONFIG_POD2HTML = @CONFIG_POD2HTML@ -CONFIG_SCRIPTING_PYTHON = @CONFIG_SCRIPTING_PYTHON@ CONFIG_OS_RISCOS = @CONFIG_OS_RISCOS@ -CONFIG_SCRIPTING_RUBY = @CONFIG_SCRIPTING_RUBY@ +CONFIG_OS_UNIX = @CONFIG_OS_UNIX@ +CONFIG_OS_WIN32 = @CONFIG_OS_WIN32@ +CONFIG_OWN_LIBC = @CONFIG_OWN_LIBC@ +CONFIG_POD2HTML = @CONFIG_POD2HTML@ CONFIG_SCANNER = @CONFIG_SCANNER@ CONFIG_SCRIPTING = @CONFIG_SCRIPTING@ -CONFIG_SEE = @CONFIG_SEE@ +CONFIG_SCRIPTING_GUILE = @CONFIG_SCRIPTING_GUILE@ +CONFIG_SCRIPTING_LUA = @CONFIG_SCRIPTING_LUA@ +CONFIG_SCRIPTING_PERL = @CONFIG_SCRIPTING_PERL@ +CONFIG_SCRIPTING_PYTHON = @CONFIG_SCRIPTING_PYTHON@ +CONFIG_SCRIPTING_RUBY = @CONFIG_SCRIPTING_RUBY@ +CONFIG_SCRIPTING_SPIDERMONKEY = @CONFIG_SCRIPTING_SPIDERMONKEY@ CONFIG_SHA1 = @CONFIG_SHA1@ CONFIG_SMALL = @CONFIG_SMALL@ CONFIG_SMB = @CONFIG_SMB@ -CONFIG_SCRIPTING_SPIDERMONKEY = @CONFIG_SCRIPTING_SPIDERMONKEY@ CONFIG_SPIDERMONKEY = @CONFIG_SPIDERMONKEY@ CONFIG_SSL = @CONFIG_SSL@ CONFIG_SYSMOUSE = @CONFIG_SYSMOUSE@ -CONFIG_OS_UNIX = @CONFIG_OS_UNIX@ CONFIG_URI_REWRITE = @CONFIG_URI_REWRITE@ -CONFIG_OS_WIN32 = @CONFIG_OS_WIN32@ CONFIG_XBEL_BOOKMARKS = @CONFIG_XBEL_BOOKMARKS@ CONFIG_XMLTO = @CONFIG_XMLTO@ @@ -170,6 +174,7 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) MAKE_COLOR = @MAKE_COLOR@ +LIB_O_NAME = lib.o ### 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 4cedf912..8519a585 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -1,19 +1,5 @@ ### The build commands and verbosity -# If we are verbose, we will show commands prefixed by $(Q) (which acts as -# @ in the non-verbose mode), and we will show the "real" cmds instead of -# their quiet versions (which are used in the non-verbose mode). -# Inspired by the Linux kernel build system. -ifdef V - Q = - quiet = - mquiet = masq_ -else - Q = @ - quiet = quiet_ - mquiet = quiet_ -endif - # Colorize the build. ifdef MAKE_COLOR INFO_COLOR = $(shell tput setaf 5) @@ -25,6 +11,25 @@ ifdef MAKE_COLOR END_COLOR = $(shell tput sgr0) endif +# sparse is architecture-neutral, which means that we need to tell it +# explicitly what architecture to check for. Fix this up for yours.. +SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ + + +############################################################################# +# Build recipies + +# If we are verbose, we will show the "real" cmds instead of +# their quiet versions (which are used in the non-verbose mode). +# Inspired by the Linux kernel build system. +ifdef V + quiet = + mquiet = masq_ +else + quiet = quiet_ + mquiet = quiet_ +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)) @@ -40,7 +45,7 @@ quiet_cmd_compile = ' [$(CC_COLOR)CC$(END_COLOR)] $(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`) + `test -e $(subdir)/$(LIB_O_NAME) && echo $(subdir)/$(LIB_O_NAME)`) quiet_cmd_link = ' [$(LINK_COLOR)LINK$(END_COLOR)] $(RELPATH)$@' cmd_link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(2) $(LIBS) @@ -59,32 +64,14 @@ quiet_cmd_installprog = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH) cmd_installprog = $(INSTALL_PROGRAM) $(2) $(3) -### Internal build rules +############################################################################# +# Special handling of conditional variables -DEP_FILES_1 = $(foreach src,$(OBJS),.deps/$(src)) -DEP_FILES = $(DEP_FILES_1:%.o=%.P) - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - -ifdef OBJS --include $(DEP_FILES) -endif - -%.o: $(srcdir)%.c - $(call mcmd,compile) - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -ifdef SUBDIRS-yes SUBDIRS += $(SUBDIRS-yes) -endif +OBJS += $(OBJS-yes) -ifdef OBJS-yes -OBJS += $(OBJS-yes) -endif +ALTDIRS = $(SUBDIRS-no) $(SUBDIRS-) +ALTOBJS = $(OBJS-no) $(OBJS-) ifneq ($(findstring cleanall,$(MAKECMDGOALS)),) INCLUDE_ALL=1 @@ -97,33 +84,46 @@ INCLUDE_ALL=1 endif ifdef INCLUDE_ALL -ifdef SUBDIRS-no -SUBDIRS += $(SUBDIRS-no) -endif -ifdef SUBDIRS- -SUBDIRS += $(SUBDIRS-) -endif -ifdef OBJS-no -OBJS += $(OBJS-no) -endif -ifdef OBJS- -OBJS += $(OBJS-) -endif - +SUBDIRS += $(ALTDIRS) +OBJS += $(ALTOBJS) endif -ifdef OBJS -lib.o: $(sort $(OBJS)) $(foreach subdir,$(sort $(filter-out src,$(SUBDIRS))), $(wildcard $(subdir)/lib.o)) +############################################################################# +# Internal build rules + +# All files in $(OBJS) and any $(subdir)/lib.o are linked into lib.o +LIB_O_DEPS = \ + $(sort $(filter-out $(LIB_O_NAME),$(OBJS))) \ + $(foreach subdir,$(sort $(SUBDIRS)),$(wildcard $(subdir)/$(LIB_O_NAME))) + +$(LIB_O_NAME): $(LIB_O_DEPS) $(call cmd,ld_objs) -LIB_O = lib.o -CLEAN += $(OBJS) $(LIB_O) +DEP_FILES_1 = $(foreach src,$(OBJS),.deps/$(src)) +DEP_FILES = $(DEP_FILES_1:%.o=%.P) +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +ifneq ($(strip $(OBJS)),) +-include $(DEP_FILES) +OBJS += $(LIB_O_NAME) endif -CLEAN += $(PROG) +%.o: $(srcdir)%.c + $(call mcmd,compile) + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp -all-default: $(LIB_O) $(PROGS) $(MAN1) $(MAN5) +CLEAN += $(PROG) $(OBJS) + + +############################################################################# +# The main default rules + +all-default: $(OBJS) $(PROGS) $(MAN1) $(MAN5) # Ensure that Makefiles in subdirs are created before we recursive into them init-recursive: init-default @@ -133,23 +133,36 @@ init-default: $(MKINSTALLDIRS) $(subdir) >/dev/null; \ echo 'include $(SRC)/$(RELPATH)/$(subdir)/Makefile' > $(subdir)/Makefile;) -clean-default: clean-test +clean-default cleanall-default: @-test -z "$(CLEAN)" || $(RM) $(CLEAN) -cleanall-default: clean-default - check-default: ifneq ($(SPARSE),) @$(foreach file, $(wildcard *.c), \ $(call ncmd,sparse,$(file));) endif -############################################################################## -# -# Auto-testing infrastructure -# +install-default: all-default +ifdef PROGS + @$(MKINSTALLDIRS) $(DESTDIR)$(bindir) + @$(foreach file,$(PROGS), \ + $(call ncmd,installprog,$(file),$(DESTDIR)$(bindir));) +endif +ifdef MAN1 + @$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man1 + @$(foreach file,$(MAN1), \ + $(call ncmd,installdata,$(file),$(DESTDIR)$(mandir)/man1);) +endif +ifdef MAN5 + @$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man5 + @$(foreach file,$(MAN5), \ + $(call ncmd,installdata,$(file),$(DESTDIR)$(mandir)/man5);) +endif + + +############################################################################## +# Auto-testing infrastructure -clean-test: test-default: ifdef TEST_PROGS @@ -173,58 +186,43 @@ clean-test: @rm -fr trash CLEAN += $(TEST_PROGS) $(addsuffix .o,$(TEST_PROGS)) +clean-default: clean-test endif .PHONY: $(TESTS) .NOPARALLEL: -# sparse is architecture-neutral, which means that we need to tell it -# explicitly what architecture to check for. Fix this up for yours.. -SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ -install-default: all-default -ifdef PROGS - @$(MKINSTALLDIRS) $(DESTDIR)$(bindir) - @$(foreach file,$(PROGS), \ - $(call ncmd,installprog,$(file),$(DESTDIR)$(bindir));) -endif -ifdef MAN1 - @$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man1 - @$(foreach file,$(MAN1), \ - $(call ncmd,installdata,$(file),$(DESTDIR)$(mandir)/man1);) -endif -ifdef MAN5 - @$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man5 - @$(foreach file,$(MAN5), \ - $(call ncmd,installdata,$(file),$(DESTDIR)$(mandir)/man5);) -endif -# Recursion: +############################################################################# +# Basic recursion and dependencies setup RULES = all install clean cleanall init check test -RECRULES = $(addsuffix -recursive,$(RULES)) -.PHONY: $(RECRULES) +RULES_LOCAL = $(addsuffix -local,$(RULES)) +RULES_REC = $(addsuffix -recursive,$(RULES)) + +.PHONY: $(RULES) $(RULES_LOCAL) $(RULES_REC) $(addsuffix -default,$(RULES)) # The -recursive rules decend all subdirs. -$(RECRULES): -ifdef SUBDIRS +$(RULES_REC): @$(foreach subdir,$(sort $(SUBDIRS)), \ $(call ncmd,recmake,$(subdir),$(subst -recursive,,$@)) || exit 1;) -endif -# Setup the default sub commands dependency. First decend subdirs then do all -# the default stuff and finally do any local hooks. -recdeps = $1-recursive $1-default $1-local -all: $(call recdeps,all) -check: $(call recdeps,check) -cleanall: $(call recdeps,cleanall) -clean: $(call recdeps,clean) -init: $(call recdeps,init) -install: $(call recdeps,install) -test: $(call recdeps,test) +# Dummy -local rules +$(RULES_LOCAL): -# Dummy rules for local hooks -$(addsuffix -local,$(RULES)): +# Default deps +rule_deps = $(1)-recursive $(1)-default $(1)-local +all: $(call rule_deps,all) +install: $(call rule_deps,install) +clean: $(call rule_deps,clean) +cleanall: $(call rule_deps,cleanall) +init: $(call rule_deps,init) +check: $(call rule_deps,check) +test: $(call rule_deps,test) + +############################################################################# +# Misc # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/configure.in b/configure.in index 73183a2b..ea911848 100644 --- a/configure.in +++ b/configure.in @@ -16,8 +16,6 @@ AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal]) AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf]) AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader]) -AC_PROG_MAKE_SET - MAKE= for make in gnumake gmake make false; do @@ -26,13 +24,15 @@ for make in gnumake gmake make false; do fi done +builddir="`pwd`" + # Cleanup if we are configuring with a previous build in the tree if test -e Makefile.config; then - "$MAKE" -C "$builddir" cleanall >/dev/null 2>/dev/null + AC_MSG_CHECKING([for previous build to clean]) + "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null + AC_MSG_RESULT(done) fi -builddir="`pwd`" - dnl =================================================================== dnl Load feature configuration file and start logging features. dnl =================================================================== @@ -53,9 +53,7 @@ AC_PROG_RANLIB AC_PROG_INSTALL AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id") - AC_PATH_PROGS(SPARSE, "sparse") -AC_SUBST(SPARSE) CONFIG_ASCIIDOC="no" CONFIG_POD2HTML="no" @@ -529,9 +527,9 @@ if test "$enable_see" = "yes"; then SEE_CFLAGS="`$SEE_CONFIG --cppflags`" LIBS="$SEE_LIBS $LIBS" CPPFLAGS="$CPPFLAGS $SEE_CFLAGS" - EL_CONFIG(CONFIG_SEE, [SEE]) + EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE]) AC_SUBST(SEE_CFLAGS) - AC_SUBST(CONFIG_SEE) + AC_SUBST(CONFIG_ECMASCRIPT_SEE) else if test -n "$withval" && test "x$withval" != xno; then AC_MSG_ERROR([SEE not found]) @@ -596,14 +594,15 @@ else AC_SUBST(SPIDERMONKEY_CFLAGS) fi -if test "$CONFIG_SEE" != yes; then +if test "$CONFIG_SPIDERMONKEY" = yes && + test "$CONFIG_ECMASCRIPT_SEE" != yes; then EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting]) fi AC_SUBST(CONFIG_SPIDERMONKEY) AC_SUBST(CONFIG_ECMASCRIPT_SMJS) -EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)]) +EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)]) dnl =================================================================== @@ -1018,6 +1017,7 @@ AC_MSG_RESULT($cf_result) dnl Final SSL setup EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL]) +AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT) AC_SUBST(CONFIG_OPENSSL) AC_SUBST(CONFIG_GNUTLS) diff --git a/doc/.gitignore b/doc/.gitignore index 23b7e753..af1b7aec 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,12 +1,14 @@ -api *.tmp *.html *.pdf *.xml *.1 *.5 -command-options.txt -import-features.conf.txt +api +web +features.txt keymap-actions.txt keymap-defaults.txt manual.html-chunked +option-command.txt +option-config.txt diff --git a/doc/Makefile b/doc/Makefile index 3e8fa66e..3a633560 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -3,62 +3,28 @@ include $(top_builddir)/Makefile.config SUBDIRS = man +# A little trick to simplify some of the rules. VPATH = $(builddir):$(srcdir):$(top_srcdir)/contrib/perl -#export PATH="tools:$(PATH)" +docdir = $(datadir)/doc -# TODO: perl.pod should be pod2ized during make install. --pasky +# Used by install-doc +HTML_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/html +PDF_DIR = $(DESTDIR)$(docdir)/$(PACKAGE)/pdf -### Script Dependencies -# - -ELINKS = $(top_builddir)/src/elinks -FEATURES = $(top_srcdir)/features.conf -KBDBIND = $(top_srcdir)/src/config/kbdbind.c - - -### Locale env vars to override system one to ensure commands -# using elinks binary will generate texts in english -# -LOCALES = LC_ALL=C LANGUAGE=en - -### Scripts -# - -CODE2DOC = $(top_srcdir)/doc/tools/code2doc -HELP2DOC = $(top_srcdir)/doc/tools/help2doc -IMPORT_FEATURES_CONF = $(top_srcdir)/doc/tools/import-features.conf +############################################################################# +# Build files TXT_DOCS = \ - bookmarks.txt \ - ecmascript.txt \ - elinks.1.txt \ - elinkskeys.5.txt \ - exmode.txt \ - faq.txt \ - installation.txt \ - introduction.txt \ - lua-scripting.txt \ - mailcap.txt \ - manual.txt \ - marks.txt \ - mime.txt \ - remote.txt \ - small.txt \ - tabs.txt \ - terminals.txt \ - urlshortcuts.txt - -GEN_TXT_DOCS = \ - command-options.txt \ - import-features.conf.txt \ + features.txt \ + keymap-actions.txt \ keymap-defaults.txt \ - keymap-actions.txt - -TXT_DOCS += $(GEN_TXT_DOCS) + option-command.txt \ + option-config.txt HTML_DOCS-$(CONFIG_ASCIIDOC) += \ elinks.1.html \ + elinks.conf.5.html \ elinkskeys.5.html \ hacking.html \ manual.html @@ -68,109 +34,162 @@ HTML_DOCS-$(CONFIG_XMLTO) += \ HTML_DOCS-$(CONFIG_POD2HTML) += \ perl.html \ - perl-hooks.html \ + perl-hooks.html MAN_DOCS-$(CONFIG_XMLTO) += \ elinks.1 \ + elinks.conf.5 \ elinkskeys.5 -# Only jw is used for generating PDF. +# Use jw for generating PDF, since xmlto seems to freak out. PDF_DOCS-$(CONFIG_JW) += \ manual.pdf -MAN_DOCS += elinks.conf.5 -## API Docs -# +############################################################################# +## Set the default doc rules +MAN_DOCS = $(MAN_DOCS-yes) +HTML_DOCS = $(HTML_DOCS-yes) +PDF_DOCS = $(PDF_DOCS-yes) + +txt: $(TXT_DOCS) +html: txt $(HTML_DOCS) +pdf: txt $(PDF_DOCS) +man: txt $(MAN_DOCS) + +all-docs: man html pdf + +install-doc: all-docs update-man install + $(foreach doc,$(HTML_DOCS), \ + if test -d $(doc); then \ + $(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/html/$(doc); \ + $(call ncmd,installdata,$(doc)/*,$(HTML_DIR)/$(doc)); \ + else \ + $(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/html; \ + $(call ncmd,installdata,$(doc),$(HTML_DIR)); \ + fi;) + $(foreach doc,$(PDF_DOCS), \ + $(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/pdf; \ + $(call ncmd,installdata,$(doc),$(PDF_DIR);)) + +update-man: man + $(if $(MAN_DOCS), \ + $(call ncmd,installdata,elinks.1,man/man1/elinks.1.in); \ + $(call ncmd,installdata,elinkskeys.5,man/man5/); \ + $(call ncmd,installdata,elinks.conf.5,man/man5/)) + +clean-local: + @$(RM) -r api $(TXT_DOCS) $(MAN_DOCS) $(HTML_DOCS) $(PDF_DOCS) *.tmp *.xml + +# TODO: perl.pod should be pod2ized during make install. --pasky +install-local: + + +############################################################################# +# Generated asciidoc files + +# Scripts and Dependencies +CODE2DOC = $(srcdir)tools/code2doc +HELP2DOC = $(srcdir)tools/help2doc +CONF2DOC = $(srcdir)tools/conf2doc +KEYS2DOC = $(srcdir)tools/make-elinkskeys-manpage +ELINKS = $(top_builddir)/src/elinks +FEATURES = $(top_srcdir)/features.conf +KBDBIND = $(top_srcdir)/src/config/kbdbind.c + +# Locale env vars to override system one to ensure commands +# using elinks binary will generate texts in english +LOCALES = LC_ALL=C LANGUAGE=en + +# FIXME: Keep generated .txt files relative to the source directory and files +# they are included in. +quiet_cmd_help2doc = ' [$(LINK_COLOR)HELP2DOC$(END_COLOR)] $(RELPATH)$@' + cmd_help2doc = $(LOCALES) $(HELP2DOC) $(ELINKS) $@ > $@ + +quiet_cmd_conf2doc = ' [$(LINK_COLOR)CONF2DOC$(END_COLOR)] $(RELPATH)$@' + cmd_conf2doc = $(LOCALES) $(CONF2DOC) > $@ + +quiet_cmd_keys2doc = ' [$(LINK_COLOR)KEYS2DOC$(END_COLOR)] $(RELPATH)$@' + cmd_keys2doc = $(LOCALES) $(KEYS2DOC) $(KBDBIND) $@ > $@ + +features.txt: $(FEATURES) $(CONF2DOC) + $(call cmd,conf2doc) + +keymap-%.txt: $(KBDBIND) $(KEYS2DOC) + $(call cmd,keys2doc) + +option-%.txt: $(ELINKS) $(HELP2DOC) + $(call cmd,help2doc) + + +# API Docs + +ifeq ($(findstring api,$(MAKECMDGOALS)),api) API = $(shell find $(top_srcdir)/src/ -name '*.h' -exec grep -q 'API Doc' \{\} \; -printf "%p " | sort) +endif define api_doc -api/$(2).txt: $(1) +api/$(2).txt: $(1) $(CODE2DOC) + @test -d api || $(MKINSTALLDIRS) api @$(CODE2DOC) $(1) > $$@ API_TXT += api/$(2).txt endef -$(foreach api,$(API),$(eval $(call api_doc,$(api),$(shell sed -n 's/.*API Doc\s*::\s*\([^ ]*\).*/\1/p' < $(api)),))) +api_name = $(shell sed -n 's/.*API Doc\s*::\s*\([^ ]*\).*/\1/p' < $(1)) +$(foreach api,$(API),$(eval $(call api_doc,$(api),$(call api_name,$(api))))) + +api: $(patsubst %.txt,%.html,$(API_TXT)) -## Se the default doc rules - -MAN_DOCS = elinks.conf.5 $(MAN_DOCS-yes) -HTML_DOCS = $(HTML_DOCS-yes) -PDF_DOCS = $(PDF_DOCS-yes) -API_DOCS = $(patsubst %.txt,%.html,$(API_TXT)) - -api-dir: - @test -d api || $(MKINSTALLDIRS) api - -txt: $(addprefix $(srcdir),$(TXT_DOCS)) -html: txt $(HTML_DOCS) -pdf: txt $(PDF_DOCS) -man: txt $(MAN_DOCS) man-update -api: api-dir $(API_DOCS) - -all-docs: man html pdf - -man-update: $(MAN_DOCS) - @test "$(CONFIG_XMLTO)" = yes && \ - sed 's/^\.TH "ELINKS" 1 .*/.TH "ELINKS" 1 "The ELinks text-browser" "$(shell date -I)" "The ELinks text-browser"/' \ - < elinks.1 > $(srcdir)man/man1/elinks.1.in && \ - $(RM) $(MAN_DIR)/man1/elinks.1 - @test "$(CONFIG_XMLTO)" = yes && \ - sed -e 's/\\fI\\fR'\''/\\fI\\'\''\\fR/' < elinkskeys.5 | \ - sed 's/^\.TH "ELINKSKEYS" 5 .*/.TH "ELINKSKEYS" 5 "ELinks keybindings" "$(shell date -I)" "ELinks keybindings"/' \ - > $(srcdir)man/man5/elinkskeys.5 - @$(INSTALL) elinks.conf.5 $(srcdir)man/man5 - -clean-local: - @$(RM) -r api $(GEN_TXT_DOCS) $(MAN_DOCS) $(HTML_DOCS) $(PDF_DOCS) *.tmp - -# Autogenerated files. - -# FIXME: Keep generated .txt files relative to the source directory and files -# they are included in. - -import-features.conf.txt: $(FEATURES) $(IMPORT_FEATURES_CONF) - $(IMPORT_FEATURES_CONF) > $@ - -keymap-defaults.txt keymap-actions.txt: $(MAKE_ELINKSKEYS_MANPAGE) $(KBDBIND) - $(LOCALES) $(srcdir)tools/make-elinkskeys-manpage $(KBDBIND) - -command-options.txt: $(ELINKS) $(HELP2DOC) - $(LOCALES) $(HELP2DOC) --cmdoptions --elinks=$(ELINKS) > $@ - -elinks.conf.5: $(ELINKS) $(HELP2DOC) - $(LOCALES) $(HELP2DOC) --elinksconf --elinks=$(ELINKS) > $@ - -## Default build rules -# - -quiet_cmd_asciidoc = ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@' - cmd_asciidoc = $(ASCIIDOC) -f asciidoc.conf -b $(2) -d $(call doctype,$<) -o $@ $< - - quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@' - cmd_xmlto = $(XMLTO) $(3) $(2) $< +############################################################################# +# Build commands and macros quiet_cmd_jw = ' [$(LINK_COLOR)JW$(END_COLOR)] $(RELPATH)$@' cmd_jw = $(JW) -b $(2) $< + quiet_cmd_xmlto = ' [$(LINK_COLOR)XMLTO$(END_COLOR)] $(RELPATH)$@' + cmd_xmlto = $(XMLTO) $(3) $(2) $< + quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@' cmd_pod2html = $(POD2HTML) --outfile=$@ < $< +quiet_cmd_asciidoc = ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@' + cmd_asciidoc = $(ASCIIDOC) -f asciidoc.conf -b $(2) -d $(call doctype,$<) -o $@ $< + +# Based on filename in $(1) find out asciidoc doctype. doctype = $(if $(findstring .1.,$(1)),manpage,$(if $(findstring .5.,$(1)),manpage,book)) +# Loosely track dependencies via asciidoc includes. +asciidoc_dep = sed -n 's@include::\(.*\)\[.*@$@: \1@p' < $< > .deps/$(@F).asciidoc + +-include .deps/*.asciidoc + +# Do a little post-processing of man pages. Inserting title headers and date. +MAN_DATE = $(shell date -I) +man_desc = `sed -n 's/:Description:\s*\(.*\)/\1/p' < $(subst .xml,.txt,$<)` +man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\" \"$(1)\"/" < $@ | \ + sed "s/@squote@/\\\\'/g" > $@.tmp && mv $@.tmp $@ + + +############################################################################# +# Build recipies + %.html: %.txt asciidoc.conf $(call cmd,asciidoc,xhtml11) + $(call asciidoc_dep) %.xml: %.txt asciidoc.conf $(call cmd,asciidoc,docbook) + $(call asciidoc_dep) %.1: %.1.xml $(call cmd,xmlto,man) + $(call man_hack,$(call man_desc)) %.5: %.5.xml $(call cmd,xmlto,man) + $(call man_hack,$(call man_desc)) %.html-chunked: %.xml $(call cmd,xmlto,html,-o $@) @@ -184,4 +203,5 @@ doctype = $(if $(findstring .1.,$(1)),manpage,$(if $(findstring .5.,$(1)),manpag perl-%.html: %.pl $(call cmd,pod2html) + include $(top_srcdir)/Makefile.lib diff --git a/doc/README b/doc/README index 76bc7347..d47ae375 100644 --- a/doc/README +++ b/doc/README @@ -4,25 +4,105 @@ There is only limited documentation available for ELinks so far, sorry. It basically consists of the documents in this directory and the features.conf, README and INSTALL files in the project's root directory. -The files you will find in this directory are manpages living in the man/ -directory and a bunch of .html and especially .txt (wait, you expect HTML -browser to carry its documentation around in HTML?) documents. The index.txt -file contains the table of contents which should help you navigating between -the files. +You are encouraged to get a copy of the ELinks manual. It tries to be a +complete book of all there is to know about ELinks. For example, most files +listed in the next section is in some way part of the ELinks manual. -Tools ------ +Instructions on building the manual is given below. If you do not intend to +build it yourself either access it on the ELinks homepage or, if you +downloaded ELinks via a tarball, the manual should be in the html/ directory. -The manual is written in asciidoc, however you will also need xmlto to process -docbook XML generated by asciidoc into manpages and the html-chunked manual. -If you want to translate .pod files you need pod2html. + +Where to start +-------------- + +This sections tries to give a quick overview of important files you will find +in this directory or it's children. + + - Man pages: + + elinks(1) ................................... man/man1/elinks.1 + elinks.conf(5) .............................. man/man5/elinks.conf.5 + elinkskeys(5) ............................... man/man5/elinkskeys.5 + + Man pages are best viewed with the man program. The easiest way to do this + is by telling the man program to look for man pages in the doc/man + directory by using the -M switch. If you are standing in the top-level + directory, you can do this by invoking the man program using: + + man -M doc/man elinks.conf + + - User's Guide: + + Getting ELinks up and running................ installation.txt + Introduction to the World of ELinks ......... introduction.txt + Frequently Asked Questions .................. faq.txt + JavaScript/ECMAScript in ELinks ............. ecmascript.txt + Notes on User Feedback ...................... feedback.txt + The Smallest Binary Quest Spoilerbook ....... small.txt + + Note: The ELinks manual really should be read in one of the generated + formats: html, html-chunked or pdf, however the entry point can be found in + manual.txt and might be of some help, when deciding what other .txt + documents to read in this directory. + + - Developer's Guide: + + Introduction to ELinks Developing ........... dev-intro.txt + The Demented Guide to Source Hacking ........ hacking.txt + + The developing intro tries to explain some of the basic concepts in the + ELinks internal. While the hacking guide contains great deal about general + source code structure and especially guidelines regarding coding style, + submitting patches etc., thus every aspiring developer should take the + pains to read through it, do not forget to also look for README and similar + text files in the subdirectories containing the relevant sources for + detailed notes regarding given modules/subsystems. + + The Lua Scripting Book ...................... lua-scripting.txt + Events Reference Sheet ...................... events.txt + + The above covers internal scripting, by which we mean scripting of the + browser internals through embedded Lua, Guile or Perl scripts. ECMAScript + scripts embedded in documents have nothing to do with that. + + +Building documentation +---------------------- + +The following tools are used for generating documentation in various formats: + + - asciidoc: the basic tool for lifting the .txt files to other formats. + - xmlto: used for outputting chunked HTML and man pages. + - jw: used for pdf documents. + - pod2html: used for perl docs. All these tools are checked by configure, thus to successfully build all the possible documentation (with the tools available on the system), just run $ make all-docs -in the doc/ directory. +in the doc/ directory. It will build, if possibly, the manual in the following +manual formats (with tool requirements listed): + + - HTML one-file (asciidoc) + - HTML chunked / multiple files (asciidoc + xmlto) + - PDF (asciidoc + jw) + +and the following man page formats: + + - HTML (asciidoc) + - man / groff (asciidoc + xmlto) + +Note: You do not need to build manpages. They are shipped with ELinks. + +Note: You must first build the ELinks binary for "make all-docs" to work +successfully. The binary is used for getting option documentation. + +The documentation can be installed with: + + $ make install-doc + Contributing ------------ diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf index 3d20da0c..9d8eb0ef 100644 --- a/doc/asciidoc.conf +++ b/doc/asciidoc.conf @@ -1,17 +1,40 @@ # AsciiDoc configuration file # Copyright (c) Jonas Fonseca , 2006 -# The elink macro can have optional {0} value, that is what +# This file sets the following ELinks specific AsciiDoc macros: +# +# General purpose: +# - man:page[section]: which is used for linking between ELinks manpages. +# +# API Doc: +# - id:[] +# - enum:[] +# - func:[] +# - struct:[] +# - macro:[] +# - typedef:[] +# - ref:[] + +# Some macros can have optional {0} value, that is what # the {0%...} and {0#...} handles. ############################################################################# # DocBook ifdef::backend-docbook[] -[man-inlinemacro] -{target}({0}) -## For manpages use less verbose linking +# To be replaced later +[attributes] +squote=@squote@ + +# No interlinking between elinks manpages +[man-inlinemacro] +{0%{target}} +{0#} +{0#{target}{0}} +{0#} + +# For manpages use less verbose linking ifdef::doctype-manpage[] [link-inlinemacro] {0%<{target}>} @@ -31,8 +54,16 @@ endif::backend-docbook[] # XHTML11 ifdef::backend-xhtml11[] + +[attributes] +squote=' + +# Use the man:[] macro to link between elinks manpages [man-inlinemacro] -{target}({0}) +{eval:re.match("elinks", "{target}") != None}{target}({0}) +{eval:re.match("elinks", "{target}") == None}{target}({0}) + +# API Doc macros [id-inlinemacro] {0} @@ -54,4 +85,5 @@ ifdef::backend-xhtml11[] [ref-inlinemacro] {0} + endif::backend-xhtml11[] diff --git a/doc/bittorrent.txt b/doc/bittorrent.txt index 3702885d..f1ebb522 100644 --- a/doc/bittorrent.txt +++ b/doc/bittorrent.txt @@ -60,7 +60,7 @@ If you start downloading a torrent which was previously active, the client will first try to resume downloaded data from the disk. The resume progress is shown in the resume dialog, depicted below: - +----------------------------------------- Download -------------------------------------+ + +--------------------------------------- Download ---------------------------------------+ | | | bittorrent:http://www.legaltorrents.com/bit/blue-a-short-film.torrent | | | @@ -82,7 +82,7 @@ such as progress, and a summary of which places in the torrent pieces have been downloaded from. A view of the download dialog along with highlights of the most important parts of the dialog is given below: - +---------------------------------------------- Download --------------------------------+ + +--------------------------------------- Download ---------------------------------------+ | | | bittorrent:http://www.legaltorrents.com/bit/best-of-webbed-hand-vol-1.torrent | | | diff --git a/doc/elinks.1.txt b/doc/elinks.1.txt index 804e1db0..aafb0aea 100644 --- a/doc/elinks.1.txt +++ b/doc/elinks.1.txt @@ -1,5 +1,6 @@ elinks(1) ========= +:Description: The Elinks text-browser NAME ---- @@ -32,7 +33,7 @@ do not need to care about them. Note that this list is by no means complete and it is not kept up-to-date. To get complete list of commandline options, start 'ELinks' with parameter `--help`. -include::command-options.txt[] +include::option-command.txt[] ENVIRONMENT VARIABLES --------------------- @@ -75,7 +76,7 @@ HOME:: WWW_HOME:: - Homepage location (as in lynx(1)). + Homepage location (as in man:lynx[1]). FILES ----- @@ -150,7 +151,8 @@ was done by Jonas Fonseca mailto:fonseca@diku.dk[]. SEE ALSO -------- -man:elinkskeys[5], elinks.conf(5), links(1), lynx(1), w3m(1), wget(1) +man:elinkskeys[5], man:elinks.conf[5], man:links[1], man:lynx[1], man:w3m[1], +man:wget[1] //////////////////////////////////////////////////////////////////////////// # vim: tabstop=4 shiftwidth=4 textwidth=76 diff --git a/doc/elinks.conf.5.txt b/doc/elinks.conf.5.txt new file mode 100644 index 00000000..15394cf7 --- /dev/null +++ b/doc/elinks.conf.5.txt @@ -0,0 +1,63 @@ +elinks.conf(5) +============== +:Description: ELinks configuration file + +NAME +---- +elinks.conf - ELinks configuration file + +SYNOPSIS +-------- +[verse] +set "