Simon Sobisch
2017-10-19 20:29:57 UTC
I'm working on enabling cross-compilation for GnuCOBOL. As a
prerequisite I'd see a release tarball (as `make dist` on the host for
the people cross-compiling from vcs).
The autoconf parts are fixed now [1], but there's one thing in the
Makefiles where we generate a binary with the compiler we've generated
directly beforehand. This obviously can't work and I'd like to skip
this and telling people to do so on the target machine.
The main question is: what is the best practice for doing so? I'd using
AC_SUBST([CROSS_COMPILATION]) and checking this in the "offending"
Makefile for simply dropping the generation completely.
Is there a better practice? How do other projects handle this?
"offending" Makefile.am:
~~~
extrasdir = @COB_LIBRARY_PATH@
extras_DATA = CBL_OC_DUMP.$(COB_MODULE_EXT)
EXTRA_DIST = CBL_OC_DUMP.cob
CLEANFILES = $(extras_DATA)
SUFFIXES = .cob .$(COB_MODULE_EXT)
.cob.$(COB_MODULE_EXT):
. $(top_builddir)/tests/atconfig && \
. $(top_builddir)/tests/atlocal extras-$@ \
&& $$COBC -m -Wall -O -o $@ $<
~~~
Note: The environment variable COBC contains the full path to the
libtoolized executable.
[1]autoconf parts fixed by:
1. replacing AC_RUN_IFELSE by AC_COMPILE_IFELSE for parts that only
checked in the precprocessor
2. "assume" correct values for cross-compiling for example when checking
library vs. header
prerequisite I'd see a release tarball (as `make dist` on the host for
the people cross-compiling from vcs).
The autoconf parts are fixed now [1], but there's one thing in the
Makefiles where we generate a binary with the compiler we've generated
directly beforehand. This obviously can't work and I'd like to skip
this and telling people to do so on the target machine.
The main question is: what is the best practice for doing so? I'd using
AC_SUBST([CROSS_COMPILATION]) and checking this in the "offending"
Makefile for simply dropping the generation completely.
Is there a better practice? How do other projects handle this?
"offending" Makefile.am:
~~~
extrasdir = @COB_LIBRARY_PATH@
extras_DATA = CBL_OC_DUMP.$(COB_MODULE_EXT)
EXTRA_DIST = CBL_OC_DUMP.cob
CLEANFILES = $(extras_DATA)
SUFFIXES = .cob .$(COB_MODULE_EXT)
.cob.$(COB_MODULE_EXT):
. $(top_builddir)/tests/atconfig && \
. $(top_builddir)/tests/atlocal extras-$@ \
&& $$COBC -m -Wall -O -o $@ $<
~~~
Note: The environment variable COBC contains the full path to the
libtoolized executable.
[1]autoconf parts fixed by:
1. replacing AC_RUN_IFELSE by AC_COMPILE_IFELSE for parts that only
checked in the precprocessor
2. "assume" correct values for cross-compiling for example when checking
library vs. header