0.0.2 • Published 7 years ago
makefile-help v0.0.2
makefile-help
An easy way to add an auto-generated make help
target to your Node.js project's Makefile
.
This makes make
command discovery nicer, while still using the same make
tool that's available in pretty much every dev environment. If you're looking for something a bit more powerful, but at the expense of installing something new, check out tj/mmake
!
Example
For a makefile like...
ifneq ($(wildcard ./node_modules),)
include ./node_modules/makefile-help/Makefile
endif
# Run commands with the node debugger. (default: false)
DEBUG ?= false
ifeq ($(DEBUG),false)
node = node
else
node = node debug
endif
# Remove all of the derived files.
clean:
@ rm -rf ./node_modules ./lib
# Compile the source with babel.
lib:
@ ./node_modules/.bin/babel-cli --out-dir ./lib ./src
# Start the development server.
start:
@ $(node) ./server/index.js
Running make help
will print out...
$ make help
Usage:
make <target> [flags...]
Targets:
clean Remove all of the derived files.
help Show this help prompt.
lib Compile the source with babel.
start Start the development server.
Flags:
DEBUG Run commands with the node debugger. (default: false)
Installation
yarn add makefile-help
npm install --save makefile-help
Usage
To use it, include
this module's Makefile
in your own...
ifneq ($(wildcard ./node_modules),)
include ./node_modules/makefile-help/Makefile
endif
And then run...
$ make help
The help command will auto-populate from targets that look like:
# This comment will show up for the target in the help.
target:
And also for flag definitions like:
# This comment will show up for the flag in the help.
FLAG ?=