Thread View: comp.unix.questions
5 messages
5 total messages
Started by * Tong *
Sat, 29 Sep 2001 23:35
Generic Makefile rules
Author: * Tong *
Date: Sat, 29 Sep 2001 23:35
Date: Sat, 29 Sep 2001 23:35
27 lines
1664 bytes
1664 bytes
Hi, This is from my make file. I'm wondering if there is any way to simplify it, so that I don't have to repeat myself 3 times... - - >8 - - %.htm: %.pm pod2html --infile=$< --outfile=$@ rm pod2html-* %.htm: %.pl pod2html --infile=$< --outfile=$@ rm pod2html-* %.htm: %.pod pod2html --infile=$< --outfile=$@ rm pod2html-* - - >8 - - I want to make a generic Makefile so that .htm file can be generated from either .pm, .pl or .pod file, depending on which file actually exists... -- Tong (remove underscore(s) to reply) *niX Power Tools Project: http://xpt.sourceforge.net/ - All free contribution & collection
Re: Generic Makefile rules
Author: Erik Max Francis
Date: Sun, 30 Sep 2001 00:19
Date: Sun, 30 Sep 2001 00:19
18 lines
1703 bytes
1703 bytes
* Tong * wrote:
> I want to make a generic Makefile so that .htm file can be
> generated from either .pm, .pl or .pod file, depending on which file
> actually exists...
The way you have it set up to do it right now is just fine. You could
delegate that to some kind of script that you run which uses the right
thing, but ultimately the way make works is by turning files with
certain extensions into files with other extensions.
--
Erik Max Francis / max@alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ God will forgive me; that's his business.
\__/ Heinrich Heine
Erik Max Francis' bookmarks / http://www.alcyone.com/max/links/
A highly categorized list of Web links.
Re: Generic Makefile rules
Author: Jonathan Kamens
Date: Sun, 30 Sep 2001 00:33
Date: Sun, 30 Sep 2001 00:33
11 lines
1333 bytes
1333 bytes
define pod2html-rule
pod2html --infile=$< --outfile=$@
rm pod2html-*
endef
%.htm: %.pm
$(pod2html-rule)
%.htm: %.pl
$(pod2hmtl-rule)
%.htm: %.pod
$(pod2html-rule)
Re: Generic Makefile rules
Author: Cal Dunigan
Date: Mon, 01 Oct 2001 21:30
Date: Mon, 01 Oct 2001 21:30
27 lines
2190 bytes
2190 bytes
Erik Max Francis wrote:
> * Tong * wrote:
>>I want to make a generic Makefile so that .htm file can be
>>generated from either .pm, .pl or .pod file, depending on which file
>>actually exists...
>
> The way you have it set up to do it right now is just fine. You could
> delegate that to some kind of script that you run which uses the right
> thing, but ultimately the way make works is by turning files with
> certain extensions into files with other extensions.
Make works by executing rules, usually on the target file, if the
dependent file(s) are newer than the target.
Unix filenames don't have extensions.
--
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Cal Dunigan cdi There is something fundamentally
Consulting Unix wrong with a world in which Ken
Modeling Perl Thompson lives in obscurity and
Training VHDL Bill Gates is a famous billionaire.
//////////////////////////////////////////////////////////////////////
Re: Generic Makefile rules
Author: Erik Max Francis
Date: Mon, 01 Oct 2001 22:58
Date: Mon, 01 Oct 2001 22:58
21 lines
1875 bytes
1875 bytes
Cal Dunigan wrote:
> Make works by executing rules, usually on the target file, if the
> dependent file(s) are newer than the target.
>
> Unix filenames don't have extensions.
Technically correct, but irrelevant and missing the point. Yes, UNIX
proper doesn't know anything about file extensions. Make just turns
files into other files, but what he wants to do is use make to turn
files with certain extensions into files with another extension. The
best way to do this with make is to use rules, just as he did, which
tell how to build a .htm file from a .pl file, and so on.
--
Erik Max Francis / max@alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Honesty has nothing to hide
\__/ Joi
Maths reference / http://www.alcyone.com/max/reference/maths/
A mathematics reference.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads