Article View: comp.unix.programmer
Article #3796Re: automake conditional compilation technicality
From: Ken Pizzini
Date: Fri, 07 Jan 2000 00:00
Date: Fri, 07 Jan 2000 00:00
44 lines
2945 bytes
2945 bytes
On 5 Jan 2000 00:43:44 GMT, Ian Macdonald <ian@caliban.org> wrote: >>>The problem comes in not knowing how to inform the build process when >>>it should build the EXTRA_qrcs_SOURCES files. >>> >>>My configure.in checks for the existence of linux/ext2_fs.h and, if it >>>is found, defines HAVE_LINUX_EXT2_FS_H. That's the easy part. >> >>The configure.in should also conditionally set a configuration >>variable, say EXT2_FS, to ext2fs.o and have your Makefile.am say: >> qrcs_SOURCES = qrcs.c qrcs.h @EXT2_FS@ > >So when would you use the EXTRA_qrcs_SOURCES macro then? When you include any files which are not always built. To quote from the relevant section of the automake manual (which is perhaps less than clear on the subject): : Automake must know all the source files that could possibly go into a : program, even if not all the files are built in every circumstance. : Any files which are only conditionally built should be listed in the : appropriate `EXTRA_' variable. For instance, if `hello-linux.c' were : conditionally included in `hello', the `Makefile.am' would contain: : : EXTRA_hello_SOURCES = hello-linux.c : : Similarly, sometimes it is useful to determine the programs that are : to be built at configure time. For instance, GNU `cpio' only builds : `mt' and `rmt' under special circumstances. : : In this case, you must notify Automake of all the programs that can : possibly be built, but at the same time cause the generated : `Makefile.in' to use the programs specified by `configure'. This is : done by having `configure' substitute values into each `_PROGRAMS' : definition, while listing all optionally built programs in : `EXTRA_PROGRAMS'. Now that last paragraph talks about "_PROGRAMS", but it also applies to "_SOURCES": you tell automake itself about the optionally-compiled sources with the EXTRA_qrcs_SOURCES macro, and you tell the configure script that you want the EXT2_FS configuration variable interpolated into the expansion of the make variable qrcs_SOURCES by including the @EXT2_FS@ reference on the qrcs_SOURCES line. --Ken Pizzini
Technical Details
Message-ID:
<slrn87b5su.3ul.ken@pulsar.halcyon.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<slrn86k3jo.h30.ian@caliban.xs4all.nl> <slrn874aji.95.ken@pulsar.halcyon.com> <slrn8754tv.qfb.ian@caliban.xs4all.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109f73,70579a91ac9a2bf6 X-Google-Attributes: gid109f73,public X-Google-Thread: fc89c,70579a91ac9a2bf6 X-Google-Attributes: gidfc89c,public From: ken@halcyon.com (Ken Pizzini) Subject: Re: automake conditional compilation technicality Date: 2000/01/07 Message-ID: <slrn87b5su.3ul.ken@pulsar.halcyon.com> X-Deja-AN: 569453787 References: <slrn86k3jo.h30.ian@caliban.xs4all.nl> <slrn874aji.95.ken@pulsar.halcyon.com> <slrn8754tv.qfb.ian@caliban.xs4all.nl> Mail-Copies-To: nobody X-Trace: brokaw.wa.com 947231147 14008 206.63.63.10 (7 Jan 2000 07:45:47 GMT) Organization: _ User-Agent: slrn/0.9.5.3 (UNIX) Reply-To: ken@halcyon.com NNTP-Posting-Date: 7 Jan 2000 07:45:47 GMT Newsgroups: comp.unix.programmer,gnu.utils.help