Perfect makefile

I would like to use make to get a modular assembly combined with continuous integration , automated unit testing, and multi-platform assemblies. Similar settings are common in Java and .NET, but it's hard for me to put this together for make and C / C ++. How can this be achieved?

My requirements:

  • quick assembly; non-recursive make (stack overflow question what is your experience with non-recursive make? )
  • modular system (i.e. minimal dependencies, makefile in a subdirectory with components)
  • multi-platform (usually PC for unit testing, built-in target for system integration / release)
  • full dependency check
  • ability to perform (automatic) unit tests (Agile engineering)
  • integration with a continuous integration system
  • easy to use

I started with non-rec make . I still find this a great place to start.

Limitations so far:

  • lack of unit test integration
  • Windows-based ARM compilers incompatible with Cygwin paths
  • incompatibility of the make file with Windows \ paths
  • direct dependencies

My structure looks like this:

    project_root
       /algorithm
                 /src
                     /algo1.c
                     /algo2.c
                 /unit_test
                     /algo1_test.c
                     /algo2_test.c
                 /out
                     algo1_test.exe
                     algo1_test.xml
                     algo2_test.exe
                     algo2_test.xml
             headers.h
       /embunit
       /harnass
   makefile
   Rules.top

I want everything to be simple; here the unit tests (algo1_test.exe) depend both on the "algorithm" component (ok) and on the unit test structure (which may or may not be known at the time of its creation). However, moving assembly rules to the top code does not appeal to me, as this will spread local knowledge of components throughout the system.

Cygwin: . /cygdrive/c ( /), C: ( ). ?

+5
2

CMake CTest CDash, , . .

( CMake) post CMake:

... cmake make , make, , make , . , cmake .

. " Make-friend "? , stackoverflow.

- ?

+3

, :

Makefile all . , , foo/*. C foo.so, . Makefile, .

make, , ( ), , gcc (cc). , MSC ; , ( ) Windows MinGW MSys; . , Posix .

-MD. *.d Makefile. .

, "" check. , , unit test , . , ( ) . , .

, : https://github.com/rioki/c9y/blob/master/Makefile install, uninstall dist.

, , , . automake autoconf, ; , foojam barmake -, .

0

All Articles