foxygit / doom Log in
commit 490def9eb341a42ee05e21d9a461890c411b84c7
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Mon Jul 18 00:07:43 2016 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Mon Jul 18 00:07:43 2016 -0400

    man: Fix build to allow out-of-tree builds.

    For out-of-tree builds we must specify the full paths to source files
    using $(srcdir). Do this for all the template files and clean up some
    of the confusing and inconsistent usage of source dir paths already in
    place.
---
 man/Makefile.am                 | 95 ++++++++++++++++++++++-------------------
 man/bash-completion/Makefile.am | 12 ++++--
 2 files changed, 59 insertions(+), 48 deletions(-)

diff --git a/man/Makefile.am b/man/Makefile.am
index b92cf971..cfd2dc66 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -50,87 +50,94 @@ strifedocs_DATA  = INSTALL.strife  CMDLINE.strife
 CLEANFILES = $(GENERATED_MAN_PAGES) $(SETUP_MAN_PAGES) \
              $(doomdocs_DATA) $(hereticdocs_DATA) \
              $(hexendocs_DATA) $(strifedocs_DATA)
-MANDIR = $(top_srcdir)/man
-DOCGEN = $(MANDIR)/docgen
+DOCGEN = $(srcdir)/docgen

 $(SETUP_MAN_PAGES): chocolate-setup.6
-	cp chocolate-setup.6 $@
+	cp $(srcdir)/chocolate-setup.6 $@

-@PROGRAM_PREFIX@doom.6: ../src $(MANPAGE_GEN_FILES)
-	$(DOCGEN) -g doom -m doom.template $(top_srcdir)/src $(top_srcdir)/src/doom > $@
+@PROGRAM_PREFIX@doom.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
+	$(DOCGEN) -g doom -m $(srcdir)/doom.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/doom > $@

-default.cfg.5: $(top_srcdir)/src $(MANDIR)/default.cfg.template
-	$(DOCGEN) -g doom -m $(MANDIR)/default.cfg.template \
+default.cfg.5: $(top_srcdir)/src $(srcdir)/default.cfg.template
+	$(DOCGEN) -g doom -m $(srcdir)/default.cfg.template \
                  -c default $(top_srcdir)/src/m_config.c > $@

-@PROGRAM_PREFIX@doom.cfg.5: ../src extra.cfg.template
-	$(DOCGEN) -g doom -m extra.cfg.template \
+@PROGRAM_PREFIX@doom.cfg.5: $(top_srcdir)/src extra.cfg.template
+	$(DOCGEN) -g doom -m $(srcdir)/extra.cfg.template \
                  -c extended $(top_srcdir)/src/m_config.c > $@

-CMDLINE.doom : $(MANDIR)/CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/doom
-	$(DOCGEN) -p $(MANDIR)/CMDLINE.template $(top_srcdir)/src/ $(top_srcdir)/src/doom/ > $@
+CMDLINE.doom : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/doom
+	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+                  $(top_srcdir)/src/ $(top_srcdir)/src/doom/ > $@

-INSTALL.doom: $(MANDIR)/INSTALL.template
-	$(MANDIR)/simplecpp -DDOOM -DPRECOMPILED < $(MANDIR)/INSTALL.template > $@
+INSTALL.doom: INSTALL.template
+	$(srcdir)/simplecpp -DDOOM -DPRECOMPILED < $(srcdir)/INSTALL.template > $@


-@PROGRAM_PREFIX@heretic.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
-	$(DOCGEN) -g heretic -m $(top_srcdir)/man/heretic.template $(top_srcdir)/src $(top_srcdir)/src/heretic > $@
+@PROGRAM_PREFIX@heretic.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES) heretic.template
+	$(DOCGEN) -g heretic -m $(srcdir)/heretic.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/heretic > $@

