makefilenaming-conventionsgnu-make

Is there a naming convention for makefile targets and variables


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


Solution

  • 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 that are not special to make, and that are not 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