Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

When make trumps Perl (was: the disadvantages of mini-languages)

by Aristotle (Chancellor)
on Feb 19, 2005 at 01:39 UTC ( #432602=note: print w/replies, xml ) Need Help??

in reply to Re^7: the disadvantages of mini-languages
in thread the disadvantages of mini-languages

Any long chain of transformations depending on each other is a good candidate. F.ex I have been meaning to write a makefile for web galleries, ie a task where you take a large bunch of pictures and generate thumbnails and a batch of index pages — but only when a thumbnail doesn't already exist or only when there's new pictures to add to an index page, so that you can toss a few more pictures into the heap and regenerate the gallery without waiting an eternity for everything to be regenerated. Doing all the necessary checks in Perl to achieve that kind of statefulness is easy, but the code turns out messy. For make, this job is just natural.

A simply example would be my corefonts makefile. It was originally a nasty shell script. The makefile looks like a mouthful, but most of it amounts to “constants,” and the real code is just a few lines at the bottom and all the rest happens automagically and it won't redownlad or reextract files you already have.

Note that all of this works better the more self-contained the parts of your toolchain are. The recipe for each rule shouldn't be more than 2 or 3 lines for the majority of cases and should only rarely need to be more than even one. Then you just tell make how to assemble the machinery and it makes everything happen for you. Get to understand the tool well and it's just amazing.

Makeshifts last the longest.

  • Comment on When make trumps Perl (was: the disadvantages of mini-languages)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://432602]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-05-19 18:48 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (72 votes). Check out past polls.