Sophie

Sophie

distrib > Mageia > 3 > x86_64 > by-pkgid > 8c273c3e2ddd64f7bf5bf9fe1cfb9ddd > files > 27

firebird-2.5.2.26539-8.mga3.x86_64.rpm

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)

autoconf
./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 builds/posix

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.defaults
include make.platform
include make.rules
include make.shared.variables

...
...


These are:

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.defaults.  In addition extra dependancies can be added to
build extra targets.


make.rules 

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


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)

PLATFORM SUBDIRS OF JRD

Please, forget about jrd/os/* in makefiles! Pretend that all files from
there are placed in jrd/ itself. A little trick in make.rules will find
files for your platform automatically.