Hi, I have a problem with parallel build trees (a.k.a. VPATH Builds).
I'm trying to use GNU autotools to distribute a shell script that need to be installed with some other files (sample configuration, man pages, data, etc etc). Nothing in this project needs to be compiled, but the script is passed through sed to replace some variables (as showed through examples in section 9.1 of automake documentation, and section 4.8.2 of autoconf documentation). The provided examples work with recursive make, but I only want to manage a single Makefile.am, and thus I want to use non-recursive make; that's where my problem appears. I'm trying to have the final script (the file where sed output is redirected) in the same subdirectory as the script template, but I can't find a way to do this that would let "make distcheck" work. According to section 2.2.6 of GNU automake documentation: "The build tree usually has the same subdirectory layout as the source tree; its subdirectories are created automatically by the build system." Unfortunately, it doesn't seem to be true for the SCRIPTS primary (I assume it's true and works as expected for compiled binaries and libraries, I can't know, I'm new to autotools and I'm a sysadmin, I develop only scripts, nothing compiled). So, at first, I did this : -----%<----- # # Main script # pkgsysconfdir = $(sysconfdir)/$(PACKAGE) bin_SCRIPTS = scripts/my_script # Command to substitute variables do_subst = $(SED) \ -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ -e 's,[@]VERSION[@],$(VERSION),g' \ -e 's,[@]pkgsysconfdir[@],$(pkgsysconfdir),g' \ -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' # Generic recipe to substitute variables in scripts $(bin_SCRIPTS): Makefile $(do_subst) $(srcdir)/$@.in > $@ chmod +x $@ # Per-script prerequisites scripts/my_script: $(srcdir)/scripts/my_script.in ----->%----- This works for a normal build, but not with "make distcheck"; it fails with the error message (translated from French): /bin/bash: scripts/my_script: No such file or directory I guess make doesn't create the "scripts" subdirectory in "_build/sub" as it's supposed to (according to the documentation quoted above), so the shell can't redirect sed's output to this file. So for now I'm doing this: -----%<----- # # Main script # pkgsysconfdir = $(sysconfdir)/$(PACKAGE) bin_SCRIPTS = my_script # Command to substitute variables do_subst = $(SED) \ -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ -e 's,[@]VERSION[@],$(VERSION),g' \ -e 's,[@]pkgsysconfdir[@],$(pkgsysconfdir),g' \ -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' # Generic recipe to substitute variables in scripts $(bin_SCRIPTS): Makefile $(do_subst) $(srcdir)/scripts/$@.in > $@ chmod +x $@ # Per-script prerequisites my_script: scripts/my_script.in ----->%----- It works with both a normal build and "make distcheck", but the script ends up in $(srcdir), instead of the "scripts" subdirectory, which is not my initial goal. Is there a way to create the script in the "scripts" subdirectory, *and* make it work with "make distcheck" ? Thanks in advance. Regards, -- Raphaël Halimi
signature.asc
Description: OpenPGP digital signature