Skip to content

Core functions for makefiles (module management, help)

License

Notifications You must be signed in to change notification settings

Captive-Studio/makefile-core

Repository files navigation

Makefile core module

License

Core functions for makefiles (module management, help)

Getting Started

Makefile technology has some drawbacks but it is reliable, language agnostic and available by default on most platform. This project aims to standardize most common functionalities. Simply copy and include core.mk in your project and start building your project !

Features

  • 📦 Simple dependency manager (using git submodule)
    • ✓ No extra dependency
    • ✓ Lightweight implementation
    • ✓ Compatible dependency maintainer bot (Renovate)
  • ℹ️ Automatic help generator, based on comments
  • ⚒️ Everything is customizable using Makefile.local

Usage

Installer (Recommended)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Captive-Studio/makefile-core/main/install.sh)"

Manual (Alternate)

1. Copy core.mk to your project

my-project/
├─ .modules/
│  ├─ core.mk <- COPY https://raw.githubusercontent.com/Captive-Studio/makefile-core/main/core.mk
├─ Makefile

2. Include .modules/core.mk in your Makefile

# At the start of Makefile

include .modules/core.mk

3. Test that everything is working

> make help

Documentation

make help

Display all available targets and flags

To document a target, add a comment starting with ##

## Do something
my_target:

Will display

> make help

...
Targets :
...
    my_target       Do something
...

make self-add

Add a makefile module (as git submodule). If a ./module.mk is found it will be automatically included.

Example :

> make self-add url=https://github.com/ianstormtaylor/makefile-assert
# It will add /.modules/makefile-assert git submodule

make self-update

Update all makefile modules

Example :

> make self-update

make print-variables

Print every declared variables (often for debugging)

Example :

> make print-variables

make print-%

Print a given variable

Example :

> make print-VAR
# This will display the value of $(VAR)

Makefile.local

Override any behavior by creating Makefile.local

my-project/
├─ .modules/
│  ├─ ...
├─ Makefile
├─ Makefile.local <- Will override

Contributing

TODO

Acknowledgement

These repository were inspirations to build makefile-core :

License

MIT © Captive Studio

About

Core functions for makefiles (module management, help)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •