Here is a brief overview of how to work with subdirectories. The manual
goes into more detail than we will here.
As you add subdirectories to your project, you need to list them in your Makefile:
#!/usr/bin/make -f package.subdirs = dir1 dir2 include toc2.make all: subdirsThe easiest way is to define them before including toc2.make because this allows the framework to automatically generate some of the underying code. If for some reason they cannot be listed before including the file (e.g., you want to use configuration information to determine whether or not to build a certain dir) you must do one more additional step:
#!/usr/bin/make -f include toc2.make package.subdirs = dir1 dir2 subdirs: subdir-dir1 subdir-dir2 all: subdirsThe package.subdirs variable is used by certain targets, like clean and install, so it must be set in addition to adding the subdir-XXX prerequisites to the subdirs target.
By ordering the prerequisites to the subdirs target, you can precisely control the order in which the subdirectories will be built:
#!/usr/bin/make -f include toc2.make package.subdirs = dir1 dir2 subdirs: subdir-dir1 subdir-dir2 myrule: @echo "hi, world" all: subdir-dir1 myrule subdir-dir2
|toc is developed in conjunction with: s11n.net, SpiderApe, & wanderinghorse.net.||Site design adapted from a design by Sumanasa.com|