-heretic.cfg.5: $(top_srcdir)/src $(MANDIR)/default.cfg.template
-	$(DOCGEN) -g heretic -m $(MANDIR)/default.cfg.template \
-                 -c default $(top_srcdir)/src/m_config.c > $@
+heretic.cfg.5: $(top_srcdir)/src $(srcdir)/default.cfg.template
+	$(DOCGEN) -g heretic -m $(srcdir)/default.cfg.template \
+                  -c default $(top_srcdir)/src/m_config.c > $@

-@PROGRAM_PREFIX@heretic.cfg.5: $(top_srcdir)/src $(MANDIR)/extra.cfg.template
-	$(DOCGEN) -g heretic -m $(MANDIR)/extra.cfg.template \
+@PROGRAM_PREFIX@heretic.cfg.5: $(top_srcdir)/src extra.cfg.template
+	$(DOCGEN) -g heretic -m $(srcdir)/extra.cfg.template \
                  -c extended $(top_srcdir)/src/m_config.c > $@

-CMDLINE.heretic : $(MANDIR)/CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/heretic
-	$(DOCGEN) -p $(MANDIR)/CMDLINE.template $(top_srcdir)/src/ $(top_srcdir)/src/heretic/ > $@
+CMDLINE.heretic : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/heretic
+	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+                  $(top_srcdir)/src/ $(top_srcdir)/src/heretic/ > $@

-INSTALL.heretic: $(MANDIR)/INSTALL.template
-	$(MANDIR)/simplecpp -DHERETIC -DPRECOMPILED < $(MANDIR)/INSTALL.template > $@
+INSTALL.heretic: INSTALL.template
+	$(srcdir)/simplecpp -DHERETIC -DPRECOMPILED < $(srcdir)/INSTALL.template > $@


 @PROGRAM_PREFIX@hexen.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
-	$(DOCGEN) -g hexen -m $(MANDIR)/hexen.template $(top_srcdir)/src $(top_srcdir)/src/hexen > $@
+	$(DOCGEN) -g hexen -m $(srcdir)/hexen.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/hexen > $@

-hexen.cfg.5: $(top_srcdir)/src $(MANDIR)/default.cfg.template
-	$(DOCGEN) -g hexen -m $(MANDIR)/default.cfg.template \
+hexen.cfg.5: $(top_srcdir)/src default.cfg.template
+	$(DOCGEN) -g hexen -m $(srcdir)/default.cfg.template \
                  -c default $(top_srcdir)/src/m_config.c > $@

-@PROGRAM_PREFIX@hexen.cfg.5: $(top_srcdir)/src $(MANDIR)/extra.cfg.template
-	$(DOCGEN) -g hexen -m $(MANDIR)/extra.cfg.template \
+@PROGRAM_PREFIX@hexen.cfg.5: $(top_srcdir)/src extra.cfg.template
+	$(DOCGEN) -g hexen -m $(srcdir)/extra.cfg.template \
                  -c extended $(top_srcdir)/src/m_config.c > $@

-CMDLINE.hexen : $(MANDIR)/CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/hexen
-	$(DOCGEN) -p $(MANDIR)/CMDLINE.template $(top_srcdir)/src/ $(top_srcdir)/src/hexen/ > $@
+CMDLINE.hexen : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/hexen
+	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+                  $(top_srcdir)/src/ $(top_srcdir)/src/hexen/ > $@

-INSTALL.hexen: $(MANDIR)/INSTALL.template
-	$(MANDIR)/simplecpp -DHEXEN -DPRECOMPILED < $(MANDIR)/INSTALL.template > $@
+INSTALL.hexen: INSTALL.template
+	$(srcdir)/simplecpp -DHEXEN -DPRECOMPILED < $(srcdir)/INSTALL.template > $@


 @PROGRAM_PREFIX@strife.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
-	$(DOCGEN) -g strife -m $(MANDIR)/strife.template $(top_srcdir)/src $(top_srcdir)/src/strife > $@
+	$(DOCGEN) -g strife -m $(srcdir)/strife.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/strife > $@

