Makefile::AST(3)
β¨ Makefile::AST β¨
okay bestie, so this is the manual page for Makefile::AST(3) β a lil' piece of the User Contributed Perl Documentation universe π β and it's literally all about building an AST (abstract syntax tree, iykyk) for (GNU) makefiles. Buckle up π
πΈ DESCRIPTION πΈ
The whole structure of this (GNU) makefile AST is designed based on GNU make's data base listing output β the stuff you get when you run it with --print-data-base. So yeah, that's the blueprint. π
This AST library ships with the following classes, and honestly? each one is doing its own iconic thing:
Makefile::ASTβ the main character π The primary class for ASTs. It gives you the interface for adding and querying nodes, likeadd_implicit_rule,apply_implicit_rules,add_explicit_rule,apply_explicit_rules,add_var,add_auto_var,get_var, plus a whole pile of other utility functions. We're talking methodeval_var_valuefor computing the ultimate values of makefile variables, and methodsenter_padandleave_padfor local variable's scoping pad. So much utility, so much slay. β¨Makefile::AST::Rule::Baseβ the base class for rule nodes in the AST. It's got properties likenormal_prereqs,order_prereqs,commands, andcolon. The blueprint queen. π§Makefile::AST::Ruleβ this one represents the de-sugared form of simple rules and implicite rules after application. It inherits fromMakefile::AST::Rule::Baseand adds brand new properties:targetandother_targets. Glow-up behavior, fr fr. π¦Makefile::AST::Rule::Implicitβ the implicit rule nodes in the AST. Inherits fromMakefile::AST::Rule::Baseand adds new propertiestargets,match_anything, andis_terminal. Subtle but powerful. πMakefile::AST::StemMatchβ this class encapsulates the file pattern matching (file names containing%) and stem substitution algorithms. It's giving math genius energy. πMakefile::AST::Variableβ represents the makefile variable nodes in the AST, includingname,value,flavor, andorigin. The whole identity package. πMakefile::AST::Commandβ used to encapsulate information regarding makefile rule commands (e.g. command body, command modifiers@,-,+, and etc.) as a whole. All bundled up, cute and tidy. π
π LIMITATIONS AND TODO π
Adding support for other flavors' makes into this AST library should make a huge amount of sense. The most interesting candiate is Microsoft's NMAKE. (yes, it says "candiate" in the original and I refuse to touch it, we respect the source π«Ά)
π CODE REPOSITORY π
For the very latest version of this script, check out the source from
<http://github.com/agentzh/makefile-parser-pm>
There is anonymous access to all. no login, no gatekeeping, just vibes β¨
π«Ά AUTHOR π«Ά
Zhang "agentzh" Yichun <agentzh@gmail.com>
π COPYRIGHT AND LICENSE π
Copyright (c) 2007-2008 by Zhang "agentzh" Yichun (agentzh).
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
β SEE ALSO β
Makefile::AST::EvaluatorMakefile::Parser::GmakeDBmakesimplepgmake-dbMakefile::DOM
ok that's the whole page bestie, every class, every property, every flag, no skips, no cuts π
and for the cute sign-off: this was perl v5.42.0, dated 2025-07-25, and it's the Makefile::AST(3) page β go build something iconic with it, periodt. π
πΈβ¨
π¦ where this page comes from
- fedora 43: perl-Makefile-Parser 0.216-31.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms