There are a few subtle differences between unix makefiles and ninja
that sometimes go uncaught as the core devs usually use ninja.
This commit fixes two:
- don't depend directly on files in other source/binary directories.
Use a custom target to depend on instead
- recursively create target directories, as make doesn't automatically
Changes to tip_of_the_day.list.c will now properly trigger a rebuild.
Plus a few minor assorted fixes and changes to generating the man pages
- only generate the final files in share/gnucash, not in the build directory
- gnucash-cli.1 was not installed, gnucash.1 twice
Note manpages for both gnucash and gnucash-cli need revision.
They refer to outdated files and environment variables, and
some more recent command line options are missing.
file(COPY ) will only trigger when the destination file doesn't exist yet.
It won't retrigger on source file changes.
configure_file on the other hand will. To avoid unwanted substitution
attempts this can be invoked with the COPYONLY keyword.
Disadvantage of configure_file is that it will only take one
input file where file(COPY ) can operate on a list of files.
As such the configure_file statement has to be wrapped in a foreach.
A few uses of file(COPY ) can't be replaced as they are setting
file permissions. And the one in make_dist has been kept as that
always operates on an empty directory, hence copying is guaranteed.
The former will monitor the file for updates and copy it again
the latter will only copy the file if it doesn't exist in the destination yet
- depend on gnc-vcs-info.h file directly instead of the gnc-vcs-info target
The latter won't cause gnucash to update the manpage in case gnc-vcs-info.h changes,
the former does.
- use GNC_VCS_REV as version instead of the static VERSION parameter
This simplifies a number of escape sequences.
The generated file to configure the man page was split up a bit further:
- code that extracted the GNC_VCS_REV_Y_M from gnc-vcs-info.h was spun out
into its own function that now sets all parameters in gnc-vcs-info.h
as environment variables.
- this function is now invoked by configure-manpage.cmake to extract
the date to insert into the manpage.
- the manpage in addition now shows the full date rather than only
yyyy-mm. This is how man itself does it as well.
When the tip_of_the_day.list is created a new line is appended to the
list file and on Windows this causes a blank tip so remove the adding
of the extra line.
The swig wrappers don't really depend on git (but rather on swig) and there can be
situations the builder wants to generate the wrappers also from a tar ball.
- the two dist_add_... macros now both take a list of file names
as argument so more files can be added at once to the dist tarball.
- dist_add_generated now creates the right target by itself. There's
no need to pass one any more
- make the swig generated *.py module files explicit output files
- change a couple of custom_targets into custom_commands. The only
reason they were defined as targets was to ensure they got built
before the dist tarball. This is now properly handled by the
dist_add_... macros.
- correctly handle dependency on swig-runtime.h (using OBJECT_DEPENDS
was not the way to do it according to that property's help page)
cmake with unix makefiles fails to resolve dist dependencies
added from COPY_FROM_BUILD if these dependencies aren't built yet.
This commit replaces the COPY_FROM_BUILD based logic with two new functions
'dist_add_configured' and 'dist_add_generated' to indicate which files should
be included in the dist tarball. The latter also adds a target level dependency
to the dist tarball custom command. Hence the former should
be used for files that get generated during a cmake run while the latter
should be used for files generated as the result of a 'make/ninja-build' run
(like files for which an add_custom_command rule exists).
Note: this commit also temporarily disables the dist target when building
from a tarball (and hence it won't be tested in distcheck either). This
will be handled in a future commit.
This includes removal of the now unused make-gnucash-potfiles.in,
checking for CMakeLists.txt rather than Makefile.am in gnc-vcs-info,
upating the HACKING file,
and generally updating references to autotools.
I have kept "Makefile.*" exclude patterns in our CMakeLists.txt files
because they may still be lingering in the source directory from
previous autogen.sh runs. At some point these should probably be
removed as well still, together with the gitignore references to them.
This effectively replaces the use of GNUCASH_BUILD_DATE with GNUCASH_SCM_REV_DATE.
The latter is extracted from the current commit if building from some kind of vcs
(currently only works correctly for svn and git). The info extracted while building
from vcs is then also added to the dist tarball so it's available when building
from tarball as well (via the file libgnucash/core-utils/gnc-vcs-info.h).
The same date is also used to set the date in gnucash' man page document.
A practical detail: I have changed the substitution variables in the man page template
from @- -@ to ${} so we could leverage CONFIGURE_FILE in cmake. The necessary
related adjustments have also been made to Makefile.am's substitution rules.