Fix various regression for building out of tree.
authorYann Dirson <ydirson@free.fr>
Sun, 20 Oct 2013 20:07:19 +0000 (22:07 +0200)
committerYann Dirson <ydirson@free.fr>
Sun, 3 Nov 2013 15:11:51 +0000 (16:11 +0100)
Most notably, doc was never buildable out of tree, but the recent build
enhancements did not take that into account.

Makefile.in
configure.ac
doc/Makefile.in [moved from doc/Makefile with 75% similarity]
gnushogi/Makefile.in

index a5694ce..93b5f1d 100644 (file)
 #
 
 VERSION     = 1.3.2
-GNUSHOGIDIR = ./gnushogi
-XSHOGIDIR   = ./xshogi
+ROOT        = @top_srcdir@
+BUILDROOT   = @top_builddir@
+GNUSHOGIDIR = $(BUILDROOT)/gnushogi
+XSHOGIDIR   = $(BUILDROOT)/xshogi
 
 #
 # Default targets.
@@ -40,19 +42,19 @@ all : gnushogi_compile pat2inc gnushogi.bbk @XSHOGI@
 #
 
 gnushogi_compile:
-       -cd $(GNUSHOGIDIR); $(MAKE) gnushogi
+       -cd $(GNUSHOGIDIR) && $(MAKE) gnushogi
 
 pat2inc:
-       -cd $(GNUSHOGIDIR); $(MAKE) pat2inc
+       -cd $(GNUSHOGIDIR) && $(MAKE) pat2inc
 
 sizetest:
-       -cd $(GNUSHOGIDIR); $(MAKE) sizetest
+       -cd $(GNUSHOGIDIR) && $(MAKE) sizetest
 
 xshogi_compile:
-       -cd $(XSHOGIDIR); $(MAKE)
+       -cd $(XSHOGIDIR) && $(MAKE)
 
 gnushogi.bbk:
-       -cd $(GNUSHOGIDIR); $(MAKE) gnushogi.bbk
+       -cd $(GNUSHOGIDIR) && $(MAKE) gnushogi.bbk
 
 
 #
@@ -62,10 +64,10 @@ gnushogi.bbk:
 install: gnushogi_install @XSHOGIINSTALL@
 
 gnushogi_install:
-       -cd $(GNUSHOGIDIR); $(MAKE) install
+       -cd $(GNUSHOGIDIR) && $(MAKE) install
 
 xshogi_install: $(XSHOGIDIR)/xshogi
-       -cd $(XSHOGIDIR); $(MAKE) install
+       -cd $(XSHOGIDIR) && $(MAKE) install
 
 
 
@@ -76,13 +78,13 @@ xshogi_install: $(XSHOGIDIR)/xshogi
 clean: gnushogi_clean @XSHOGICLEAN@ doc_clean
 
 gnushogi_clean:
-       cd $(GNUSHOGIDIR); $(MAKE) clean
+       cd $(GNUSHOGIDIR) && $(MAKE) clean
 
 xshogi_clean:
-       cd $(XSHOGIDIR); $(MAKE) clean
+       cd $(XSHOGIDIR) && $(MAKE) clean
 
 doc_clean:
-       cd doc; $(MAKE) clean
+       cd $(BUILDROOT)/doc && $(MAKE) clean
 
 
 #
@@ -95,8 +97,8 @@ dist:
        $(MAKE) maintainerclean
        rm -rf $(DISTNAME)
        mkdir $(DISTNAME)
-       tar -cf - --exclude .git . | (cd $(DISTNAME) && tar -xf -)
-       cd $(DISTNAME) && ./autogen.sh && ./configure
+       tar -cf - --exclude .git $(ROOT) | (cd $(DISTNAME) && tar -xf -)
+       cd $(DISTNAME) && $(ROOT)/autogen.sh && $(ROOT)/configure
        cd $(DISTNAME)/doc && $(MAKE) info
        cd $(DISTNAME) && make distclean
        tar -zcf $(DISTNAME).tar.gz $(DISTNAME)
@@ -112,7 +114,7 @@ DISTCLEANFILES = \
 
 distclean: clean
        rm -rf $(DISTCLEANFILES)
-       cd doc; $(MAKE) distclean
+       cd $(BUILDROOT)/doc && $(MAKE) distclean
 
 #
 # Extra cleanup, for the maintainer only.
@@ -122,4 +124,4 @@ MAINTAINERCLEANFILES = configure config.h.in
 
 maintainerclean: distclean
        rm -f $(MAINTAINERCLEANFILES)
-       cd doc; $(MAKE) maintainerclean
+       cd $(BUILDROOT)/doc && $(MAKE) maintainerclean
index edd3168..2f21d60 100644 (file)
@@ -186,5 +186,6 @@ AC_SUBST(XSHOGICLEAN)
 AC_CONFIG_FILES([Makefile
                  gnushogi/Makefile
                 gnushogi/Makefile.profile
+                 doc/Makefile
                  xshogi/Makefile])
 AC_OUTPUT
similarity index 75%
rename from doc/Makefile
rename to doc/Makefile.in
index 8b93ab6..7fd7993 100644 (file)
@@ -3,21 +3,22 @@ DISTCLEANFILES = *.ps *.html
 CLEANFILES = *.log *.dvi *.aux *.dlog \
              *.cp *.cps *.fn *.ky *.pg *.toc *.tp *.vr
 
+SRCDIR = @srcdir@
 
 info:
-       makeinfo gnushogi.texinfo
+       makeinfo $(SRCDIR)/gnushogi.texinfo
 
 dvi:
-       texi2dvi gnushogi.texinfo
+       texi2dvi $(SRCDIR)/gnushogi.texinfo
 
 pdf:
-       texi2pdf gnushogi.texinfo
+       texi2pdf $(SRCDIR)/gnushogi.texinfo
 
 # I do some egregious hacks to get around limitations of 
 # texi2html.
 
 html:
-       texi2html -split_node gnushogi.texinfo
+       texi2html -split_node $(SRCDIR)/gnushogi.texinfo
 
 ps: dvi
        dvips -t letter gnushogi.dvi -o gnushogi.ps
@@ -26,7 +27,7 @@ ps2: dvi
        dvi2ps gnushogi.dvi > gnushogi.ps
 
 spell:
-       tr '[A-Z]' '[a-z]' < gnushogi.texinfo | tr -cd '[A-Za-z0-9_ \012]' | \
+       tr '[A-Z]' '[a-z]' < $(SRCDIR)/gnushogi.texinfo | tr -cd '[A-Za-z0-9_ \012]' | \
        tr -s '[ ]' '\012' | sort | uniq -c | sort -nr | spell | sort | uniq
 
 clean:
index f48a1b0..1596717 100644 (file)
@@ -91,7 +91,7 @@ BINBOOK    = -DBINBOOK=\"$(LIBDIR)/gnushogi.bbk\"
 # obtain such a pattern in the opening stage. Sequences of opening
 # patterns may be described in order to support the correct order of moves.
 
-PATTERN    = -DPATTERNFILE=\"../misc/gnushogi.pat\"
+PATTERN    = -DPATTERNFILE=\"$(ROOT)/misc/gnushogi.pat\"
 
 
 all: