make SUFFIXES question.....
Christopher R Volpe
volpe at underdog.crd.ge.com
Wed Aug 15 08:12:45 AEST 1990
In article <1446 at targon.UUCP>, andre at targon.UUCP (andre) writes:
|>In article <8212 at ncar.ucar.edu> morreale at bierstadt.scd.ucar.edu (Peter
Morreale) writes:
|> >Consider the following makefile:
|> >
|> >.pp.o:
|> > cp $*.pp $*.f
|> >
|> >.SUFFIXES: $(SUFFIXES) .pp
|> >FILES= f1.o
|> >
|> >compile: $(FILES)
|> > @echo "Why isn't .f.o applied?"
|> >
|> >clean:
|> > -rm -f $(FILES) *.f
|>
|> >You'll notice that the ".pp.o" rule is executed, and then the
|> >compile rule. The question is: Why isn't the default ".f.o" rule
|> >executed before the "compile" target? (If you type make again, the
|> >".f.o" rule is executed and all is well....)
|>
|>This is because you told make how to make a .o file from a .pp file.
|>after the commands involved are executed, make goes on because it just
|>did what you told it to do to get an object out of an .pp file.
|>But! you created an .f file and no .o file. this means that you should
|>tell make that you make a .f file or make the .o file:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
not good enough!!!
|>
|>.pp.o:
|> cp $< $*.f
|> $(FCOMP) -o $*.o $*.f
|> ^-- whatever you need to go from .f to .o (fortran?)
|>OR
|>
|>.pp.f:
|> cp $< $*.f
|>
|>In the second case make should add up both the .pp.f and .f.o rules
|>to make your .o out of .pp.
No, it won't. At least not on a Sun. From the Make User's Guide:
There is no transitive closure for suffix rules. If you had
a suffix rule for building, say, a .Y file from a .X file, and
another for building a .Z file from a .Y file, make would not
combine the rules to build a .Z file from a .X file. You must
specify the intermediate steps as targets, although their entries
may have null rules:
trans.Z:
trans.Y:
If all you have is a .pp.f rule and a .f.o rule, and you say "make f1.o",
one of the following must be true:
a) there exists a f1.f file, or
b) f1.f is EXPLICITLY listed as a target *AND* file f1.pp exists
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com
More information about the Comp.unix.questions
mailing list