CLI Reference

All GoMake flags, environment variables, and exit codes.

Usage

gomake [flags] [target] [target-arguments...]

Flags

FlagDefaultDescription
--listPrint all available targets with their synopsis and exit
--help, -hPrint usage, or print help for a specific target
--versionPrint the gomake version string and exit
--src <dir>$PWDDirectory where GoMake looks for makefile*.go files
--wd <dir>$PWDWorking directory for the compiled makefile binary
--bin <path>Compile the makefile and write the binary to <path> instead of running it
--tmp <dir>See belowOverride the temporary build directory
--timeout <duration>0 (no limit)Target execution timeout (e.g. 30s, 5m)
--completeInstall bash shell completion
--check-configValidate gomake.yaml and list the config key of every target, then exit

Environment variables

VariableDescription
GOMAKE_TMP_DIROverrides the default temporary directory. --tmp takes precedence over this variable.

The default temporary directory is <os-temp>/gomake/ (e.g. /tmp/gomake/ on Linux, %TEMP%\gomake\ on Windows).


Examples

# Run a target
gomake build

# Run a target with arguments
gomake deploy --env production

# Run a namespace target
gomake ci:lint

# List all targets
gomake --list

# Help for a specific target
gomake --help deploy

# Compile a standalone binary
gomake --bin /usr/local/bin/project-make

# Run targets from a different source directory
gomake --src ./build build

# Set a timeout
gomake --timeout 10m test

# Override the working directory
gomake --wd /var/deploy deploy

# Use a custom temp directory
gomake --tmp /fast/tmp build

Flag interactions and constraints

  • --bin is incompatible with --help, --version, --list, --timeout, and specifying a target name.
  • --complete must be the only flag — no other flags or targets are allowed.
  • --tmp must be an absolute path.
  • --src is made absolute relative to the current working directory when a relative path is given.

Exit codes

CodeMeaning
0Success
1General error (config, I/O, or target failure)
125Target exceeded the --timeout deadline
126No target given and no default target is set (ErrPickTarget)
127Unknown target name (ErrUnkTarget)
129Makefile or generated code failed to compile
128+nTerminated by fatal signal n

Binary cache

Compiled binaries are cached under ~/.cache/gomake/bin/. The cache key is a SHA-256 hash of:

  • All makefile*.go file contents (sorted by filename for determinism)
  • The project’s go.sum file
  • The gomake version string
  • The target GOOS and GOARCH

The cache is invalidated automatically when any input changes. Errors reading the cache are silently ignored.


Progress messages

GoMake prints progress messages to stderr only when an operation takes longer than 500 ms:

Analyzing sources...   (while running go list / parsing AST)
Compiling makefile...  (while running go build)

Fast (cached) invocations are completely silent.


Bash completion

Run --complete once to install completion (bash only — it checks $SHELL):

gomake --complete

This writes the completion script to ~/.bash_completion.d/gomake and appends a source line to ~/.bashrc. To activate it in the current shell without reopening the terminal:

source ~/.bashrc

Completion covers built-in targets only, so no compilation is needed to complete them. User-defined targets from a project’s makefile.go are not completed.