[comp.unix.wizards] Multiple machine binaries from a single set of sources

PEREIRA@csli.stanford.edu (Fernando Pereira) (08/23/87)

Much easier than all the solutions proposed so far is what I have
been doing successfully for quite a while on Suns. Just have one
directory hierarchy for sources (eg. ../src) and parallel hierarchies
(eg. ../sun-2, ../sun-3) for binaries. Create symbolic links in the
machine type hierarchies to all the source files in the source hierarchy,eg.

	cd ../sun-2
	foreach i (../src/[Mm]akefile ../src/*.[ch])
		echo `basename $i`
		ln -s $i
	end

A "make" in any of the machine-type directories will leave the binaries
in that directory.

Because NFS by default does not share root ownership and permissions,
it is convenient to have all the files in the various hierarchies above owned
by a shared user (eg. "bin") so that one can login onto machines of different
types to make the binaries for that type.

Fernando Pereira
pereira@ai.sri.com
-------

cck@cunixc.columbia.edu (Charlie C. Kim) (08/24/87)

In article <8957@brl-adm.ARPA> PEREIRA@csli.stanford.edu (Fernando Pereira) writes:
>Much easier than all the solutions proposed so far is what I have
>been doing successfully for quite a while on Suns. Just have one
>directory hierarchy for sources (eg. ../src) and parallel hierarchies
>(eg. ../sun-2, ../sun-3) for binaries. Create symbolic links in the
>machine type hierarchies to all the source files in the source hierarchy,eg.
...

The idea is good, but there's an easier way to manage it if you have
the 4.3 or System V make - use the VPATH macro to specify an alternate
path to get sources from.  In the above case, for each bin dir (e.g.
../sun-2, etc.), have a makefile with following line:
	VPATH=../src

You'll have to be careful about a few things, but in general, it's
better than propogating all those symbolic links.

Charlie C. Kim
User Services
Columbia University

guy%gorodish@Sun.COM (Guy Harris) (08/24/87)

> The idea is good, but there's an easier way to manage it if you have
> the 4.3 or System V make - use the VPATH macro to specify an alternate
> path to get sources from.  In the above case, for each bin dir (e.g.
> ../sun-2, etc.), have a makefile with following line:
> 	VPATH=../src

Beware: VPATH not only affects where "make" finds *source* files, it also
affects where it finds *target* files.  Don't put any binary files in the
"../src" directory, or it will cheerfully use those instead of building
versions in the current directory.  (Tested both with the 4.3BSD "make" and the
SunOS 3.2 "make".)
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com