nelson@desktop.uiuc.edu (Taed Nelson) (04/09/91)
I've been trying to create a makefile which automatically uncompresses the appropriate file when it is needed. Let's limit the discussion to just .o files. It seems that one would want to define a rule to take *.o.Z files and make them into *.o files: .o.Z.o: uncompress $< but I think that the multiple '.'s in the rule confuses MAKE. I tried adding .o.Z to the SUFFIXES list, but that doesn't seem to help at all. It seems that this must have been done before -- anyone know how to do it? An example will suffice. Thanks!
willcr@bud.sos.ivy.isc.com (Will Crowder) (04/12/91)
In article <1991Apr8.194733.17653@berlioz.nsc.com>, nelson@desktop.uiuc.edu (Taed Nelson) writes: |> I've been trying to create a makefile which automatically uncompresses |> the appropriate file when it is needed. |> |> It seems that one would want to define a rule to take *.o.Z files and |> make them into *.o files: |> .o.Z.o: |> uncompress $< |> but I think that the multiple '.'s in the rule confuses MAKE. I |> tried adding .o.Z to the SUFFIXES list, but that doesn't seem |> to help at all. For most makes, the multiple '.'s shouldn't have anything to do with it. Most makes don't use the existence of a '.' to determine what a suffix is, they use the longest matching suffix from the .SUFFIXES list. This is a common misconception. What problems are you seeing, and what system is this running under? I tried the following under SunOS 4.1.1: .SUFFIXES: .o.Z .o .c .o.Z.o: uncompress $< .c.o: cc -c $< -o $@ I ran make with the -r switch to keep it from reading in default rules. (More on that later.) If both x.o.Z and x.c existed, the .o.Z.o rule was performed. Same if just the x.o.Z file existed. If only x.c existed, however, the .c.o rule was performed. This seems like reasonable behavior, given the order in which the suffixes were given for the .SUFFIXES special target. Since your make is probably reading in a default makefile (or has built-in defaults), the .o.Z suffix gets appended to the end of the list. This means that if x.c exists, and regardless of whether x.o.Z exists, the .c.o rule will be used to build it. Is that the behavior you're seeing? If so, you'll need to clear the suffixes list (by placing a .SUFFIXES: target by itself in your makefile) and then define the suffixes in the order you want them processed. If your make is indeed getting confused by multiple '.'s in the the .o.Z suffix, get a new one. It's horribly broken (IMHO). |> It seems that this must have been done before -- anyone know how |> to do it? An example will suffice. |> |> Thanks! You're welcome...hope this helps, Will -------------------------------------------------------------------------------- Will Crowder, MTS | "That was setting #1. Anyone want to see (willcr@ivy.isc.com) | setting #2?" INTERACTIVE Systems Corp. | -- Guinan
marc@jahangir.UUCP (Marc Rossner) (04/12/91)
In article <1991Apr8.194733.17653@berlioz.nsc.com>, nelson@desktop.uiuc.edu (Taed Nelson) writes: > > I've been trying to create a makefile which automatically uncompresses > the appropriate file when it is needed. Let's limit the discussion > to just .o files. > > It seems that one would want to define a rule to take *.o.Z files and > make them into *.o files: > .o.Z.o: > uncompress $< I tried this out exactly as you have it -- and lo' and behold -- it works! (Did you try it out?). Here is my Makefile: .SUFFIXES: .o .o.Z .o.Z.o: uncompress $< Now if I have a file called "blah.o.Z" and type "make blah.o" it works like a charm. Seems like a suffix-rule will look for the longest possible suffix at the beginning of the rule. Of course, you will still be left with uncompressed .o files unless you explicitly recompress them after linking them. I.e. you might want all: various real targets compress *.o if you know that all the .o files should be recompressed. Marc Rossner jahangir!marc@uunet.uu.net
XITIJSCH%DDATHD21.BITNET@cunyvm.cuny.edu (04/12/91)
> I've been trying to create a makefile which automatically uncompresses > the appropriate file when it is needed. Let's limit the discussion > to just .o files. > > It seems that one would want to define a rule to take *.o.Z files and > make them into *.o files: > .o.Z.o: > uncompress $< > but I think that the multiple '.'s in the rule confuses MAKE. I > tried adding .o.Z to the SUFFIXES list, but that doesn't seem > to help at all. Ever tried cake? There you can write something like: %.o.Z: %.o uncompress %.o Where % is substituted by your file name (it's an ``unbound part'' of this rule). cake is available at gatekeeper.dec.com in directory pub/case. -- Joachim =========================================================================== Joachim Schrod Email: xitijsch@ddathd21.bitnet Computer Science Department Technical University of Darmstadt, Germany
pha21@seq1.keele.ac.uk (Braham Levy) (04/12/91)
In article <1991Apr8.194733.17653@berlioz.nsc.com>, nelson@desktop.uiuc.edu (Taed Nelson) writes: > > I've been trying to create a makefile which automatically uncompresses > the appropriate file when it is needed. Let's limit the discussion > to just .o files. > ..... > It seems that this must have been done before -- anyone know how > to do it? An example will suffice. > > Thanks! Here's somoething that worked for me <====Cut It Here====> # # Makefile to uncompress things # j braham levy april 1991 (all wrong reserved) # COMPRESS = compress UNCOMPRESS = uncompress obj: $(UNCOMPRESS) `ls *.o.Z` src: $(UNCOMPRESS) `ls *.c.Z` all: obj src <=====End Here======> the rest is plain sailing !! hope this is of use braham email: brahamlevy@uk.ac.keele (or similar) mail-mail : phone +44-782-621111x3943 j braham levy UDSP Lab, Electrical Engineering Group, Dept. of Physics, University of Keele, Keele, Staffs, UK.