Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Makefile Utilities

A collection of Makefile helpers to streamline command-line tooling for your projects.
This repository provides ready-to-use utilities for handling arguments, logging, and usage documentation in a clean and consistent way.


✨ Features

  • Self-documented Makefiles
    Use inline comments to automatically generate a clean make help output:

    • ## before a target → describes that target
    • ### before a section name → creates a section in the help output
  • Argument handling

    • Access positional arguments: $(call GET_ARG,1)
    • Access named variables: $(my_var)
    • Join arguments with custom separators:
      $(call JOIN_ARGS,|,$(ARGS))
  • Validation helpers

    • Require a minimum number of arguments with usage message:
      $(call REQUIRE_ARGS,2,<name> <age>)
    • Require a named variable:
      $(call REQUIRE_VAR,my_var)
  • Logging with colors
    Standardized logging functions for info, success, warning, and error messages:

      $(call log,One log for fun)
      $(call log_info,Starting process...)
      $(call log_warn,Something looks odd...)
      $(call log_error,Something went wrong!!)
      $(call log_success,All done!)

🚀 Usage

1. Include utilities in your Makefile

include ./MakefileUtils.mk

2. Document your targets

## Say hello to someone
hello:
	$(call REQUIRE_ARGS, 1,<name>);
	@name=$(call GET_ARG,1); \
	printf "Hello %s\n" "$$name"

3. Run with arguments

make hello John

📋 Examples

See Makefile for multiple usage examples


📖 Help Output

With make help, you automatically get a neat summary:

Usage:
  make <target>

Available targets:
  greet        Say hello to someone
  build        Build the project
  test         Run all tests

🛠 Requirements

  • GNU Make

🤝 Contributing

Contributions are welcome!
Feel free to open issues or pull requests to improve the utilities.


About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages