8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 17:23:03 +01:00
firebird-mirror/doc
2002-08-09 07:25:49 +00:00
..
sql.extensions Update the description, it is now correct. 2002-08-09 07:25:49 +00:00
README.makefiles Added README file which explains a little about the makefile structure. 2002-06-19 15:10:09 +00:00

PURPOSE :  To explain the makefile system in firebird2.

STATUS:  Still a work in progress (both the makefiles, and this document)

AUTHORS: Mark O'Donohue mark.odonohue@luduwg.edu.au

COPYRIGHT: All rights retained by authors.
           For distribution with Firebird source
           (Someone who knows this legal stuff will update it later)

OVERVIEW

The new makefiles were created to fit in with autoconf, to place the object
files in seperate directories to the source files and to simplify the build
process.

It really does rely on using gnu make so that is the best version to use.


THE REALLY QUICK INTRO

For linux this is how I do a compile (classic is only one currently)

./configure 
$cd src
$make > make.log 2>&1 ; cat make.log | grep -v warning > make2.log ; vi make2.log

For an install checkout 

$make install

it will list your options - but also needs some work.


MAKEFILE

Makefiles are found in src/make.new 

make.rules
make.defaults
make.shared.variables

prefix.xxx (where xxx = platform)

In src/make.new there are a number of Makefile.in.xxx files and some make.xxx 


STRUCTURE OF MAKEFILE.IN.XXX


Each Makefile.in.xxx has the following somewhere near the top:

include make.rules
include make.defaults
include make.platform
include make.shared.variables

...
...


These are:

make.rules 

This contains the default rules for compiling the system components.  Such as
directory macros CXX etc.  


make.defaults

This contains default values for macros that it is likely that the user may
want to override.


make.platform

This file is created from the prefix.xxx where xxx=linux/darwin/freebsd etc.  
It provides a spot for the user to override or repalce macros that have been
defined in make.rules and make.defaults.  In addition extra dependancies can
be added to build extra targets.


make.shared.variables

This file contains the defintion of macros that are shared across all of the 
modules.  The only set that are needed are those files that are contained in
the libgds.a/so library since files from many modules contribute to the library.



CREATING OBJECT FILES

 
In the makefiles the object files are of two sorts .o static and .lo 
which are suitable for shared libraries.  On most systems the source 
files need to be compiled twice to create both .o and .lo files.  F
Fortunately the program libtool can help work with this.

The general format of .o file dependancies is:

SERVER_Sources = server.cpp
SERVER_Objects = $(SERVER_Sources:%.cpp=$(OBJ)/%.o)


So the .o files live in $(OBJ) where:
OBJ = $(ROOT)/gen/$ModuleName 


Each Makefile also specifies an AllObjects and Dependancies macro which 
identified all the objects that this Makefile is to create and the name
of the dependency files generated for those objects.

AllObjects = $(Alice_Objects) 


FILE DEPENDANCIES

Include file dependancy information is automatically generated by the gcc
compiler.

The gcc compiler has a flag -MMD which will generate in addition to the
.o file a .d file which contains the dependancy chain of #includes required
for the program.  These are then edited and stored in the $(OBJ) directory and
are included in the bottom line of the makefile with

Dependencies = $(All_Objects:.o=.d) 

include $(Dependancies)