The XWorkplace makefiles are quite smart, but therefore quite complex. This
section is supposed to explain why I chose this approach and what the makefiles
do exactly.
I redesigned the entire XWP sources structure with V0.9.0 and made some
more changes with V0.9.12. The sources were supposed to be structured so that
the following was possible:
- Several developers must be able to cooperatively work on the sources. As
a result, it must be possible for each developer to work on his own directory to
avoid conflicts.
- Still, it should be possible to build the entire thing in one snap.
- Building the entire thing should even take place if a makefile from one of
the subdirectories was called.
- The makefiles should be easily adjustable in case someone wants to use a
different compiler.
- Clean separation of files which reside on the Netlabs CVS server from those
which are created in the build process.
- Since the helpers from the "xwphelpers"
CVS archive
are used, it must be possible to call the makefile in that directory, but still write
the .OBJ files into the XWorkplace
bin\
directory.
- It should be possible to rebuild the executables (
XFLDR.DLL
and
the .EXE
files) and just restart the WPS for the changes to take effect.
- With V0.9.12, I was finally getting tired of always manually updating the
makefile dependencies if
#include
statements were changed in the sources.
So nmake dep
support had to be introduced.
As a result, I came up with the following:
- A single configuration file which sets up all compiler and linker options.
This is
setup.in
in the main directory, which is included from all
makefiles via the nmake
!include
directive.
- System-dependent configuration (directories etc.) is done via another file,
config.in.
- The makefiles create all output files (.OBJ, .DLL, .EXE) in the
bin\
directory, which is created if it doesn't exist.
To rebuild the entire thing, one can simply delete the entire bin\
tree.
- If the main makefile is started, it changes to the subdirectories and calls nmake
again with
MAINMAKERUNNING=YES
defined. This way the sub-makefile knows that
it's started from the main makefile. Otherwise the sub-makefile calls the main makefile
(which in turn calls the sub-makefile) so that the entire thing always gets rebuilt.
- The sub-makefiles compile only. Linking is done by the main makefile. This way
every executable can use shared code, such as the helpers.
nmake dep
is supported through a new makefile in src\
which calls all makefiles in the subdirectories of src\
with either
the "all" or the "dep" target. A "dep" target was then added to all the makefiles
in src\
which invokes fastdep
on all C files to produce
the .depend
file... which is in turn included in the makefiles.
This invokes fastdep.exe
from the XWP Helpers directory, which I stole from
the Odin sources. fastdep was written by Knut Stange Osmundsen and
creates a .depend
file in each source directory
with all the includes which are retrieved directly from the C sources.