Portability and makefile questions

J.H.M. Dassen Ray jdassen@wi.LeidenUniv.nl
Thu Sep 30 23:56:00 GMT 1999


Beverly Endresen <brendres@collins.rockwell.com> wrote:
>1) Question #1: Having difficulty getting a gnu C makefile to compile on a
>Digital Unix Alpha workstation.

By "gnu C makefile" do you mean a Makefile you've written for use with GNU
make, or a Makefile used by a particular piece of GNU software?

>Is there a standard for this for the Alpha? Does anyone have an example
>makefile that will work?  Also, would the makefile be different when
>compiling on an NT PC?

In general, Makefiles often have to deal with system idiosyncracies (e.g.
compiler flags). There are a number of GNU tools that allow you to abstract
away from system idiosyncracies like autoconf and libtool; check out
www.gnu.org for info.

>2) Question #2: I'd like to know if a #define statement must be added to
>each source code package/file, or to the makefile, or a command-line
>option/switch

Whereever it's convenient. You may want to put these defines in a header
file like "config.h" which you include in every source file, or you can add
"-DFOO" to the compiler flags (either on the command line or in a makefile).

>I know that some "portable" compilers require at least the define statement
>to distinguish operating systems.  

There are a number of platform-specific predefined defines you can use to
distinguish between platforms. E.g. if you do something like "gcc -E -dM - <
/dev/null" you can see them.

HTH,
-- 
Ray Dassen <jdassen@wi.LeidenUniv.nl>



More information about the Gcc-help mailing list