Path: utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: intran!dale@uunet.uu.net (Dale Mensch) Newsgroups: comp.sys.sun Subject: Re: Make and heterogeneous architectures Keywords: Miscellaneous Message-ID: <1175@brchh104.bnr.ca> Date: 10 Jan 91 14:59:01 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 60 Approved: Sun-Spots@rice.edu X-Refs: Original: v9n332 X-Sun-Spots-Digest: Volume 10, Issue 14, message 6 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu In article <1990Oct7.224553.29464@rice.edu>, will@genbank.bio.net (Will Nelson) writes: > We have a single large source hierarchy that is NFS-mounted on both SUN3 > and SPARC systems. This business of make clean followed by total rebuilds > is wearing thin fast. Can someone supply me with a sample Makefile that > supports maintaining .o files of different architectures in separate > subdirectories? Sorry for the delay time, but here's our hack: Makefile: # Get architecture type/directory name include ../ilib/make$(TARGET_ARCH)type # it grabs make-sun3type or make-sun4type SRC = xxx.c yyy.c zzz.c aaa.c OBJECTS = $(M_PTH)xxx.o $(M_PTH)yyy.o $(M_PTH)zzz.o $(OBJECTS): $$(@F:.o=.c) $(CC) -c $(@F:.o=.c) -o $@ # multiple-object program $(M_PTH)zzz: $(OBJECTS) $(LOCAL_LIBS) $(CC) $(M_PTH)$@.o $(OBJECTS) $(LIBS) -o $@ # single-object program $(M_PTH)aaa: $$(@F).c $(M_PTH)$$(@F).o $(LOCAL_LIBS) $(CC) $(M_PTH)$(@F).o $(LIBS) -o $@ .DEFAULT: @make -$(MAKEFLAGS) $(M_PTH)$(@F) make-sun4type: # Kill off all automatic suffix rules: they mess up our ./ vs. # ./(ARCH) rules using the ".DEFAULT :" rules .SUFFIXES : COG = -g M_PTH = SPARC/ CCFL = $(COG) -DSUNOS4 Of course, the horrible kludge here is the ".SUFFIXES" line. What happens is that I type % make zzz and all rules fail, there are no suffix rules left, and the DEFAULT rule takes over, attempting to % make SPARC/zzz or % make MC68K/zzz depending on the $(TARGET_ARCH). The fatality of the horrible kludge shows up if I % make www at which point I wind up in a DEFAULTS rule loop trying to % make SPARC/www which keeps looping until (apparently) I run out of memory. It ain't elegant, but I stopped fixing it as soon as it worked... Dale Mensch-Xerox Corp/Intran Operation.-Mpls. MN.- uunet!intran!dale