From: Anthony F. <ant...@gm...> - 2013-03-27 23:34:17
|
Ludovic, greetings -- On Wed, Mar 27, 2013 at 3:54 PM, Ludovic Rousseau <lud...@gm...> wrote: > I removed the use of $^ just 10 days ago. See [1] and [2]. > > It does not harm (too much) and allow support of BSD make. I saw those commits, hence my comments in the original submission. My question is, without using $^, how can one support VPATH or some other out-of-source-tree build method? (It might be possible to use autoconf to sub in the right paths. I don't know autoconf & friends well enough to say.) > >> Submitting anyway, in case someone might find it useful later. >> >> These changes build on top of my trivial cross-compile patch, and >> allow me to build pcscd and ccid in the common autoconf manner (i.e., >> out of source tree). > > Why do you need the second patch? Because some of the headers that pcsc-wirecheck-gen.c relies on are created by "configure": in an out-of-source-tree build, this means that pcsc-wirecheck-gen.c lives in the main source tree, but PCSC/pcsclite.h and pcsc.h live in the build directory. That is, I end up with this situation: $ find pcscd-build/src/ pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/ -type f -name '*.[hc]' | sort ### these are generated files, so they live in the "build" directory pcscd-build/src/configfile.c pcscd-build/src/pcscd.h pcscd-build/src/PCSC/pcsclite.h pcscd-build/src/tokenparser.c ### these are the files that ship with the distribution, ### so they live in the "original source" directory: pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/atrhandler.c pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/atrhandler.h ... pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcscdaemon.c pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/debuglog.h pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/ifdhandler.h pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/reader.h pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/winscard.h pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/PCSC/wintypes.h pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-dist.c pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-gen.c pcsc-lite-r6574-ajf-g2f8636a/PCSC/src/pcsc-wirecheck-main.c ... > What fails without the patch? The actual "make" invocation is done inside pcscd-build, using VPATH to find the sources in the main distribution tree. For the documentation issue, it fails because the .pod file lives in the source (distribution) tree, not in the build (generated) tree. GNU Make is smart enough to prepend the necessary bits of VPATH to $^ so that the original source .pod file is found correctly. In the case of pcsc-wirecheck-gen, it's a bit crazier: * the actual 'make' process is running in pcscd-build/src * but it's working on a file in the source tree (pcsc-lite-.../PCSC/pcsc-wirecheck-gen.c) * that file includes (directly or indirectly) both distributed and generated headers, both as "local" includes and <system> includes. So I had to add all the various places that the compiler has to look for the headers. The short answer to "what failes without the patch" is that out-of-source-tree builds do not complete without these patches (or something close to them). Correct answer might very well be: "don't do that". Fair enough, but this technique is a very standard way of building packages, especially autoconf packages; the fact that it failed was an unpleasant surprise. (And even if you don't care for the rest of the patch, you include two ".in" files on a list of _SOURCES in there somewhere; that should probably be fixed regardless of the rest of this patch.) Thanks again. Best regards, Anthony Foiani |