Skip to content

Instantly share code, notes, and snippets.

@renoirb
Last active November 27, 2022 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renoirb/d357ba37b3d544234f91c630af97273c to your computer and use it in GitHub Desktop.
Save renoirb/d357ba37b3d544234f91c630af97273c to your computer and use it in GitHub Desktop.
List of publicly available Bash & Makefile black magic I can't get to remember by heart

Worthwhile Makefile links

Very useful pages

Useful StackOverflow comments

Books?

Gists maintained by others

Shards from past Gist and projects

Not really Makefiles but making things

Useful (less obscure) man pages links

  • 4.9 Special Built-in Target Names

    .PHONY The prerequisites of the special target .PHONY are considered to be phony targets. (...)

    .SUFFIXES The prerequisites of the special target .SUFFIXES are the list of suffixes to be used in checking for suffix rules. (...)

    .DEFAULT The recipe specified for .DEFAULT is used for any target for which no rules are found (either explicit rules or implicit rules). See Last Resort. (...)

    .PRECIOUS The targets which .PRECIOUS depends on are given the following special treatment: if make is killed or interrupted during the execution of their recipes, the target is not deleted. See Interrupting or Killing make. Also, if the target is an intermediate file, it will not be deleted after it is no longer needed, as is normally done. (...)

    .INTERMEDIATE The targets which .INTERMEDIATE depends on are treated as intermediate files. (...)

    .SECONDARY The targets which .SECONDARY depends on are treated as intermediate files, except that they are never automatically deleted. (...)

    .SECONDEXPANSION If .SECONDEXPANSION is mentioned as a target anywhere in the makefile, then all prerequisite lists defined after it appears will be expanded a second time after all makefiles have been read in. See Secondary Expansion.

    .DELETE_ON_ERROR If .DELETE_ON_ERROR is mentioned as a target anywhere in the makefile, then make will delete the target of a rule if it has changed and its recipe exits with a nonzero exit status, just as it does when it receives a signal. See Errors in Recipes.

    .IGNORE If you specify prerequisites for .IGNORE, then make will ignore errors in execution of the recipe for those particular files. (...)

    .LOW_RESOLUTION_TIME If you specify prerequisites for .LOW_RESOLUTION_TIME, make assumes that these files are created by commands that generate low resolution time stamps. The recipe for the .LOW_RESOLUTION_TIME target are ignored. (...)

    .LOW_RESOLUTION_TIME: dst
    dst: src
            cp -p src dst

    (...)

    .SILENT If you specify prerequisites for .SILENT, then make will not print the recipe used to remake those particular files before executing them. (...)

    .EXPORT_ALL_VARIABLES Simply by being mentioned as a target, this tells make to export all variables to child processes by default. (...)

    .NOTPARALLEL If .NOTPARALLEL is mentioned as a target, then this invocation of make will be run serially, even if the ‘-j’ option is given. Any recursively invoked make command will still run recipes in parallel (unless its makefile also contains this target). (...)

    .ONESHELL If .ONESHELL is mentioned as a target, then when a target is built all lines of the recipe will be given to a single invocation of the shell rather than each line being invoked separately (...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment