Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

convert doc/Makefile to CMake #119

Merged
merged 1 commit into from

4 participants

@kljohann
Owner
  • CMake will build the pdf version of the manual if texi2pdf is installed. It will be installed to DOCDIR/ledger{,3}.pdf, for example /usr/local/share/ledger/ledger3.pdf. Also, the man page will be installed to MANDIR/man1/ledger.1.
  • The option BUILD_DOCS is now on by default.
  • A new option BUILD_WEB_DOCS is used to toggle the generation of the html version of the manual and the man page (off by default).
  • All this is added to the doc make target.

Note that the man2html rule is untested as I don't have that program.

@kljohann kljohann convert doc/Makefile to CMake
CMake will build the pdf version of the manual if texi2pdf is installed.
It will be installed to DOCDIR/ledger{,3}.pdf, for example
/usr/local/share/ledger/ledger3.pdf.
Also, the man page will be installed to MANDIR/man1/ledger.1

The option BUILD_DOCS is now on by default.

A new option BUILD_WEB_DOCS is used to toggle the generation
of the html version of the manual and the man page (off by default).

All this is added to the 'doc' make target.
c88862f
@jwiegley jwiegley merged commit bf8b7e4 into ledger:next
@kljohann
Owner

Oh, seems like there are issues when build dir≠source dir. I will send a patch in a bit.

@simonmichael

Hi Johann, can you give me instructions for building the web docs from a clean working copy, and I will fix the website which has not been building ledger 3 docs since this change. Here or on #ledger is fine. Thanks! -sm

Owner
Owner

Try running acprep [...] configure -- -DBUILD_WEB_DOCS=1make doc/ninja doc

Owner

From IRC: Run ./acprep --output=. configure -- -DBUILD_WEB_DOCS=1 && make doc to build documentation in doc/.

Owner

With the latest changes to acprep:

./acprep make doc -- -DBUILD_WEB_DOCS=1

should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 14, 2013
  1. @kljohann

    convert doc/Makefile to CMake

    kljohann authored
    CMake will build the pdf version of the manual if texi2pdf is installed.
    It will be installed to DOCDIR/ledger{,3}.pdf, for example
    /usr/local/share/ledger/ledger3.pdf.
    Also, the man page will be installed to MANDIR/man1/ledger.1
    
    The option BUILD_DOCS is now on by default.
    
    A new option BUILD_WEB_DOCS is used to toggle the generation
    of the html version of the manual and the man page (off by default).
    
    All this is added to the 'doc' make target.
This page is out of date. Refresh to see the latest.
Showing with 76 additions and 19 deletions.
  1. +3 −2 CMakeLists.txt
  2. +73 −0 doc/CMakeLists.txt
  3. +0 −17 doc/Makefile
View
5 CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8.5)
-project(Ledger)
+PROJECT(ledger)
set(Ledger_VERSION_MAJOR 3)
set(Ledger_VERSION_MINOR 0)
@@ -18,7 +18,8 @@ option(DISABLE_ASSERTS "Build without any internal consistency checks" OFF)
option(BUILD_DEBUG "Build support for runtime debugging" OFF)
option(BUILD_LIBRARY "Build and install Ledger as a library" ON)
-option(BUILD_DOCS "Build and install documentation" OFF)
+option(BUILD_DOCS "Build and install documentation" ON)
+option(BUILD_WEB_DOCS "Build version of documentation suitable for viewing online" OFF)
option(BUILD_EMACSLISP "Build and install ledger-mode for Emacs" OFF)
if(BUILD_DEBUG)
View
73 doc/CMakeLists.txt
@@ -0,0 +1,73 @@
+set(info_files ledger.texi ledger3.texi)
+
+find_program(MAKEINFO makeinfo)
+find_program(TEXI2PDF texi2pdf)
+find_program(MAN2HTML man2html)
+
+########################################################################
+
+foreach(file ${info_files})
+ get_filename_component(file_base ${file} NAME_WE)
+ if(BUILD_WEB_DOCS)
+ if(NOT MAKEINFO)
+ message(FATAL_ERROR "Could not find makeinfo. HTML version of documentation cannot be built.")
+ endif()
+
+ add_custom_command(OUTPUT ${file_base}.html
+ COMMAND makeinfo --force --html --no-split -o ${file_base}.html ${file}
+ DEPENDS ${file}
+ VERBATIM)
+ list(APPEND ledger_doc_files ${file_base}.html)
+ endif(BUILD_WEB_DOCS)
+
+ if(NOT TEXI2PDF)
+ mesage(WARNING "Could not find texi2pdf. PDF version of documentation will not be built.")
+ else()
+ get_filename_component(file_base ${file} NAME_WE)
+ add_custom_command(OUTPUT ${file_base}.pdf
+ COMMAND texi2pdf -b -q ${file}
+ COMMAND rm -f ${file_base}.aux ${file_base}.cp ${file_base}.fn ${file_base}.ky ${file_base}.log ${file_base}.pg ${file_base}.toc ${file_base}.tp ${file_base}.vr
+ DEPENDS ${file}
+ VERBATIM)
+ list(APPEND ledger_doc_files ${file_base}.pdf)
+ endif()
+endforeach()
+
+########################################################################
+
+if(BUILD_WEB_DOCS)
+ include(FindUnixCommands)
+ if(NOT BASH)
+ message(FATAL_ERROR "Could not find bash. Unable to build documentation.")
+ endif()
+ if(NOT MAN2HTML)
+ message(FATAL_ERROR "Could not find man2html. HTML version of man page cannot be built.")
+ endif()
+
+ add_custom_command(OUTPUT ledger.1.html
+ COMMAND ${BASH} -c "man2html ledger.1 | tail -n+3 > ledger.1.html"
+ DEPENDS ledger.1
+ VERBATIM)
+ list(APPEND ledger_doc_files ledger.1.html)
+endif(BUILD_WEB_DOCS)
+
+########################################################################
+
+add_custom_target(doc ALL DEPENDS ${ledger_doc_files})
+
+########################################################################
+
+include(GNUInstallDirs)
+
+if(CMAKE_INSTALL_MANDIR)
+ install(FILES ledger.1
+ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT doc)
+endif(CMAKE_INSTALL_MANDIR)
+
+if(CMAKE_INSTALL_DOCDIR)
+ foreach(file ${info_files})
+ get_filename_component(file_base ${file} NAME_WE)
+ install(FILES ${file_base}.pdf
+ DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT doc OPTIONAL)
+ endforeach()
+endif(CMAKE_INSTALL_DOCDIR)
View
17 doc/Makefile
@@ -1,17 +0,0 @@
-# quick doc-building makefile used by website
-# requires: man2html, texinfo
-
-docs: ledger.1.html ledger.html ledger.pdf ledger3.html ledger3.pdf
-
-%.1.html: %.1
- -man2html $< | tail -n+3 >$@
-
-%.html: %.texi
- -makeinfo --force --html --no-split -o $@ $<
-
-%.pdf: %.texi
- -texi2pdf -b -q $<
- rm -f $*.aux $*.cp $*.fn $*.ky $*.log $*.pg $*.toc $*.tp $*.vr
-
-clean:
- rm -rf ledger.1.html ledger.html ledger3.html ledger.pdf ledger3.pdf
Something went wrong with that request. Please try again.