Makefile question

Marc Evans evans at decvax.DEC.COM
Tue Apr 9 22:01:34 AEST 1991


In article <1991Apr9.050652.10199 at athena.mit.edu>, ibekhaus at athena.mit.edu (Ira B. Ekhaus) writes:
|> hello,
|> 	I currently have my directory mounted to two machines with  different
|> cpu's, ie DEC and Sun.
|> What is  the easiest way to set up my makefiles, to use the current CPU to 
|> decide whether an object file should be updated.  It would be great if 
|> libraries could be set up for both types of cpu's, and only updated if the
|> source code was newer, but a separate object file would be susceptible to 
|> updating whenever a make command on a different CPU type than the object file.

I would consider using something like:

	LIB  = libfoo.a

	invoke :
		exec $(MAKE) $(MAKEFLAGS) ARCH=${ARCH-`machine`} $(LIB)
	$(LIB) : $(ARCH)/$(LIB)
	$(ARCH)/$(LIB)(foo1.o) :: foo1.c
	$(ARCH)/$(LIB)(foo2.o) :: foo2.c
	$(ARCH)/$(LIB)(foo3.o) :: foo3.c

By doing this you eliminate the .o files all together, and instead just reference
the contents of each archive. The default rules should *do the right thing*, but
for efficiency you may want to change the .c.o and .c.a rules.

- Marc
-- 
===========================================================================
Marc Evans - WB1GRH - evans at decvax.DEC.COM  | Synergytics     (603)635-8876
      Unix and X Software Consultant        | 21 Hinds Ln, Pelham, NH 03076
===========================================================================



More information about the Comp.lang.c mailing list