8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00
firebird-mirror/builds/posix/make.rules

296 lines
7.9 KiB
Plaintext
Raw Normal View History

#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
# Alternatively, the contents of this file may be used under the
# terms of the GNU General Public License Version 2 or later (the
# "GPL"), in which case the provisions of the GPL are applicable
# instead of those above. You may obtain a copy of the Licence at
# http://www.gnu.org/copyleft/gpl.html
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Relevant for more details.
#
# This file was created by members of the firebird development team.
# All individual contributions remain the Copyright (C) of those
# individuals. Contributors to this file are either listed here or
# can be obtained from a CVS history command.
#
# All rights reserved.
#
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
#
# Contributor(s):
#
#
# $Id: make.rules,v 1.4 2002-09-10 06:08:56 eku Exp $
#
#____________________________________________________________________________
# Currently I set these manually but they should be set automatically
# from the ./configure installation time
UseSharedLibraries = Yes # If empty then we build static linked exe's
# which are useful for debugging.
# This variable is used to determined flags for
# libtool/ar/ld we define the gds.a/so library name
# in LIBGDS_LA and in Makefile.in.jrd where we do the
# creation of the libgds.a/so library.
#UseLibToolForLink = Yes # Currently we do not use it - but may in the future
IsProdTypeBuild = @PROD_BUILD_FLG@
# If this is defined then we are building a production
# release with debug and optimization
#____________________________________________________________________________
GEN_ROOT=$(ROOT)/gen
SRC_ROOT=$(ROOT)/src
LIB=$(GEN_ROOT)/firebird/lib
BIN=$(GEN_ROOT)/firebird/bin
MAKE_ROOT=$(GEN_ROOT)
# This picks up the current directory and maps it to the equivalent module
# in the src and gen area.
RealSrcRootPath = $(shell cd $(SRC_ROOT); pwd)
#ModuleName:=$(notdir $(CURDIR))
ModuleName:=$(subst $(RealSrcRootPath)/,,$(CURDIR))
SRC=$(SRC_ROOT)
#SRC=$(SRC_ROOT)/$(ModuleName)
OBJ=$(GEN_ROOT)/$(ObjModuleName)
DEP=$(OBJ)
GEN_SRC=$(OBJ)
# This one is not so widely used at the momement.
# but I would like it to become so.
FIREBIRD=$(GEN_ROOT)/firebird
INTERBASE=$(FIREBIRD)
export INTERBASE
export FIREBIRD
# I would like to remove this one.
SOURCE=$(ROOT)/src
CFLAGS:= $(CFLAGS) -g -pipe -MMD -p -fPIC -Wall -I$(ROOT)/src -I$(ROOT)/src/include
CXXFLAGS:= $(CXXFLAGS) $(CFLAGS)
#CC = libtool @CC@
#CXX = libtool @CXX@
CC = @CC@
CXX = @CXX@
# Most of the libraries and programs are linked using the dynamic linker
# We default to using the dynamic linker and have a special link macros for
# using the static linker.
#
# Also libtool looks like the future in cross platform shared object compile
# and linking, but unfortunately it does not yet work for us, as a
# libtool gcc -o $(BIN)/fred fred.o libzzz.la
# command will generate incorrect relative addresses in the wrapper script in
# $(BIN)/fred as it required the exe file fred to be in the directory from
# which the command is run from.
# One other issue is that libtool puts a -DPIC onto the compile line. While
# nice it conflicts with a struct in the file qli/format.h
# MOD 26-July-2001.
ifdef UseLibToolForLink
LIB_LINK= libtool @CC@
STATICLIB_LINK = libtool @CC@ -all-static
LIB_LINK_OPTIONS = -version-info 0:0:0 -release 1.5.0.0 -rpath /usr/lib
EXE_LINK = libtool @CC@
STATICEXE_LINK = libtool @CC@ -all-static
else
LIB_LINK= g++ -shared
STATICLIB_LINK= ar cruvs
# LIB_LINK_OPTIONS = -soname libgds.so -rpath /usr/lib
# LIB_LINK_OPTIONS = -soname libgds.so.2 -rpath /usr/lib
LIB_LINK_OPTIONS =
# EXE_LINK = g++
# STATICEXE_LINK = g++
EXE_LINK = @CXX@
STATICEXE_LINK = @CXX@
endif
LINK_OPTIONS=
# ReadlineLibs - choose one of the following depending upon your
# OS and distribution. SuSE is happy with just -lreadline
# This is something that we should pick up with autoconf.
# This should be all automatically set from autoconf stript now
# And should be removed if noone has trouble a few months after
# I added this comment - MOD 11-July-2002
#ReadlineLibs = -lreadline -ltermcap
#ReadlineLibs = -lreadline -lncurses
#ReadlineLibs:= -lreadline
#LINK_LIBS:= -lm -lstdc++ $(ReadlineLibs) @LIBS@ -lc -ldl -lcrypt
#STATICLINK_LIBS := -lm -lstdc++ $(ReadlineLibs) -lc -ldl -lcrypt
LINK_LIBS = @LIBS@
STATICLINK_LIBS = @LIBS@
#LINK_LIBS= -L$(LIB) -lgds -lm -lc -ldl -lcrypt
# -lgcc
# These should no longer be required but I've left here
# in case someone needs to know what they were
#STATICLIBTOOL= libtool gcc -static
#STATIC_LINK_OPTIONS= -static
#STATIC_LINK_LIBS= -lm -lc -mieee-fp -ldl -lcrypt
#SHLIB_LINK_OPTIONS = -shared
ifeq ($(IsProdTypeBuild),Y)
CXXFLAGS:= -O3 -DPROD_BUILD $(CXXFLAGS)
else
CXXFLAGS:= -ggdb -DDEV_BUILD $(CXXFLAGS)
endif
# Here we have definitions for using the preprocessor.
# The GPRE_FLAGS is overwritten in Makefile.in.jrd Makefile.in.gpre and
# since they do something extra to allow the boot build to work.
#
# One other point is that sometimes a failure in compile with gpre does not
# result in an error being generated. The generated source file still
# compiles and throws the make off the path.
#
# This bit of code is part of unfinished bit to let make determine if
# gpre gpre_static or gpre_boot should be used based on which ones exist.
#
# testgpre = $(shell if [ -f $(GPRE) ]; then; echo $(GPRE); else; echo ""; fi)
#test1:
# echo $(testgpre)
GPRE_FLAGS= -r -m -z -n
JRD_GPRE_FLAGS = -n -z -gds_cxx -raw -ids
DSQL_GPRE_FLAGS = -lang_internal -r -m -z -n
.SUFFIXES: .c .e .epp .cpp
.e.c:
$(GPRE_CURRENT) $(GPRE_FLAGS) $< $@
.epp.cpp:
$(GPRE_CURRENT) $(GPRE_FLAGS) $< $@
$(SRC)/jrd/%.cpp:: $(SRC)/jrd/%.epp
$(GPRE_CURRENT) $(JRD_GPRE_FLAGS) $< $@
$(SRC)/dsql/%.cpp:: $(SRC)/dsql/%.epp
$(GPRE_CURRENT) $(DSQL_GPRE_FLAGS) $< $@
.SUFFIXES: .lo .o .cpp .c
.c.o:
$(CC) -c $(CFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) $<
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) $<
#.c.lo:
# $(CC) -c $(PIC_FLAGS) $(CFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) -o $*.lo $<
#
#.cpp.lo:
# $(CXX) -c $(PIC_FLAGS) $(CXXFLAGS) $(CXX_INCLUDE_DIRS) $(VERSION_FLAG) -o $*.lo $<
#
$(OBJ)/%.o:: $(SRC)/%.c
$(CC) $(CXXFLAGS) -c $(firstword $<) -o $@
@$(move-dep)
$(OBJ)/%.o: $(SRC)/%.cpp
$(CXX) $(CXXFLAGS) -c $(firstword $<) -o $@
@$(move-dep)
$(OBJ)/%.lo: $(SRC)/%.cpp
@$(move-dep)
#$(OBJ)/%
#.epp.cpp:
# $(GPRE_STATIC) $(GPRE_FLAGS) $<
$(OBJ)/%.o: $(DEP)/%.d
.SUFFIXES: .epp .e
# Just write out a line making the .cpp file dependant on the .d file
# since the .d file was just created then it will force a compile of the
# .cpp files
$(DEP)/%.d:: $(SRC)/%.c
@echo "need to rebuild $^"
echo $(OBJ)/$(*).o " : FORCE" > $@
# touch $^
$(DEP)/%.d:: $(SRC)/%.epp
@echo "need to rebuild $^"
echo $(OBJ)/$(*).o " : FORCE" > $@
# touch $^
$(DEP)/%.d:: $(SRC)/%.cpp
@echo "need to rebuild $^"
echo $(OBJ)/$(*).o " : FORCE" > $@
# touch $^
# code to move the dependancy files from the current directory
# (a # is used to delimit the sed substitute command since a "/"
# gets in trouble with directory path names)
define move-dep
if [ -f $(*F).d ]; \
then \
sed -e '1 s#$(@F)#$(OBJ)\/$(@F)#' $(*F).d > tmp.d; \
mv tmp.d $(OBJ)/$(*F).d; \
rm $(*F).d; \
touch $@; \
fi
endef