diff --git a/quad/doc/Makefiles.md b/quad/doc/Makefiles.md index ef86e3297bdcbd91009ee4f18bb905c7bec00a26..8c0a775e0ae8090bb8ed1ecd3fc5d3e05b093897 100644 --- a/quad/doc/Makefiles.md +++ b/quad/doc/Makefiles.md @@ -1,27 +1,39 @@ # How to use the makefiles -## library.mk -This file contains many definitions of make targets -//describe existing targets -// abstract targets/rules for test, default, and clean -// internal targets for internal use, quite abstract +## [library.mk](../library.mk) +This file contains many definitions of make targets for building libraries and building and running their corresponding tests. +A set of variable definitions are at the top of the file. +The `User Targets` are defined for building a library (`default`), building and running tests (`test`), and cleaning the library (`clean`). +The `Internal Targets` are used for building the library and test binary and rely on abstraction. -## executable.mk -//describe targets -// same as library but for executable, has default and clean targets -// similar internal targets +## [executable.mk](../executable.mk) +This file contains definitions of make targets for building executables. +Similar to `library.mk`, this file has a set of variable definitions at the top of the file. +The `User Targets` are defined for building the executable and cleaning. +The `Internal Targets` are used for building the executable and rely on abstraction. -## quad/Makefile -// describe what is here -// targets for compiling libraries, binaries, tests, clean +## [quad/Makefile](../Makefile) +This Makefile contains targets for building libraries and binaries and their associated tests. +In this file, the specific libraries/executables and their locations are listed as opposed to the `.mk` files which have purely abstract definitions. +It also contains a `clean` target for removing compiled libraries and binaries. +A target for generating an image of the control network, called `diagram`, is also present here. -## Low level Makefile -Each library needs its own Makefile. -//Give contents of the makefiles -//containing the library and provide a NAME, TOP which is a relative path to the quad/ directory, REQLIBS which are the libraries needed, and include $(TOP)/library.mk or executable.mk (why?) -//any additional targets wanted +## Library Makefile +Each library needs its own Makefile. This contains a set of definitions for variables so that the abstract targets in `library.mk` can work properly and any additional targets you want to add that are specific to that library. +The following variable definitions that should be included: +- NAME: The name of the library +- TOP: a relative path to the `quad/` directory +- REQLIBS: a list of the libraries necessary to compile this library, in the form of compiler flags, i.e. `-l<name>` + +_Note: The REQLIBS should include the name of this library at a minimum, as any tests associated with it would need its own library to be linked in order to be useful._ + +Additionally, a line like the following should be included: +`include $(TOP)/library.mk` +This allows the library to use the targets in the `library.mk` file to be applied to this directory. + +Any other targets wanted for the library should also be included. ## How to add a library -//how would you add a library? -// add to libs and clean targets in quad/Makefile with the correct directory -// Add a makefile to the folder (as above) -// Update the REQLIBS var for any libraries/executables that need this library to compile +To add a library: +1. Add your library to the libs and clean targets in `quad/Makefile` with a path to the directory containing the library +1. Add a Makefile to the library with the variable definitions in it as described above +1. Update the `REQLIBS` variable for any library or executable that need this new library to compile