Skip to content
/ RMCH1 Public

My best-practice example of a flat (non-recursive) GNU makefile structure.

License

Notifications You must be signed in to change notification settings

boyski/RMCH1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This sample build structure demonstrates one method of doing a flat
(non-recursive) build using GNU make and gcc. One of the main
design goals is that each involved directory must contain a file
called "Makefile" (in this case actually "GNUmakefile" since we
rely on GNU Make features), such that it feels like a traditional
recursive structure.  The idea is that a user should be able to
simply type "make" in any directory and get a good build. In fact
all of the makefiles include each other to form a single logical
makefile which has the same behavior regardless of the point of
entry.

Another feature, not particularly unique, is that all actual build
logic is contained in files (*.mk) at the root of the tree which do
not clutter the developer's view of the world. User-visible
makefiles (the ones actually called "GNUmakefile") are boilerplate
and tend to contain only lists of desired targets.

This model demonstrates dependency generation for C and C++ code.
It also implements a system adapted from the Linux kernel which
invalidates object files and triggers a rebuild when compiler flags
change.

Usage respects conventionals: "make" or "make all" to build
everything, "make clean" to remove build targets, "make help" to
see this message.

Note: although this implementation is GPL, it exists primarily to
illustrate ideas which are not themselves licensed or licensable.
It should be trivial to transfer the ideas without GPL
contamination, which is explicitly the intended use.

TODO:

- Port to Windows (still using GNU make though). This basically
  means abstracting assumptions about extensions, compilers, etc.
  and probably skipping dependency generation unless using MinGW.

About

My best-practice example of a flat (non-recursive) GNU makefile structure.

Resources

License

Stars

Watchers

Forks

Packages

No packages published