diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-04-14 10:26:28 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-04-14 10:26:28 +0300 |
commit | 4254b0590e609b82dac3d688ecb401c9eefb7e25 (patch) | |
tree | f565e3daf877d35cffc92ffa3abf45696e5e62c0 | |
parent | c6a7620deb7e3e139329e2daad31d4071f01b43b (diff) | |
download | gint-4254b0590e609b82dac3d688ecb401c9eefb7e25.tar.gz gint-4254b0590e609b82dac3d688ecb401c9eefb7e25.tar.bz2 |
Improve doc generation. Allow for rebootstrapping of a packaged distribution.
* Makefile.am (EXTRA_DIST): Add all files, to make
possible rebootstrapping of a packaged distribution.
[GINT_COND_DOC]: Protect generation of the doc files.
* gint.m4: Call AM_PROG_LEX unconditionally. The reasoning
is the same as above.
(GINT_COND_DOC): New condition, controlled by the `nodoc'
option.
* gint.mk [GINT_COND_DOC]: Move all rules regarding
doc files under this conditional.
(snarfcppopts): New variable.
(.c.doc, .c.x): Pass $(snarfcppopts) to the cc invocation.
* README: Update.
* .gitignore: Update.
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile.am | 14 | ||||
-rw-r--r-- | README | 29 | ||||
-rw-r--r-- | gint.m4 | 6 | ||||
-rw-r--r-- | gint.mk | 48 |
5 files changed, 71 insertions, 30 deletions
@@ -3,4 +3,6 @@ README.html clexer clexer.[co] *~ - +.deps/ +Makefile +Makefile.in diff --git a/Makefile.am b/Makefile.am index 2797db4..e2ea0bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,7 +14,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -EXTRA_DIST = gint.m4 gint.mk guile.m4 +EXTRA_DIST = \ + clexer.l\ + gint.m4\ + gint.mk\ + guile.m4\ + snarf-doc-filter\ + extract-exports + +if GINT_COND_DOC if GINT_COND_SNARF_DOC_FILTER noinst_SCRIPTS = snarf-doc-filter else @@ -23,7 +31,5 @@ clexer_SOURCES = clexer.l INCLUDES = @GINT_INCLUDES@ LDADD = @GINT_LDADD@ endif - -if GINT_COND_INC -EXTRA_DIST += extract-exports endif + @@ -147,7 +147,7 @@ include ../gint/gint.mk The rules in `gint.mk` make certain assumptions about some `Makefile` variables. Namely, the following variables must be defined before including the file: +INCLUDES+, +EXTRA_DIST+, +CLEANFILES+, -+DISTCLEANFILES+, +SUFFIXES+. See the ++DISTCLEANFILES+, +SUFFIXES+, +BUILT_SOURCES+. See the http://sources.redhat.com/automake/automake.html[`Automake` documentation], for more info on these. If no special value is needed, define each of them to an empty string (see example below). @@ -157,8 +157,21 @@ necessarily an absolute one), of the +makeinfo+ binary. It is initialized by +Automake+ if your project contains a `Makefile.am` with the +info_TEXINFOS+ variable set. If not, you will have to initialize it manually. -Finally, two +GINT+-specific variables must be defined: +Finally, the following +GINT+-specific variables must be defined: +sitedir:: +The location where to install site-specific Guile modules. We advise +to set it to: + +--------------------------------- +sitedir = @GUILE_SITE@/$(PACKAGE) +--------------------------------- + +See <<guile-site-dir, The `site directory' problem>>, for a detailed +discussion of sitedir. + +site_DATA:: + A list of modules to install to +sitedir+. DOT_X_FILES:: A list of +.x+ files to be generated. DOT_DOC_FILES:: @@ -176,6 +189,9 @@ EXTRA_DIST= DOT_X_FILES=$(libproj_la_SOURCES:.c=.x) DOT_DOC_FILES=$(libproj_la_SOURCES:.c=.doc) +sitedir = @GUILE_SITE@/$(PACKAGE) +site_DATA = proj.scm + SUFFIXES= CLEANFILES= DISTCLEANFILES= @@ -229,6 +245,9 @@ GINT_INIT([gint], [1.8]) The following is a list of valid options: +nodoc:: +Disable generation of +.doc+ files (see <<doc-snarfing, Doc snarfing>>). + inc:: Enable generation of `.inc` files. Each such file contains a set of `export` statements, one for each `SCM_DEFINE` in the corresponding @@ -343,7 +362,7 @@ command is a part of Guile installation. The +guile-procedures.txt+ is created by invoking +makeinfo+ with the +guile-procedures.texi+ file as input. - + Unfortunately, Guile installation does not include any snarf filter program. *GINT* fixes this oversight and offers two filter implementations: @@ -382,6 +401,10 @@ GINT_LDADD:: Specifies additional command line options to be appended to the +LDADD+ statement in +gint/Makefile.am+. +Notice also that if your code does not require doc snarfing, you +may disable it by supplying the +nodoc+ option to the invocation +of +GINT_INIT+. + [[guile-site-dir]] THE `SITE DIRECTORY' PROBLEM ---------------------------- @@ -51,15 +51,17 @@ dnl GINT_INIT([DIR], [OPTIONS], [IF-FOUND], [IF-NOT-FOUND]) dnl ------------------------------------------------------- dnl DIR Gint submodule directory (defaults to 'gint') dnl OPTIONS A whitespace-separated list of options. Currently recognized -dnl options are: 'inc', 'std-site-dir' and version number. +dnl options are: 'inc', 'std-site-dir','snarf-doc-filter', +dnl 'nodoc', and version number. dnl IF-FOUND What to do if Guile is present. dnl IF-NOT-FOUND What to do otherwise. dnl AC_DEFUN([GINT_INIT],[ + AM_PROG_LEX _GINT_SET_OPTIONS([$2]) - _GINT_IF_OPTION_SET([snarf-doc-filter],,[AM_PROG_LEX]) AC_SUBST([GINT_MODULE_DIR],[m4_if([$1],,[gint],[$1])]) AM_CONDITIONAL([GINT_COND_INC],[_GINT_IF_OPTION_SET([inc],[true],[false])]) + AM_CONDITIONAL([GINT_COND_DOC],[_GINT_IF_OPTION_SET([nodoc],[false],[true])]) AM_CONDITIONAL([GINT_COND_SNARF_DOC_FILTER],dnl [_GINT_IF_OPTION_SET([snarf-doc-filter],[true],[false])]) GINT_CHECK_GUILE(m4_ifdef([_GINT_GUILE_VERSION],_GINT_GUILE_VERSION),[$3],[$4]) @@ -16,20 +16,30 @@ INCLUDES += @GUILE_INCLUDES@ +BUILT_SOURCES += $(DOT_X_FILES) + +DISTCLEANFILES += $(DOT_X_FILES) + +ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \ + --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/' + +SUFFIXES += .x + +if GINT_COND_DOC EXTRA_DIST += guile-procedures.texi guile-procedures.txt site_DATA += guile-procedures.txt -BUILT_SOURCES=$(DOT_X_FILES) $(DOT_DOC_FILES) guile-procedures.texi +BUILT_SOURCES += $(DOT_DOC_FILES) guile-procedures.texi -DISTCLEANFILES +=\ - $(DOT_X_FILES)\ +DISTCLEANFILES += \ $(DOT_DOC_FILES)\ guile-procedures.texi\ guile-procedures.txt -ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \ - --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/' +SUFFIXES += .doc + +snarfcppopts = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) if GINT_COND_SNARF_DOC_FILTER GUILE_DOC_SNARF=$(top_builddir)/$(GINT_MODULE_DIR)/snarf-doc-filter --snarfer @@ -37,17 +47,23 @@ else GUILE_DOC_SNARF=$(top_builddir)/$(GINT_MODULE_DIR)/clexer --snarfer endif -SUFFIXES += .x .doc +.c.doc: + $(AM_V_GEN)$(CC) -DSCM_MAGIC_SNARF_DOCS $(snarfcppopts) -E $< | \ + $(GUILE_DOC_SNARF) -o $@ || { rm $@; false; } + +guile-procedures.texi: $(DOT_DOC_FILES) + $(AM_V_GEN)cat $(DOT_DOC_FILES) | \ + $(GUILE_TOOLS) snarf-check-and-output-texi > $@ + +guile-procedures.txt: guile-procedures.texi + $(AM_V_GEN) rm -f $@; \ + $(MAKEINFO) --force -o $@ guile-procedures.texi || test -f $@ +endif .c.x: $(AM_V_GEN)AWK=$(AWK) \ $(GUILE_SNARF) -o $@ \ - $< $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) - -.c.doc: - $(AM_V_GEN)$(CC) -DSCM_MAGIC_SNARF_DOCS \ - $(DEFS) $(INCLUDES) $(CPPFLAGS) -E $< | \ - $(GUILE_DOC_SNARF) -o $@ || { rm $@; false; } + $< $(snarfcppopts) if GINT_COND_INC SUFFIXES += .inc @@ -57,14 +73,6 @@ CLEANFILES += *.inc $(AM_V_GEN)$(top_srcdir)/$(GINT_MODULE_DIR)/extract-exports -o $@ $< endif -guile-procedures.texi: $(DOT_DOC_FILES) - $(AM_V_GEN)cat $(DOT_DOC_FILES) | \ - $(GUILE_TOOLS) snarf-check-and-output-texi > $@ - -guile-procedures.txt: guile-procedures.texi - $(AM_V_GEN) rm -f $@; \ - $(MAKEINFO) --force -o $@ guile-procedures.texi || test -f $@ - ## Add -MG to make the .x magic work with auto-dep code. MKDEP = $(CC) -M -MG $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) |