| 1 | The top level Makefile will automatically build all libraries placed in |
|---|
| 2 | directories of the form lib.+ and then all programs in subdirectories of the |
|---|
| 3 | programs directory. In order for this to work correctly, certain files and make |
|---|
| 4 | targets are required. |
|---|
| 5 | |
|---|
| 6 | Each library must provide Make.header and Make.files in its top level |
|---|
| 7 | directory. The first target in Make.header must be "default," and must build |
|---|
| 8 | the static and/or shared versions of the library. If J_BUILD_SHARED_LIB is not |
|---|
| 9 | defined, only the static version is built. If J_NEED_SEPARATE_O_FILES is |
|---|
| 10 | defined, only the shared version is built. Otherwise, both versions are built. |
|---|
| 11 | If the install is done as root, "default" should copy the resulting libraries to |
|---|
| 12 | the ${JX_LIB_ROOT}/ directory, and the "jxuninstall" target should remove the |
|---|
| 13 | libraries from this directory. Because "default" is so complicated, it is |
|---|
| 14 | implemented for you in the file include/make/default_lib_target. Refer to |
|---|
| 15 | libjcore/Make.header and libjx/Make.header for examples of how to use this file. |
|---|
| 16 | |
|---|
| 17 | Make.header must also provide the target "Makefiles" to build the Makefiles |
|---|
| 18 | in any subdirectories. (e.g. the Makefile for the test suite) Make.header |
|---|
| 19 | should also define "tidy" and "clean" as double colon targets to clean up any |
|---|
| 20 | subdirectories. (e.g. the test suite) The source distribution should also |
|---|
| 21 | include a symbolic link placed in the include directory that points to the |
|---|
| 22 | library's header files and symbolic links placed in the lib directory that point |
|---|
| 23 | to the static and shared versions of the library in the library's top level |
|---|
| 24 | directory. The JTree library provides an example of how to do all this. |
|---|
| 25 | |
|---|
| 26 | Each library must also provide a *_constants file in include/make/. This |
|---|
| 27 | defines version numbers, shortcuts, and augments J_STRING_FILES to include all |
|---|
| 28 | string database files that are required by the library. All program Make.header |
|---|
| 29 | files include these *_constants files. jtree_constants provides an example of |
|---|
| 30 | how to do this. |
|---|
| 31 | |
|---|
| 32 | Each program must provide Make.header and Make.files in its top level |
|---|
| 33 | directory. In this case, Make.header must provide the target "Makefiles" to |
|---|
| 34 | build the Makefiles in any subdirectories, the target "jxinstall" to build the |
|---|
| 35 | program, strip it, and place it in ${JX_INSTALL_ROOT}/, and the target |
|---|
| 36 | "jxuninstall" to remove the program from this directory. For the user's |
|---|
| 37 | convenience, the first target in Make.header should be "default," and should |
|---|
| 38 | build first the required libraries and then the program. It is also helpful to |
|---|
| 39 | provide a target "static" to build a statically linked version of the binary. |
|---|
| 40 | In order to make it easy for others to build binary distributions for other |
|---|
| 41 | platforms, Make.header should also define the targets "shared" and "link" to |
|---|
| 42 | build the tar files containing the dynamically linked executable and link-kit, |
|---|
| 43 | respectively. If there are any subdirectories with their own Makefiles, |
|---|
| 44 | Make.header should define "tidy" and "clean" as double colon targets to clean up |
|---|
| 45 | these subdirectories. Code Crusader provides an example of how to do all this. |
|---|
| 46 | |
|---|
| 47 | While studying the example Make.header files, you will notice that they |
|---|
| 48 | include the files include/make/jx_constants and include/make/jx_config. |
|---|
| 49 | jx_constants defines system independent constants needed for the various |
|---|
| 50 | required targets, such as J_DISTR_TAR_DIR which is discussed below. It also |
|---|
| 51 | defines the variables ljcore and ljx which expand to the appropriate -l |
|---|
| 52 | arguments for use in the make variable LOADLIBES. jx_constants requires that |
|---|
| 53 | JX_ROOT be defined before it is included. jx_config defines system dependent |
|---|
| 54 | constants. Of particular interest are J_BUILD_SHARED_LIB and |
|---|
| 55 | J_NEED_SEPARATE_O_FILES which should be used in the Make.header for every |
|---|
| 56 | library, as discussed above. |
|---|
| 57 | |
|---|
| 58 | For the user's convenience and to insure that incompatible versions never |
|---|
| 59 | get linked together, all libraries and programs should be packaged from above |
|---|
| 60 | the main JX directory, defined in the variable J_DISTR_TAR_DIR. This way, the |
|---|
| 61 | user can download the source to all the libraries and programs, unpack all the |
|---|
| 62 | tar files in the same directory, and then build them all with a single make |
|---|
| 63 | command. |
|---|