In order to build the packages via the make files, you must execute the make command with the -f command line option to specify the platform-specific make file. You must also specify a compiler to use via the DC variable. Henceforth, this documentation will refer to the top-level Derelict directory as $(DERELICT).
cd $(DERELICT)
# on Windows
make -fwin32.mak DC=dmd
#on Linux or FreeBSD
make -flinux.mak DC=dmd
#on MacOS X
make -fmac.mak DC=dmd
This will build all Derelict packages into several libraries in the $(DERELICT)/lib directory. It will also create
a hierarchy of .di files in $(DERELICT)/import. When compiling your application, you can easily add these
paths to your build so that your compiler can find the files. The output path for both the libraries and the
.di files is configurable.
The following table shows supported compilers and the values that should be passed as the DC parameter when executing make.
Compiler | DC Value |
---|---|
DMD | dmd |
LDC | ldc |
GDC | >gdmd |
The default name of each compiled library is that of the package (DerelictGL.lib, DerelictOgg.lib, etc..., on Windows, and libDerelictGL.a, libDerelictOgg.a, etc..., on other platforms). However, some Derelict packages bind to multiple shared libraries. For example, DerelictGL includes bindings for both OpenGL and GLU. Issuing the above make commands without specifying any targets results in all bindings in a package being compiled into a single library file. But there are targets to build each binding into separate libraries. Doing so will result in some libraries named differently than the package. They will be named the same as the make target instead.
make -fwin32.mak DerelictGL DerelictGLU DC=dmd
This results in two libraries being generated, DerelictGL.lib and DerelictGLU.lib. You can also build both libraries by using, in this case, the DerelictGL_ALL make target. Each package has a $(PACKAGENAME)_ALL target that will build all libraries implemented by that package. The individual make targets supported for each package can be found in the package-specific documentation.
There are also four cleanup targets.
cleanlibRemoves all compiled libraries from the configured library output path.
cleandiRemoves all generated .di files from the configured .di output path.
cleanA synonym for >cleanlib
cleanallExecutes both the cleanlib and cleandi targets.
Configuring the make-based build system can be done by modifying the files found in $(DERELICT).inc. There, you will find the following files:
dmd_inc.makConfiguration options for the DMD compiler.
ldc_inc.makConfiguration options for the LDC compiler.
linux_inc.makConfiguration options for Linux and FreeBSD.
mac_inc.makConfiguration options for MacOS X.
win32_inc.makConfiguration options for Windows.