# This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # You may obtain a copy of the Licence at # http://www.gnu.org/licences/lgpl.html # # As a special exception this file can also be included in modules # with other source code as long as that source code has been # released under an Open Source Initiative certificed licence. # More information about OSI certification can be found at: # http://www.opensource.org # # This module 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 # GNU Lesser General Public Licence for more details. # # This module was created by members of the firebird development # team. All individual contributions remain the Copyright (C) of # those individuals and all rights are reserved. Contributors to # this file are either listed below or can be obtained from a CVS # history command. # # Created by: Mark O'Donohue # # Contributor(s): # # # $Id: Makefile.in.firebird,v 1.44 2003-09-05 10:05:28 alexpeshkoff Exp $ # ROOT=.. include $(ROOT)/gen/make.defaults include $(ROOT)/gen/make.platform include $(ROOT)/gen/make.rules include $(ROOT)/gen/make.shared.variables @SET_MAKE@ ISC_USER= sysdba ISC_PASSWORD= masterkey #LD_LIBRARY_PATH=/home/odonohue/src/firebird2/gen/firebird/lib:/usr/lib TEST_PATH = @FIREBIRD_BUILD_DIR@ # Firebird libs path set at link time (-R) so do not override local requirements - nmcc 28/12/2002 #LD_LIBRARY_PATH=$(RealFirebirdPath)/lib #export ISC_USER #export ISC_PASSWORD #export INTERBASE export FIREBIRD export DYLD_FRAMEWORK_PATH #export LD_LIBRARY_PATH ###################################################################### ########### Build process overview ################################# # # Firebird2 has brought with it a new build process. This extended # comment should help explain that process. Keep in mind there are # a number of artifacts left in the makefiles from the previous build # processes. # # The build process starts by building a bootstrap version of gpre. # This is possible because of a special version of gpre_meta.cpp, # gpre_meta_boot.cpp. It is a copy of the gpre_meta.epp file with all # the embeded commands removed. There are pregenerated copy of the # codes.h and related files in the source tree. These are used for the # entire build process. In the future we should check for the ability # to regenerate codes.h and friends (ie, a working FB install) and only # use the static files as a last resort. # # The bootstrap version of gpre (gpre_boot) is used to build all the # engine files, except security.bin. security.epp requires the security # database which is not available at this time. The code in jrd/alt.cpp # that references the functions in security.bin has been #ifdef'ed out. # During this phase of the build process the limited version of alt.bin # is used. The full version of alt.bin is compiled later in the build # process after the security database is available. After the # (hopefully pending) redesign of FB security the security database # dependancies should go away. # # The engine objects are placed in the jrd_static.a archive. This archive # contains all the objects needed to create statically linked programs. # A fully functional version of gpre, gpre_static, is then generated # using jrd_static.a. I choose to statically link the few utilities # required to build FB to avoid possible shared library symbol conflicts. # # All of the aforementioned work is done in the # first phase of the compilation. I called it the first phase because # none of the work (except codes.h and friends) requires database access. # Phase 2 builds all the tools necessary to compile the rest of FB. Those # tools are gbak and the gds.$(SHRLIB_EXT) shared library. # # The .epp files in gbak require the yachts.lnk database. But the only # thing the database is used for is the metadata, so an empty database # will do the job. The create_db program is a small c API utility that # creates an empty database. This utility is statically linked. # Once there is an empty database gbak_static is built. gbak_static is # used later on in the compilation process to restore build databases. # # After gbak_static is built the gds.$(SHRLIB_EXT) library is built. This library is # still missing the security functionality. # # Now we are on phase 3, building the actual DB tools. This is as expected. # We build all tools and link them against the shared library, including # gpre, gbak, and the fully functional gds.$(SHRLIB_EXT). # # John Belardo ~ July 2001 # # In the tradition of makefiles, they have evolved even further. But most of # the above is still applies. There now tends to be a Makefile for each # target rather than the more traditional Makefile per directory model. # This was needed to enable super to build corrently. But it also allowed # some of the boot build process to be done simpler as well. # MOD 28-July-2002 # ########### And now on with the show............ ################################################################# #__________________________________________________________________________ # # This is the main target for the make. The targets are # firebird_embedded and firebird_server. Or as they used to be known # firebird_classic and firebird_super. # (The .PHONY: stuff just means it's a fake target, and make wont go searching # for a real file or directory - but there are a lot of them here # MOD 28-July-2002) .PHONY: all firebird firebird_boot firebird_basic .PHONY: firebird_embedded firebird_server classic_programs super_programs .PHONY: firebird_super firebird_classic # The main targets are firebird_embedded or firebird_server # or their older names _classic or _super. # The following target is expanded by autoconf process to # either _classic or _super. firebird : firebird_@FIREBIRD_ARCH_TYPE@ firebird_classic firebird_embedded: firebird_basic classic_targets firebird_super firebird_server: firebird_basic super_targets # In building embedded/server version some targets are common, mainly the # boot kit, security.fdb database and messages files. Boot builds a number of # static programs gpre_static gbak_static isql_static though an involved # process. These are used to compile the rest of the source, as it saves # some complications particularly for super in needing to start the server # that you are currently building. MOD 28-July-2002 firebird_basic: external_libraries firebird_boot basic_targets firebird_boot: updateBuildNum boot_phase1 boot_phase2 #---------------------------------------------------------------------------- # jrd/build_no.h contains the version and build# fields used throughout the # program and quoted in the tools. This routine will update the build_no.h # file with the auto update build# script file, writeBuildNum.sh. The # writeBuildNum.sh script is autoupdated by CVS checkins. # .PHONY: updateBuildNum external_libraries updateBuildNum : jrd/build_no.h $(GEN_ROOT)/Make.Version jrd/build_no.h : $(SRC_ROOT)/misc/writeBuildNum.sh (cd ..; ./src/misc/writeBuildNum.sh rebuildHeader) $(GEN_ROOT)/Make.Version : $(SRC_ROOT)/misc/writeBuildNum.sh $(SRC_ROOT)/misc/writeBuildNum.sh createMakeVersion $@ # # Libraries that come from outside the project but are built # as part of the project are included here. Currently editline # is the only external library we have included. # EXTERNAL_LIBRARIES= ifeq ($(EDITLINE_FLG),Y) EXTERNAL_LIBRARIES:= $(EXTERNAL_LIBRARIES) $(LIBEDITLINE_A) endif external_libraries: $(EXTERNAL_LIBRARIES) $(LIBEDITLINE_A): $(MAKE) -f $(GEN_ROOT)/Makefile.extern.editline #--------------------------------------------------------------------------- # Phase1: make a gpre_static from scratch so we can parse .e and .epp files # to build the rest of the system. It goes in two bits make a real simple # gpre_boot one and use that to build a gpre_static one. # # gpre_static has a fair bit more in it and we have now actually built most # of the libraries. With gpre_static we now have enough to build gbak and # start restoring databases. # # if $(BIN)/gpre_static exists then phase1 is complete. phase1 does not then # rebuild automatically gpre_static if some of it's dependancies change. We # only need on gpre_static to boot after we have one we don't care. # (If you really want to rebuild it you need to remove the executable file # $(BIN)/gpre_static). # .PHONY: boot_phase1 boot_phase1_build .PHONY: libfbcommon libfbstatic gpre_boot gpre_static boot_phase1: $(GPRE_STATIC) $(GPRE_STATIC): $(MAKE) boot_phase1_build boot_phase1_build: libfbcommon gpre_boot libfbstatic gpre_static @MANAGER_PROCESS_TARGET@ libfbcommon: $(MAKE) -f $(GEN_ROOT)/Makefile.libfbcommon $@ gpre_boot: $(MAKE) -f $(GEN_ROOT)/Makefile.boot.gpre $@ libfbstatic: $(MAKE) -f $(GEN_ROOT)/Makefile.libfbstatic $@ gpre_static: $(MAKE) -f $(GEN_ROOT)/Makefile.static.gpre $@ # The lock manager for classic (embedded) lock_mgr : $(MAKE) -f $(GEN_ROOT)/Makefile.embed.lockmgr $@ #-------------------------------------------------------------------------- #Phase2: We can now start build some of the static utilities needed to build # an empty database (lock manager and create_db). Then we rebuild all the # items we have built in the static library into a dynamic library. # (It's probably possible to directly build the dynamic library - but thats # for another day). We still don't have the security database stuff. # # Phase2 is complete with the building of an security.fdb user store database # in order to do that isql and gdef tools need to be built without security # to do that a special alt_boot.o is inserted into the shared library. # Again once security.fdb is built then were not too worried about the # components (in fact some of them have to be rebuilt again to incorperate # the security module) # .PHONY: create_db empty_db gbak_static isql_static ref_databases boot_phase2 : $(ISC_GDB) $(ISC_GDB): $(MAKE) boot_phase2_build boot_phase2_build: create_db empty_db gbak_static isql_static create_db: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.util $@ gbak_static: @MANAGER_PROCESS_TARGET@ $(MAKE) -f $(GEN_ROOT)/Makefile.static.gbak $@ isql_static: $(MAKE) -f $(GEN_ROOT)/Makefile.static.isql $@ empty_db : $(MAKE) -f $(GEN_ROOT)/Makefile.refDatabases $@ ref_databases : gbak_static $(MAKE) -f $(GEN_ROOT)/Makefile.refDatabases $@ security.fdb: gdef isql # build the security database $(MAKE) -C utilities $@ #-------------------------------------------------------------------------- #Phase3: Now we start building the tools we are actually going to use # against the shared library. # an empty database (lock manager and create_db). Then we rebuild all the # items we have built in the static library into a dynamic library. # (It's probably possible to directly build the dynamic library - but thats # for another day). We still don't have the security database stuff. # # Notes: # mainly we need gdef and isql to be able to build security.fdb. I wonder # if we could reduce the tricky dependancy by restoring the security.fdb # database earlier, then perhaps we could build the jrdlib in one step and # include the security bits and pieces. .PHONY: ref_databases msgs msgs_intl generated_headers intl extlib includes basic_targets: ref_databases msgs msgs_intl generated_headers intl extlib includes examples_cp \ otherfiles # hack to make code regeneration work generated_headers : $(MAKE) -f $(GEN_ROOT)/Makefile.codes $@ msgs: # messages file for user $(FIREBIRD)/firebird.msg $(MAKE) -f $(GEN_ROOT)/Makefile.msgs $@ msgs_intl: # international version of msgs file $(MAKE) -f $(GEN_ROOT)/Makefile.msgs $@ intl: # international lang components $(FIREBIRD)/intl/ $(MAKE) -f $(GEN_ROOT)/Makefile.intl extlib: # external programs than can be called $(MAKE) -f $(GEN_ROOT)/Makefile.extlib # distribution header include files includes: include_generic # examples still need a good makefile to ship with them examples_cp: $(MAKE) -f Makefile.examples -C $(GEN_ROOT)/examples/ otherfiles: misc_files script_files #_ Embedded Firebird Targets (Classic)_______________________________________ .PHONY: libfbembed inet_server embed_gfix embed_gbak embed_isql .PHONY: embed_gpre embed_util classic_targets: libfbembed inet_server embed_gfix embed_gbak embed_isql \ embed_gpre embed_util embed_gdef embed_qli libfbembed: $(MAKE) -f $(GEN_ROOT)/Makefile.libfbembed $@ inet_server: $(MAKE) -f $(GEN_ROOT)/Makefile.inet_server embed_gfix: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.gfix embed_gbak: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.gbak embed_isql: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.isql embed_gpre: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.gpre embed_util: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.util embed_gdef: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.gdef embed_qli: $(MAKE) -f $(GEN_ROOT)/Makefile.embed.qli #_ Firebird Server Targets (super and super client)__________________________ .PHONY: libfbserver fbserver .PHONY: libfbclient client_gfix client_gbak client_isql client_gpre client_util super_targets: libfbserver fbserver libfbclient client_gfix client_gbak \ client_isql client_gpre client_util # client_gdef libfbserver: $(MAKE) -f $(GEN_ROOT)/Makefile.libfbserver $@ fbserver: $(MAKE) -f $(GEN_ROOT)/Makefile.fbserver $@ libfbclient: $(MAKE) -f $(GEN_ROOT)/Makefile.libfbclient $@ client_gfix: $(MAKE) -f $(GEN_ROOT)/Makefile.client.gfix client_gbak: $(MAKE) -f $(GEN_ROOT)/Makefile.client.gbak client_gpre: $(MAKE) -f $(GEN_ROOT)/Makefile.client.gpre client_isql: $(MAKE) -f $(GEN_ROOT)/Makefile.client.isql client_util: $(MAKE) -f $(GEN_ROOT)/Makefile.client.util # Not sure we need this target in super - problems with WAL includes # MOD 04-Oct-2002 client_gdef: $(MAKE) -f $(GEN_ROOT)/Makefile.client.gdef #sysdba_user gstat: # add sysdba user and build gstat program # $(MAKE) -C utilities $@ #--------------------------------------------------------------------------- # This target builds the include files for disttribution with the release # Some of the files differ from the ones used internally to compile the # software - mainly they are just flattened out to make the view simpler # from an external point of view. INCLUDE_DEST= $(FIREBIRD)/include include_generic: $(INCLUDE_DEST)/ib_util.h \ $(INCLUDE_DEST)/gds.h \ $(INCLUDE_DEST)/ibase.h # ib_util.h actually is a marker for a number of headers # All these files are #includes in gds.h here we cat them all together # and remove the embedded #includes to make it simpler for external usage. GDS_ExtraFiles = misc/gds_header.txt include/fb_types.h \ jrd/ibase.h jrd/blr.h include/gen/iberror.h \ jrd/gdsold.h include/gen/codes.h SRC_GDS_ExtraFiles = $(addprefix $(SRC_ROOT)/, $(GDS_ExtraFiles)) $(INCLUDE_DEST)/gds.h: $(SRC_GDS_ExtraFiles) $(CAT) $^ |grep -v '^#include' > $@ IBASE_ExtraFiles = include/fb_types.h jrd/ibase.h jrd/blr.h include/gen/iberror.h SRC_IBASE_ExtraFiles = $(addprefix $(SRC_ROOT)/, $(IBASE_ExtraFiles)) $(INCLUDE_DEST)/ibase.h: $(SRC_IBASE_ExtraFiles) $(CAT) $^ |grep -v '^#include' > $@ # Copy all the other headers to the distribution directory. we use # ib_util.h as the marker for all the files. OtherDistribHeaders = extlib/ib_util.h \ jrd/perf.h \ jrd/blr.h \ include/gen/iberror.h SRC_OtherDistribHeaders = $(addprefix $(SRC_ROOT)/, $(OtherDistribHeaders)) $(INCLUDE_DEST)/ib_util.h : $(SRC_OtherDistribHeaders) $(CP) $^ $(INCLUDE_DEST)/ # There are also gds*f and gds*ada header files around if someone # wants them. You might need to hunt around in the old cvs tree for them. #___________________________________________________________________________ # When the msgs.fdb dataabse has changed with new messages a number of header # files need to be regenerated. This is the target to do it. These new # header files (placed in include/gen) then need to be committed since they # are not generally rebuilt from scratch rebuild_codes : $(MAKE) -C jrd $@ #___________________________________________________________________________ # Install generic files. #CLASSIC_MiscFiles = firebird.conf #SUPER_MiscFiles = firebird.conf #ifeq ($(ArchType),super) #INSTALL_MiscFiles = $(addprefix $(FIREBIRD)/misc/, $(SUPER_MiscFiles)) #else #INSTALL_MiscFiles = $(addprefix $(FIREBIRD)/misc/, $(CLASSIC_MiscFiles)) #endif MiscFiles = firebird.conf INSTALL_MiscFiles = $(addprefix $(FIREBIRD)/misc/, $(MiscFiles)) misc_files : $(INSTALL_MiscFiles) $(FIREBIRD)/misc/% :: $(BLD_ROOT)/install/misc/% $(CP) $^ $@ #___________________________________________________________________________ # #CLASSIC_ScriptFiles = CSchangeRunUser.sh CSrestoreRootRunUser.sh #SUPER_ScriptFiles = SSchangeRunUser.sh SSrestoreRootRunUser.sh #ifeq ($(ArchType),super) #INSTALL_ScriptFiles = $(addprefix $(BIN)/, $(SUPER_ScriptFiles)) #else #INSTALL_ScriptFiles = $(addprefix $(BIN)/, $(CLASSIC_ScriptFiles)) #endif ScriptFiles = CSchangeRunUser.sh CSrestoreRootRunUser.sh SSchangeRunUser.sh SSrestoreRootRunUser.sh INSTALL_ScriptFiles = $(addprefix $(BIN)/, $(ScriptFiles)) script_files : $(INSTALL_ScriptFiles) $(BIN)/% :: $(BLD_ROOT)/install/classic/% $(CP) $^ $@ $(CHMOD) ugo=rx $@ $(BIN)/% :: $(BLD_ROOT)/install/super/% $(CP) $^ $@ $(CHMOD) ugo=rx $@ $(BIN)/% :: $(BLD_ROOT)/install/misc/% $(CP) $^ $@ $(CHMOD) ugo=rx $@ #___________________________________________________________________________ # .PHONY: install package packages dist install package packages dist: $(MAKE) -f $(GEN_ROOT)/Makefile.install $@ #___________________________________________________________________________ # clean: clean_objects clean_dependancies clean_extern_objects clean_build clean_gpre_gen clean_config: clean clean_makefiles $(RM) $(ROOT)/configure # Not sure if this one is still needed MOD 7-Oct-2002 clean_dbs: -$(RM) refDatabases/*\.fdb clean_objects: $(RM) `find $(GEN_ROOT)/ -type f -name '*.o' -print` clean_extern_objects: $(RM) `find $(SRC_ROOT)/extern/ -type f -name '*.o' -print` # Clear out dependancies files created by the gcc compiler # since when .o and other files are deleted the dependant # targets need to be recalculated # MOD 10-July-2002 clean_dependancies: $(RM) -f `find $(GEN_ROOT)/ -type f -name '*.d' -print` # delete only all of the files of type regular file in $FIREBIRD # leave the directories to make dependacies work still # MOD 11-July-2002 clean_build: $(RM) `find $(GEN_ROOT)/firebird -type f -print` # $(RM) $(GDSLIB_OBJECTS) $(GDSLIB_PHASE3_OBJECTS) # clean_makefiles: $(RM) $(GEN_ROOT)/Makefile.* clean_gpre_gen: -$(RM) `find $(SRC_ROOT) -type f -name '*.epp' -print | sed 's/epp$$/cpp/'` #___________________________________________________________________________ #