Results 1 to 3 of 3
I'm writing a website in c++ and would like to keep the directory structure of the cpp/h files and the generated binaries the same. If you feel like saying "use ...
- 03-15-2007 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 8
Makefile.am with recursive prefix variable?
I'm writing a website in c++ and would like to keep the directory structure of the cpp/h files and the generated binaries the same. If you feel like saying "use blah instead of c++" please stop reading
I figured the best way to do this was to have "prefix=../${prefix}/<dirname>" in each of my Makefile.am files, and "bindir=${exec_prefix}" in each one with a "bin_PROGRAMS". Instead (only when doing "make install", no errors for "make") I get this error:
In the above example, common doesn't set prefix (it's only got .h files and sooner or later some libs to be statically linked). Also, I will eventually have sub-dirs in htdocs. I know thatCode:Making install in src make[1]: Entering directory `/var/www/vhostdir/private/projectname/src' Making install in common make[2]: Entering directory `/var/www/vhostdir/private/projectname/src/common' make install-am make[3]: Entering directory `/var/www/vhostdir/private/projectname/src/common' make[4]: Entering directory `/var/www/vhostdir/private/projectname/src/common' make[4]: Nothing to be done for `install-exec-am'. make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/var/www/vhostdir/private/projectname/src/common' make[3]: Leaving directory `/var/www/vhostdir/private/projectname/src/common' make[2]: Leaving directory `/var/www/vhostdir/private/projectname/src/common' Making install in subdomainname make[2]: Entering directory `/var/www/vhostdir/private/projectname/src/subdomainname' Making install in htdocs make[3]: Entering directory `/var/www/vhostdir/private/projectname/src/subdomainname/htdocs' Makefile:150: *** Recursive variable `prefix' references itself (eventually). Stop. make[3]: Leaving directory `/var/www/vhostdir/private/projectname/src/subdomainname/htdocs' make[2]: *** [install-recursive] Error 1 make[2]: Leaving directory `/var/www/vhostdir/private/projectname/src/subdomainname' make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory `/var/www/vhostdir/private/projectname/src' make: *** [install-recursive] Error 1
works, but my understanding is that the autotools are supposed to minimize typing. Basically, if there was some way of passing an environment variable from one Makefile to it's sub-dir's Makefile, and make would allow me to set it like this: "some_var=../${some_var}/dirname" I'd be happy. It also be nice if when overridding the prefix with ./configure prefix="/var/www", the prefix would change, but the bindir's relative paths would remain.Code:prefix=../../../../output bindir=${exec_prefic}/<top_dir>/<parent_dir>/<dirname>
- 03-16-2007 #2Just Joined!
- Join Date
- Mar 2007
- Posts
- 8
Well, I've been farting around and I've managed to get closer...
/var/www/vhostdir/private/src/htdocs/Makefile.am
The problem with this is that the prefix directory will be overwritten. I've also got to set the bindir with the full relative path (if that makes any sense, lol). I've tried to parse the prefix variable in my configure.ac script, but can't find a way to distinguish between when the user sets the variable and when configure automatically sets the variable. I've also managed to find two Makefile variables, the ${top_builddir} and ${abs_builddir}. With some creative use of sed I could probably remove the ${top_builddir} from ${abs_builddir} variable and find out that I'm in <project folder>/src/folder1/folder2. Then again, I'm not really looking for some hack to get automake to keep the directory structure ~.~ Ohh well, I'll check back here tomorrow, see if anyone has anything more to say :PCode:prefix=$(top_builddir)/output bindir=${exec_prefix}/vhostdir/htdocs #...
- 03-20-2007 #3Just Joined!
- Join Date
- Mar 2007
- Posts
- 8
Ok, well last try for me to get an answer

1) I'd like to change the default $prefix variable to "./output" the ./ being the folder with the configure script. So if the user runs "configure --prefix=/var/www" then "/var/www" is used, if no prefix flag when running configure "./output" is used.
2) I'd like a simple way to have each Makefile install it's binaries to the same relative path from ./src. So, if I have some binary, say "./src/some-web/htdocs/index.bin" and install it, it will install to "$prefix/some-web/htdocs/index.bin". I just don't want to have to re-type /some-web/htdocs" for each sub directory, and the sub-directories sub directories, etc... :P


Reply With Quote