Using make to compile for sun3 and sun4

Dave Kemp Kemp at dockmaster.ncsc.mil
Sun Jul 16 02:04:00 AEST 1989


Recently I asked how to do:

 >     if (sun3) CFLAGS = -f68881
 >     else      CFLAGS = (nothing)

 > . . . I will summarize for the group.

Thanks for all the suggestions.

Dieter Woerz ({pyramid!iaoobel,uunet!unido}!isaak!woerz) suggested using
imake, which modifies a makefile, passes it through cpp, and give the
result to make.  He mentions that the X distribution is built using imake,
and that it is available with X in the directory util/imake.

Larry Weissman (larryw at nsr.bioeng.washington.edu) suggests using make
recursively, with the outer call checking the status of /bin/sun3 and
then invoking make with CFLAGS set explicitly on the command line:
  $(MAKE) "CFLAGS=$(SUN3CFLAGS)", where SUN3CFLAGS is set up earlier,
and an "if" test is used to terminate the recursion.

David at sun.com had the best suggestion, being both concise and quite
general.  It involves using nested macro expansion to generate the name of
the macro to use for each particular case.  Here it is, in its entirety:

  CFLAGS= $(CFLAGS$(TARGET_ARCH))
  CFLAGS-sun3= -f68881

David credits the author of make for this idea; the technique is so
generally useful that it is now a permanent part of my bag of tricks.

Thanks again to everyone who responded.

   Dave Kemp <Kemp at dockmaster.ncsc.mil>



More information about the Comp.sys.sun mailing list