Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!mips!sgi!shinobu!odin!thestepchild!rhartman From: rhartman@thestepchild.sgi.com (Robert Hartman) Newsgroups: comp.unix.shell Subject: Re: relatively simple make question Message-ID: <1991May16.193301.14805@odin.corp.sgi.com> Date: 16 May 91 19:33:01 GMT References: <621@elroy> Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 45 In article <621@elroy> davidk@dsinet (David Karr) writes: >I have a Make question. This should be simple, but it is giving me pain. > >I have a macro definition called "SRCS". It is a list of C shell source files. > ... For every file in the "SRCS" >list, I want to create a hard link with the ".csh" removed. It would be better to define a suffix rule for this. The following makefile does what you want: SCRIPTS = gork flork all: $(SCRIPTS) .SUFFIXES: .csh .csh: @echo ln $@ $< The standard man page isn't too clear about how you go about defining your own suffix rules (which they refer to as "inference" rules). What you must do to add a new suffix rule is to add the new suffixes to the suffixes list by showing them as dependencies for the .SUFFIXES target. Then you must supply a target definition corresponding to the concatenation of dependency and target suffixes. The rule in this target is applied to dependency files with an indicated suffix to produce a target with another indicated suffix. In this case, ".csh" is the dependency suffix, and the target suffix is null. Thus, the target name for the suffix rule is ".csh." If I wanted to produce a target with the suffix "foo," I'd write a rule like this: SCRIPTS = gorkfoo florkfoo all: $(SCRIPTS) .SUFFIXES: .csh foo .cshfoo: @echo ln $@ $< Order is important in the suffixes list. But you can read the man page to find out how to tweak the order of the suffixes list, now that you've seen the basic idea. -r