Panotoo...le::Rule(3)

πŸ“¦
version 0.29 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

Panotools::Makefile::Rule β€” bestie, this is the little Perl module that assembles Makefile rules for you. That's it. That's the whole job. It's giving tiny but mighty. ✨

It lives in section 3 of the manual (the Perl-library section, iykyk), and yes it's a User Contributed Perl Documentation page, so give the contributors a lil 🫢.


πŸŽ€ SYNOPSIS πŸŽ€

A simple interface for generating Makefile syntax:

Simple interface for generating Makefile syntax

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: you're writing Makefiles directly from perl scripts with print and "\t" and all that jazz. Bestie. That is prone to error. Tabs vs spaces jumpscare every single time, no cap. 😭

So this library swoops in like the main character and gives you a simple perl interface for assembling Makefile rules. Obsessed. πŸ’…


🌸 USAGE 🌸

Make yourself a rule:

my $rule = new Panotools::Makefile::Rule;

..or, if you're feeling extra, specify targets right at creation time:

my $rule = new Panotools::Makefile::Rule ('all');

So here's the tea: a Makefile rule always has one or more 'targets'. These are typically filenames, but they can also be 'phony' non-files. πŸ‘‘

Heads up bestie β€” phony targets should be listed as perequisites of the special .PHONY target. (That's perequisites exactly as written in the original, I'm not fixing it, I don't make the rules, I just relay them fr fr. πŸ’€)

Set those targets up like:

$rule->Targets ('output1.txt', 'output2.txt');

..or equivalently, one at a time, no pressure:

$rule->Targets ('output1.txt');
$rule->Targets ('output2.txt');

Rules can also have zero or more 'prerequisites' β€” and yeah, again these are typically filenames, but they can be 'phony' non-files. Same energy. ✨

$rule->Prerequisites ('input1.txt', 'input2.txt');

..or equivalently:

$rule->Prerequisites ('input1.txt');
$rule->Prerequisites ('input2.txt');

And then rules get zero or more 'commands':

$rule->Command ('cp', 'input1.txt', 'output1.txt');
$rule->Command ('cp', 'input2.txt', 'output2.txt');

Now assemble all of that into a string you can actually write to a Makefile:

my $string = $rule->Assemble;

And that's the whole vibe. Slay. 🌈


Written up by the User Contributed Perl Documentation crew, running on perl v5.42.0, dated 2025-07-25. Mwah, take care of her. πŸ’œπŸ’–βœ¨

πŸ“¦ where this page comes from