Minimal GNU Make build system

There are several articles on how to avoid autostart for small projects and use the power of GNU Make:

I would like to use the wildcard

built-in implicit rules as much as possible .

Are there ready-made scripts for GNU? Can i use?

The functions I need (see second link for description):

  • Provide standard goals
  • Standard environment variables
  • Automatic dependencies on C and C ++ header files
  • Use implicit rules
  • Third party package dependencies: pkg-config

It's nice to have unimportant for me:

  • Fine-grained dependencies
  • Detecting changes in the environment
  • Clean exit
  • Separate build directory
+3


source to share


1 answer


Take a look at my template library called prorab :

https://github.com/igagis/prorab/blob/master/wiki/HomePage.md

It has most of the functionality you need, and it has the function of including independent makefiles that use the same template library.



Features:

  • Provide Standard Targets: Provides targets for compiling .c and .cpp files by linking a binary, shared library, or static library. Also provides goals: all, clean, install, uninstall.
  • Standard environment variables: support for CC, CXX, CFLAGS, CPPFLAGS, CXXFLAGS, LDFLAGS, LDLIBS, PREFIX, DESTDIR.
  • Automatic dependencies on C and C ++ header files: yes. * .d information generated by GCC.
  • Third party package dependencies: pkg-config: just pass `pkg-config --libs yourPackage`

    to LDLIBS for example.

  • Fine-grained dependencies: yes, it all depends on the necessary things.

  • Detecting changes in the environment: Supports dependency on compile / bind flags
  • Clean Output: Yes, you can enable "full" output if required.
  • Separate assembly: Object files are placed in a separate directory that you can override.

Feel free to contact me if you have any questions, or post a question with a question on github.

0


source







All Articles