Makefile for Compressed files (.o.Z)

Marc Rossner marc at jahangir.UUCP
Fri Apr 12 07:53:09 AEST 1991


In article <1991Apr8.194733.17653 at berlioz.nsc.com>, nelson at 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 at uunet.uu.net



More information about the Comp.unix.questions mailing list