Article View: comp.unix.programmer
Article #3754A simple make rule looks hard....
From: Steve Simmons
Date: Fri, 15 Feb 2002 19:04
Date: Fri, 15 Feb 2002 19:04
28 lines
1811 bytes
1811 bytes
I'm trying to write a make rule that uses the suffix of the source in the actions. To give an example, one could write a rule set to install man pages like so: .1.man: cp $< /usr/local/man/man1/$< .2.man: cp $< /usr/local/man/man2/$< .3.man: cp $< /usr/local/man/man3/$< and so on for all the variants. What I'd prefer to do is a single rule which uses the suffix of the source. .1.man .2.man .3.man: cp $< /usr/local/man/man$(S)/$< where $(S) is the suffix 1, 2, 3, etc. Damned if I can find a way to get the suffix as any of gnu makes canned variables. Yes, I realize this contrived example would do the wrong thing if I have both a foo.1 and a foo.3. -- `Have you noticed that, when we were young, we were told that "everybody else is doing it" was a really stupid reason to do something, but now it's the standard reason for picking a particular software package?' -- Barry Gehm
Technical Details
Message-ID:
<3c6d5bc3$0$16579$4c41069e@reader0.ash.ops.us.uu.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!195.64.68.27!newsgate.cistron.nl!news2.euro.net!uunet!ash.uu.net!spool0901.news.uu.net!spool0900.news.uu.net!reader0900.news.uu.net!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109f73,dc69bb7b45b9a336,start X-Google-Attributes: gid109f73,public X-Google-Thread: fc89c,dc69bb7b45b9a336,start X-Google-Attributes: gidfc89c,public X-Google-ArrivalTime: 2002-02-15 11:04:37 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!195.64.68.27!newsgate.cistron.nl!news2.euro.net!uunet!ash.uu.net!spool0901.news.uu.net!spool0900.news.uu.net!reader0900.news.uu.net!not-for-mail Newsgroups: comp.unix.programmer,gnu.utils.help Subject: A simple make rule looks hard.... From: Steve Simmons <scs@di.org> X-Newsreader: NN version 6.5.6 #2 (NOV) Date: 15 Feb 2002 19:04:35 GMT Lines: 28 Message-ID: <3c6d5bc3$0$16579$4c41069e@reader0.ash.ops.us.uu.net> NNTP-Posting-Host: 147.225.19.47 X-Trace: 1013799875 reader0.ash.ops.us.uu.net 16579 147.225.19.47