I am writing a make file that will be used in a variety of flavors
of Unix (including standard AIX, NCR, HP, SunOS, SunSolaris,
and VAX as well as gnu make) to build archive libraries.
The directory structure looks something like this:
Source files in: /project/source
Archive libs in: /project/libs
Because a variety of different compiling environments are used
on each system, the object files can be put one of four places,
depending on which option is passed to make.
Object files in: /project/source/o1 or /project/source/o2 or
/project/source/o3 or /project/source/o4
All the libraries (archives) are kept in the same directory and
have a digit 1-4 just before ".a" to identify which library it is.
I currently set VPATH to the object directory before calling make
and use the following rule, where all indicated macros are set
in a shell script before calling make:
The target is specified as follows:
/project/libs/lib$(LIBDIGIT) : f1.o f2.o f3.o f4.o
The above works fine on AIX and GNU and on the Sun systems. However,
the NCR and the HP systems don't know about VPATH (which is how the
system knows where to look for the object files when building the archive).
I've tried putting full paths everywhere, but can't seem to get a combination
that works in all environments.
Has anyone else solved a problem like this one? I need to maintain the same
code across multiple architectures (including non-Unix) and I'm hoping to
maintain only a single set of makefiles and shell scripts for Unix.