[comp.unix.questions] Makefile which supports multiple platforms

vrm@cerc.wvu.wvnet.edu (Vasile R. Montan) (08/31/89)

  We are developing software which must run on several different
platforms and are looking for ways to keep the files organized and up
to date.  I figure that other people have already solved this problem,
so instead of spending too much time reinventing the wheel, I thought I
would find out what other people are doing. In particular, I am
looking for a makefile which will recognize the type of machine you
are compiling on and use the appropriate object code to create the
executable.  The directory structure that we are using is as follows:


                               develop
                                  |
            ----------------------------------------------
            |      |      |      |      |                |
           doc    inc    lib    src    demo             bin
                                                         |
                                              -----------------------
                                              |    |     |    |     |
                                             dec   hp   sgi  sun3  sun4

   One copy of the source code for a particular project will be kept
in the src directory.  The source code for the driver will be kept in
the demo directory.  The makefile in each of these directories should
automatically identify the type of machine that you are compiling on,
use the object code from the appropriate directory, and create the
executable in the appropriate directory.

   For example: if you are compiling on a digital machine, then you
would simply have to type ``make'' in the src directory.  The makefile
will compare all of the .c files in the src directory with the
corresponding .o files in the bin/dec directory to determine what to
make.  It will then create the executable in the bin/dec directory.
You could then type ``make run'' and the makefile will determine which
executable to run.

   Thanks for any help in advance.

-- Vasile Montan, Software Engineer
-- Bell Atlantic Knowledge Systems, Inc.
-- Contracted to: Concurrent Engineering Research Center
-- vrm@cerc.wvu.wvnet.edu