generating code to run multiple targets/configurations from single

Steve Summit scs at adam.pika.mit.edu
Sun Apr 9 12:35:48 AEST 1989


In article <18927 at adm.BRL.MIL> Leisner.Henr at xerox.com (Marty) writes:
>I need (for a long time) a better way to produce multiple configurations on
>multiple targets from a single set of sources.
>...I guess
>I'm going to put the different objects/outputs in different subdirectories
>(so make won't get confused), but I'll still preprocess the makefiles.  

One thing I've found which helps is if your C compiler(s) pay
attention to the -o flag even in the presence of -c.  (4.3bsd may
have introduced this.)  Then you can you can use a different
suffix (not just .o) for each kind of object file, and keep them
all in the same directory with one copy of the source.  I've used
.ovax for vax, .o11 for pdp11, .po for profiled, etc.  The
Makefile contains new default rules like

	.SUFFIXES: .po

	.c.po:
		$(CC) $(CFLAGS) -p -c -o $@ $*.c

Someday I'll post my retargetable C compiler driver which allows
the use of -o in this way, and allows easy selection of compiler
back-ends to make cross-compilation easy.

                                            Steve Summit
                                            scs at adam.pika.mit.edu



More information about the Comp.unix.wizards mailing list