-strife.cfg.5: $(top_srcdir)/src $(MANDIR)/default.cfg.template
-	$(DOCGEN) -g strife -m $(MANDIR)/default.cfg.template \
+strife.cfg.5: $(top_srcdir)/src default.cfg.template
+	$(DOCGEN) -g strife -m $(srcdir)/default.cfg.template \
                  -c default $(top_srcdir)/src/m_config.c > $@

-@PROGRAM_PREFIX@strife.cfg.5: $(top_srcdir)/src $(MANDIR)/extra.cfg.template
-	$(DOCGEN) -g strife -m $(MANDIR)/extra.cfg.template \
+@PROGRAM_PREFIX@strife.cfg.5: $(top_srcdir)/src extra.cfg.template
+	$(DOCGEN) -g strife -m $(srcdir)/extra.cfg.template \
                  -c extended $(top_srcdir)/src/m_config.c > $@

-CMDLINE.strife : $(MANDIR)/CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/strife
-	$(DOCGEN) -p $(MANDIR)/CMDLINE.template $(top_srcdir)/src/ $(top_srcdir)/src/strife/ > $@
+CMDLINE.strife : CMDLINE.template $(top_srcdir)/src $(top_srcdir)/src/strife
+	$(DOCGEN) -p $(srcdir)/CMDLINE.template \
+                  $(top_srcdir)/src/ $(top_srcdir)/src/strife/ > $@

 INSTALL.strife: INSTALL.template
-	$(MANDIR)/simplecpp -DSTRIFE -DPRECOMPILED < $(MANDIR)/INSTALL.template > $@
+	$(srcdir)/simplecpp -DSTRIFE -DPRECOMPILED < $(srcdir)/INSTALL.template > $@


-INSTALL: $(MANDIR)/INSTALL.template
-	$(MANDIR)//simplecpp -DDOOM -DHERETIC -DHEXEN -DSTRIFE \
-	            -DPRECOMPILED < $(MANDIR)/INSTALL.template > $@
+INSTALL: INSTALL.template
+	$(srcdir)//simplecpp -DDOOM -DHERETIC -DHEXEN -DSTRIFE \
+	            -DPRECOMPILED < $(srcdir)/INSTALL.template > $@

 endif

diff --git a/man/bash-completion/Makefile.am b/man/bash-completion/Makefile.am
index 7001aff2..2c036acf 100644
--- a/man/bash-completion/Makefile.am
+++ b/man/bash-completion/Makefile.am
@@ -21,16 +21,20 @@ MANDIR = $(top_srcdir)/man
 DOCGEN = $(MANDIR)/docgen

 @PROGRAM_PREFIX@doom: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g doom -b doom.template $(top_srcdir)/src $(top_srcdir)/src/doom > $@
+	$(DOCGEN) -g doom -b $(MANDIR)/doom.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/doom > $@

 @PROGRAM_PREFIX@heretic: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g heretic -b heretic.template $(top_srcdir)/src $(top_srcdir)/src/heretic > $@
+	$(DOCGEN) -g heretic -b $(MANDIR)/heretic.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/heretic > $@

 @PROGRAM_PREFIX@hexen: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g hexen -b hexen.template $(top_srcdir)/src $(top_srcdir)/src/hexen > $@
+	$(DOCGEN) -g hexen -b $(MANDIR)/hexen.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/hexen > $@

 @PROGRAM_PREFIX@strife: $(top_srcdir)/src $(DOCGEN) $(BASH_COMPLETION_TEMPLATES)
-	$(DOCGEN) -g strife -b strife.template $(top_srcdir)/src $(top_srcdir)/src/strife > $@
+	$(DOCGEN) -g strife -b $(MANDIR)/strife.template \
+                  $(top_srcdir)/src $(top_srcdir)/src/strife > $@

 EXTRA_DIST = \
     $(BASH_COMPLETION_TEMPLATES) \