Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!crdgw1!underdog!volpe From: volpe@underdog.crd.ge.com (Christopher R Volpe) Newsgroups: comp.unix.questions Subject: Re: make SUFFIXES question..... Message-ID: <11026@crdgw1.crd.ge.com> Date: 14 Aug 90 22:12:45 GMT References: <8212@ncar.ucar.edu> <1446@targon.UUCP> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@underdog.crd.ge.com (Christopher R Volpe) Lines: 60 In article <1446@targon.UUCP>, andre@targon.UUCP (andre) writes: |>In article <8212@ncar.ucar.edu> morreale@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@crd.ge.com