Make and heterogeneous architectures

Dale Mensch intran!dale at uunet.uu.net
Fri Jan 11 01:59:01 AEST 1991


In article <1990Oct7.224553.29464 at rice.edu>, will at 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



More information about the Comp.sys.sun mailing list