Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a naming convention for makefile targets and variables

I couldn't find anything in the GNU Makefile Conventions.

like image 875
Waqas Ilyas Avatar asked Aug 21 '15 00:08

Waqas Ilyas


1 Answers

This is the implicit naming convention followed by GNU Makefile documentation:

Targets

Target names should use lower case letters. Words are separated with a hyphen - or not separated. E.g.:

test-debug:
    $(build_dir)/debug/bin

or

testdebug:
    $(build_dir)/debug/bin

Variables

Variables which are not special to make or inherited from the environment should be in lowercase. Words should be separated with underscore symbol _. E.g.:

src_dir = $(CURDIR)/src
build_dir = $(CURDIR)/build

References:

Makefile style guide (based on GNU Makefile documentation)

GNU Makefile Standard Targets

  • targets: you can find targets like install, install-strip, installcheck

  • variables: you can read "This includes the directories specified as the values of the variables prefix and exec_prefix" within the install target documentation

like image 153
Florent Roques Avatar answered Sep 28 '22 03:09

Florent Roques