diff --git a/Makefile b/Makefile index 828ed7df0..623d444f3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ all: make -C preprocessor make -C doc +.PHONY: all clean: make -C preprocessor clean @@ -8,16 +9,22 @@ clean: rm -f matlab/dynare_m matlab/dynare_m.exe rm -f mex/2007a/* mex/2007b/* mex/octave/*.mex rm -f windows/*.exe - rm -f config.log config.status *~ + rm -f *~ +.PHONY: clean + +distclean: clean + rm -f config.log config.status rm -rf autom4te.cache rm -f preprocessor/Makefile +.PHONY: distclean DYNAREBASE=$(shell basename $(shell pwd)) # Rule for creating the source tarball # The parent directory must be called dynare-4.x.y # WARNING: this rule will make your SVN working copy unusable! -srctarball: clean +srctarball: distclean find -name .svn | xargs rm -rf find -type f -name '*~' | xargs rm -f cd ..; tar cvzf $(DYNAREBASE).tgz --exclude=tests $(DYNAREBASE) +.PHONY: srctarball diff --git a/configure b/configure index 6aff924c4..dfd002b11 100755 --- a/configure +++ b/configure @@ -637,6 +637,10 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +XSLTPROC +DBLATEX +BIBTEX +PDFLATEX BISON EGREP GREP @@ -3570,7 +3574,238 @@ cat >>confdefs.h <<\_ACEOF _ACEOF -ac_config_files="$ac_config_files preprocessor/Makefile" +# Extract the first word of "pdflatex", so it can be a program name with args. +set dummy pdflatex; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_PDFLATEX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$PDFLATEX"; then + ac_cv_prog_PDFLATEX="$PDFLATEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_PDFLATEX="pdflatex" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +PDFLATEX=$ac_cv_prog_PDFLATEX +if test -n "$PDFLATEX"; then + { $as_echo "$as_me:$LINENO: result: $PDFLATEX" >&5 +$as_echo "$PDFLATEX" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "bibtex", so it can be a program name with args. +set dummy bibtex; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_BIBTEX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$BIBTEX"; then + ac_cv_prog_BIBTEX="$BIBTEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_BIBTEX="bibtex" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +BIBTEX=$ac_cv_prog_BIBTEX +if test -n "$BIBTEX"; then + { $as_echo "$as_me:$LINENO: result: $BIBTEX" >&5 +$as_echo "$BIBTEX" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "dblatex", so it can be a program name with args. +set dummy dblatex; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DBLATEX+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$DBLATEX"; then + ac_cv_prog_DBLATEX="$DBLATEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DBLATEX="dblatex" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +DBLATEX=$ac_cv_prog_DBLATEX +if test -n "$DBLATEX"; then + { $as_echo "$as_me:$LINENO: result: $DBLATEX" >&5 +$as_echo "$DBLATEX" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "xsltproc", so it can be a program name with args. +set dummy xsltproc; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_XSLTPROC+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$XSLTPROC"; then + ac_cv_prog_XSLTPROC="$XSLTPROC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_XSLTPROC="xsltproc" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +XSLTPROC=$ac_cv_prog_XSLTPROC +if test -n "$XSLTPROC"; then + { $as_echo "$as_me:$LINENO: result: $XSLTPROC" >&5 +$as_echo "$XSLTPROC" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +if test -n "${XSLTPROC}" -a -f /etc/xml/catalog +then + { $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done +done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + + { $as_echo "$as_me:$LINENO: checking for DocBook XSL files in XML catalog" >&5 +$as_echo_n "checking for DocBook XSL files in XML catalog... " >&6; } + cat /etc/xml/catalog | ${GREP} -q http://docbook.sourceforge.net/release/xsl/ + if test $? -eq 0 + then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:$LINENO: WARNING: The creation of the HTML version will be very slow! You should install the docbook-xsl package." >&5 +$as_echo "$as_me: WARNING: The creation of the HTML version will be very slow! You should install the docbook-xsl package." >&2;} + fi +fi + +ac_config_files="$ac_config_files preprocessor/Makefile doc/Makefile doc/preprocessor/Makefile doc/macroprocessor/Makefile doc/userguide/Makefile" cat >confcache <<\_ACEOF @@ -4182,6 +4417,10 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "preprocessor/Makefile") CONFIG_FILES="$CONFIG_FILES preprocessor/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/preprocessor/Makefile") CONFIG_FILES="$CONFIG_FILES doc/preprocessor/Makefile" ;; + "doc/macroprocessor/Makefile") CONFIG_FILES="$CONFIG_FILES doc/macroprocessor/Makefile" ;; + "doc/userguide/Makefile") CONFIG_FILES="$CONFIG_FILES doc/userguide/Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} diff --git a/configure.ac b/configure.ac index 918a758f5..ce104c01f 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,25 @@ AC_CHECK_HEADERS([boost/graph/adjacency_list.hpp], [], [AC_MSG_ERROR([Can't find # Don't use deprecated hash structures AC_DEFINE([BOOST_NO_HASH]) -AC_CONFIG_FILES([preprocessor/Makefile]) +AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex]) +AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex]) +AC_CHECK_PROG([DBLATEX], [dblatex], [dblatex]) +AC_CHECK_PROG([XSLTPROC], [xsltproc], [xsltproc]) + +if test -n "${XSLTPROC}" -a -f /etc/xml/catalog +then + AC_PROG_GREP + AC_MSG_CHECKING([for DocBook XSL files in XML catalog]) + cat /etc/xml/catalog | ${GREP} -q http://docbook.sourceforge.net/release/xsl/ + if test $? -eq 0 + then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_WARN([The creation of the HTML version will be very slow! You should install the docbook-xsl package.]) + fi +fi + +AC_CONFIG_FILES([preprocessor/Makefile doc/Makefile doc/preprocessor/Makefile doc/macroprocessor/Makefile doc/userguide/Makefile]) AC_OUTPUT diff --git a/doc/Makefile b/doc/Makefile.in similarity index 53% rename from doc/Makefile rename to doc/Makefile.in index 1bdc2a635..caa0a923f 100644 --- a/doc/Makefile +++ b/doc/Makefile.in @@ -1,22 +1,34 @@ +PDFLATEX = @PDFLATEX@ +XSLTPROC = @XSLTPROC@ +DBLATEX = @DBLATEX@ + all: guide.pdf manual-html/index.html manual.pdf bvar-a-la-sims.pdf make -C preprocessor make -C macroprocessor make -C userguide +.PHONY: all guide.pdf: guide.tex guide.bbl bibmad.sty - pdflatex guide - pdflatex guide +ifdef PDFLATEX + $(PDFLATEX) guide + $(PDFLATEX) guide +endif bvar-a-la-sims.pdf: bvar-a-la-sims.tex - pdflatex bvar-a-la-sims - pdflatex bvar-a-la-sims +ifdef PDFLATEX + $(PDFLATEX) bvar-a-la-sims + $(PDFLATEX) bvar-a-la-sims +endif manual-html/index.html: manual.xml dynare_html.xsl - # Make sure that you have installed the docbook-xsl package, otherwise xsltproc will take a very long time - xsltproc -stringparam base.dir ./manual-html/ dynare_html.xsl manual.xml +ifdef XSLTPROC + $(XSLTPROC) -stringparam base.dir ./manual-html/ dynare_html.xsl manual.xml +endif manual.pdf: manual.xml - dblatex manual.xml +ifdef DBLATEX + $(DBLATEX) manual.xml +endif clean: rm -f *~ *.pdf *.log *.aux @@ -24,3 +36,4 @@ clean: make -C preprocessor clean make -C macroprocessor clean make -C userguide clean +.PHONY: clean diff --git a/doc/macroprocessor/Makefile b/doc/macroprocessor/Makefile.in similarity index 56% rename from doc/macroprocessor/Makefile rename to doc/macroprocessor/Makefile.in index 526917744..06e328599 100644 --- a/doc/macroprocessor/Makefile +++ b/doc/macroprocessor/Makefile.in @@ -1,6 +1,11 @@ +PDFLATEX = @PDFLATEX@ + macroprocessor.pdf: macroprocessor.tex old-design.pdf new-design.pdf - pdflatex macroprocessor - pdflatex macroprocessor +ifdef PDFLATEX + $(PDFLATEX) macroprocessor + $(PDFLATEX) macroprocessor +endif clean: rm -f macroprocessor.pdf *.toc *.aux *.log *.nav *.snm *.vrb *.out *~ +.PHONY: clean diff --git a/doc/preprocessor/Makefile b/doc/preprocessor/Makefile.in similarity index 58% rename from doc/preprocessor/Makefile rename to doc/preprocessor/Makefile.in index 21ab83486..59d72ae75 100644 --- a/doc/preprocessor/Makefile +++ b/doc/preprocessor/Makefile.in @@ -1,6 +1,11 @@ +PDFLATEX = @PDFLATEX@ + preprocessor.pdf: preprocessor.tex expr.png expr-sharing.png matrices.png overview.png - pdflatex preprocessor - pdflatex preprocessor +ifdef PDFLATEX + $(PDFLATEX) preprocessor + $(PDFLATEX) preprocessor +endif clean: rm -f *.pdf *.toc *.aux *.log *.nav *.snm *.vrb *.out *~ +.PHONY: clean diff --git a/doc/userguide/Makefile b/doc/userguide/Makefile.in similarity index 58% rename from doc/userguide/Makefile rename to doc/userguide/Makefile.in index c4347b878..f42e9034c 100644 --- a/doc/userguide/Makefile +++ b/doc/userguide/Makefile.in @@ -1,15 +1,24 @@ +PDFLATEX = @PDFLATEX@ +BIBTEX = @BIBTEX@ + all: UserGuide.pdf +.PHONY: all SRC = UserGuide.tex Graphics/DynareTitle.pdf DynareBib.bib \ ch-intro.tex ch-inst.tex ch-solbase.tex ch-soladv.tex ch-estbase.tex \ ch-estadv.tex ch-solbeh.tex ch-estbeh.tex ch-ramsey.tex ch-trouble.tex -UserGuide.pdf: - pdflatex UserGuide - bibtex UserGuide - pdflatex UserGuide - pdflatex UserGuide +UserGuide.pdf: +ifdef PDFLATEX +ifdef BIBTEX + $(PDFLATEX) UserGuide + $(BIBTEX) UserGuide + $(PDFLATEX) UserGuide + $(PDFLATEX) UserGuide +endif +endif clean: rm -f *.log *.aux *.toc *.lof *.blg *.bbl *.out rm -f UserGuide.pdf +.PHONY: clean