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

194 lines
5.5 KiB
Plaintext

#
# 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.24 2004-10-04 05:23:56 skidder Exp $
#
#____________________________________________________________________________
IsProdTypeBuild = @PROD_BUILD_FLG@
# If this is defined then we are building a production
# release with debug and optimization
#____________________________________________________________________________
# Please don't use compiler/platform specific flags here - nmcc 02-Nov-2002
CFLAGS:= $(CFLAGS) -I$(SRC_ROOT)/include/gen -I$(SRC_ROOT)/include
ifeq ($(IsProdTypeBuild),Y)
CFLAGS:= $(CFLAGS) $(PROD_FLAGS) -DPROD_BUILD
else
CFLAGS:= $(CFLAGS) $(DEV_FLAGS) -DDEV_BUILD
endif
CXXFLAGS:= $(CXXFLAGS) $(CFLAGS)
CC = @CC@
CXX = @CXX@
LD = @CXX@
#
# LIBTOOL ISSUES
#
# 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.
# LINKER COMMANDS
# they are candidates to go to make.defaults and make this file make.defaults.in
# if we decide to support different linkers directly in our build process.
# Alternatively we may use libtool here.
LIB_LINK= @CC@
STATICLIB_LINK= ar cruvs
EXE_LINK = @CXX@
STATICEXE_LINK = @CXX@
LINK_LIBS = @LIBS@ @EDITLINE_A@
STATICLINK_LIBS = @LIBS@ @EDITLINE_A@
SO_LINK_LIBS = @LIBS@
# 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_ROOT)/jrd/%.cpp:: $(SRC_ROOT)/jrd/%.epp
$(GPRE_CURRENT) $(JRD_GPRE_FLAGS) $< $@
$(SRC_ROOT)/dsql/%.cpp:: $(SRC_ROOT)/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) $<
$(OBJ)/%.o:: $(SRC_ROOT)/%.c
$(CC) $(CXXFLAGS) -c $(firstword $<) -o $@
@$(move-dep)
$(OBJ)/%.o: $(SRC_ROOT)/%.cpp
$(CXX) $(CXXFLAGS) -c $(firstword $<) -o $@
@$(move-dep)
$(TMP_ROOT)/%.o: $(SRC_ROOT)/%.cpp
$(CXX) $(CXXFLAGS) -c $(firstword $<) -o $@
@$(move-dep)
$(OBJ)/%.lo: $(SRC_ROOT)/%.cpp
@$(move-dep)
$(OBJ)/%.o: $(OBJ)/%.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
$(OBJ)/%.d:: $(SRC_ROOT)/%.c
@$(ECHO) "need to rebuild $^"
$(ECHO) $(OBJ)/$(*).o " : FORCE" > $@
$(OBJ)/%.d:: $(SRC_ROOT)/%.epp
@$(ECHO) "need to rebuild $^"
$(ECHO) $(OBJ)/$(*).o " : FORCE" > $@
$(OBJ)/%.d:: $(SRC_ROOT)/%.cpp
@$(ECHO) "need to rebuild $^"
$(ECHO) $(OBJ)/$(*).o " : FORCE" > $@
# Rules for making resource files
$(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc
windres --output-format=coff --include-dir=$(<D) $< $@
# 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