Makefile question
Len Reed
lbr at holos0.uucp
Fri Apr 12 23:19:15 AEST 1991
In article <21915 at shlump.nac.dec.com> evans at decvax.DEC.COM writes:
>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.
I'd also use dmake or Gnu-make (both free, available at the usual ftp
sources) to get some more power in my make. Both have rules to simplify
the syntatic messiness of making libraries. More important, both have
make-time if-then-else structures that are real useful when you have a
makefile that must work on different systems.
--
Len Reed
Holos Software, Inc.
Voice: (404) 496-1358
UUCP: ...!gatech!holos0!lbr
More information about the Comp.lang.c
mailing list