jelmer / jelmer/makefile-lossless

Add support for GNU Make variable functions

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
13
Forks
5
PR merge metrics
No merged PRs in 30d

Description

## Description
The parser currently preserves but doesn't interpret GNU Make variable functions.

## Missing Features

### String Functions
- `$(strip string)` - Remove leading/trailing whitespace
- `$(findstring find,in)` - Find substring
- `$(filter pattern...,text)` - Keep words matching patterns
- `$(filter-out pattern...,text)` - Remove words matching patterns
- `$(sort list)` - Sort and remove duplicates
- `$(word n,text)` - Extract nth word
- `$(wordlist s,e,text)` - Extract word range
- `$(words text)` - Count words
- `$(firstword names...)` - Get first word
- `$(lastword names...)` - Get last word

### File Name Functions
- `$(dir names...)` - Extract directory part
- `$(notdir names...)` - Remove directory part
- `$(suffix names...)` - Extract file suffixes
- `$(basename names...)` - Remove file suffixes
- `$(addsuffix suffix,names...)` - Add suffix to names
- `$(addprefix prefix,names...)` - Add prefix to names
- `$(join list1,list2)` - Join two lists pairwise
- `$(realpath names...)` - Get canonical absolute path
- `$(abspath names...)` - Get absolute path

### Control Flow Functions
- `$(if condition,then-part[,else-part])` - Conditional expansion
- `$(foreach var,list,text)` - Iterate over list
- `$(call variable,param,...)` - Call user-defined function
- `$(eval text)` - Evaluate as makefile syntax
- `$(value variable)` - Get raw variable value
- `$(origin variable)` - Get variable origin
- `$(flavor variable)` - Get variable flavor

## Current Behavior
These functions are preserved in the output but not interpreted or evaluated.

## Expected Behavior
The parser should recognize these functions and provide APIs for accessing and manipulating them, even if not evaluating them.

## References
- GNU Make Manual: https://www.gnu.org/software/make/manual/make.html#Functions

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or parser entry points are named. Start with the existing handling for preserved but unevaluated variable functions, then consult the GNU Make Manual reference and define the API scope for the listed function groups; done means the functions are recognized and accessible through APIs without requiring evaluation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.