Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: Kemp@dockmaster.ncsc.mil (Dave Kemp) Newsgroups: comp.sys.sun Subject: Re: Using make to compile for sun3 and sun4 Keywords: SunOS Message-ID: <180@brazos.Rice.edu> Date: 15 Jul 89 16:04:00 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 33 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 74, message 1 of 18 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@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@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