# # 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 # # Contributor(s): # # # $Id: make.rules,v 1.20 2003-08-22 10:29:35 aafemt 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 #____________________________________________________________________________ # 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) $(SUPER_FLAG) -DPROD_BUILD else CFLAGS:= $(CFLAGS) $(DEV_FLAGS) $(SUPER_FLAG) -DDEV_BUILD endif CXXFLAGS:= $(CXXFLAGS) $(CFLAGS) #CC = libtool @CC@ #CXX = libtool @CXX@ CC = @CC@ CXX = @CXX@ LD = @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 LIB_LINK_OPTIONS += -version-info 0:0:0 -release 1.5.0.0 $(LIB_LINK_RPATH)$(FirebirdInstallPrefix)/lib EXE_LINK = libtool @CC@ STATICEXE_LINK = libtool @CC@ -all-static else LIB_LINK= @CC@ STATICLIB_LINK= ar cruvs # LIB_LINK_OPTIONS = -soname libgds.$(SHRLIB_EXT) -rpath /usr/lib # LIB_LINK_OPTIONS = -soname libgds.$(SHRLIB_EXT).2 -rpath /usr/lib # LIB_LINK_OPTIONS := $(LIB_LINK_RPATH)$(FirebirdInstallPrefix)/lib # 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@ @EDITLINE_A@ STATICLINK_LIBS = @LIBS@ @EDITLINE_A@ SO_LINK_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 # 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) $< #.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_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)/% #.epp.cpp: # $(GPRE_STATIC) $(GPRE_FLAGS) $< $(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" > $@ # $(TOUCH) $^ $(OBJ)/%.d:: $(SRC_ROOT)/%.epp @$(ECHO) "need to rebuild $^" $(ECHO) $(OBJ)/$(*).o " : FORCE" > $@ # $(TOUCH) $^ $(OBJ)/%.d:: $(SRC_ROOT)/%.cpp @$(ECHO) "need to rebuild $^" $(ECHO) $(OBJ)/$(*).o " : FORCE" > $@ # $(TOUCH) $^ # Rules for making resource files $(GEN_ROOT)/%.res: $(SRC_ROOT)/%.rc windres --output-format=coff --include-dir=$( tmp.d; \ $(MV) tmp.d $(OBJ)/$(*F).d; \ $(RM) $(*F).d; \ $(TOUCH) $@; \ fi endef