root / JX / trunk / doc / Makefiles.txt

Revision 3, 4.1 kB (checked in by daboo, 2 years ago)

Full commit of JX-2.5.0 code

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