2003-07-17 04:15:46 +02:00
|
|
|
# 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
|
2020-04-19 04:10:09 +02:00
|
|
|
#
|
2003-07-17 04:15:46 +02:00
|
|
|
# As a special exception this file can also be included in modules
|
2020-04-19 04:10:09 +02:00
|
|
|
# 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
|
|
|
|
#
|
2003-07-17 04:15:46 +02:00
|
|
|
# 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.
|
2020-04-19 04:10:09 +02:00
|
|
|
#
|
|
|
|
# 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
|
2003-07-17 04:15:46 +02:00
|
|
|
# history command.
|
|
|
|
#
|
|
|
|
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
2020-04-19 04:10:09 +02:00
|
|
|
#
|
2003-07-17 04:15:46 +02:00
|
|
|
#
|
|
|
|
#
|
2020-04-20 17:34:28 +02:00
|
|
|
ROOT=$(shell cd ../..; pwd)
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2021-09-15 13:37:17 +02:00
|
|
|
|
|
|
|
%.cpp: %.epp
|
|
|
|
$(GPRE_CURRENT) $(GPRE_FLAGS) $< $@
|
|
|
|
|
|
|
|
%.o: %.cpp
|
2021-09-27 20:40:42 +02:00
|
|
|
$(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
|
2021-09-15 13:37:17 +02:00
|
|
|
|
|
|
|
|
2003-07-17 04:15:46 +02:00
|
|
|
# Add the install include directory to the search path since the
|
|
|
|
# examples need to build using those headers values.
|
|
|
|
|
2012-06-22 13:39:24 +02:00
|
|
|
CFLAGS := $(CFLAGS) -I$(FB_BUILD)/include
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
include $(ROOT)/gen/make.defaults
|
2020-04-19 04:10:09 +02:00
|
|
|
ifdef SFIO_EXAMPLES
|
2008-09-02 16:22:42 +02:00
|
|
|
include $(ROOT)/gen/make.platform.solaris.examples
|
|
|
|
else
|
2003-07-17 04:15:46 +02:00
|
|
|
include $(ROOT)/gen/make.platform
|
2008-09-02 16:22:42 +02:00
|
|
|
endif
|
2003-07-17 04:15:46 +02:00
|
|
|
include $(ROOT)/gen/make.rules
|
|
|
|
include $(ROOT)/gen/make.shared.variables
|
|
|
|
|
|
|
|
@SET_MAKE@
|
|
|
|
|
|
|
|
PATH := ./:$(BIN):$(PATH)
|
|
|
|
export PATH
|
|
|
|
|
2010-10-12 10:02:57 +02:00
|
|
|
#ifeq ($(PLATFORM),DARWIN)
|
2015-03-28 14:55:53 +01:00
|
|
|
#DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):$(GEN_ROOT)/firebird/lib
|
2010-10-12 10:02:57 +02:00
|
|
|
#export DYLD_LIBRARY_PATH
|
|
|
|
#else
|
2015-03-28 14:55:53 +01:00
|
|
|
#LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(GEN_ROOT)/firebird/lib
|
2010-10-12 10:02:57 +02:00
|
|
|
#export LD_LIBRARY_PATH
|
|
|
|
#endif
|
2015-06-29 03:38:16 +02:00
|
|
|
GPRE_FLAGS= -m -z -n
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2010-10-12 10:02:57 +02:00
|
|
|
LIB_LINK_RPATH = $(call LIB_PLATFORM_RPATH,$(if $(subst intl,,$(1)),$(LIB),$(LIB)/../intl))
|
2021-12-17 13:06:50 +01:00
|
|
|
LINK_DARWIN_RPATH = -Wl,-rpath,@loader_path/../$(TARGET)/firebird
|
2011-12-27 09:14:58 +01:00
|
|
|
LIB_LINK_MAPFILE =
|
2010-10-12 10:02:57 +02:00
|
|
|
|
2003-08-04 01:18:57 +02:00
|
|
|
EXAMPLES_DEST= $(GEN_ROOT)/examples
|
|
|
|
EXAMPLES_SRC= $(ROOT)/examples
|
2020-04-20 17:34:28 +02:00
|
|
|
EXAMPLES_FB= $(FIREBIRD)/examples
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
EMPBLD_Objects= $(EXAMPLES_DEST)/empbuild.o
|
|
|
|
|
|
|
|
INTLBLD_Objects= $(EXAMPLES_DEST)/intlbld.o
|
|
|
|
|
|
|
|
INPUT_Files = empddl.sql empdml.sql indexoff.sql indexon.sql \
|
|
|
|
job.inp lang.inp proj.inp qtr.inp
|
|
|
|
INPUT_Sources = $(addprefix $(EXAMPLES_DEST)/, $(INPUT_Files))
|
|
|
|
|
|
|
|
INTL_Files = intlddl.sql intldml.sql indexoff.sql indexon.sql \
|
|
|
|
job.inp lang.inp proj.inp qtr.inp
|
|
|
|
INTL_Sources = $(addprefix $(EXAMPLES_DEST)/, $(INTL_Files))
|
|
|
|
|
|
|
|
EMPLOYEE_DB= $(EXAMPLES_DEST)/employee.fdb
|
2020-04-20 17:34:28 +02:00
|
|
|
FINAL_EMPDB= $(EXAMPLES_FB)/empbuild/employee.fdb
|
2003-07-17 04:15:46 +02:00
|
|
|
INTLEMP_DB= $(EXAMPLES_DEST)/intlemp.fdb
|
|
|
|
|
2020-05-07 12:22:19 +02:00
|
|
|
EXTAUTH_PLUGIN= $(EXAMPLES_FB)/prebuilt/libfbSampleExtAuth.$(SHRLIB_EXT)
|
2020-04-20 17:34:28 +02:00
|
|
|
|
2010-10-12 10:02:57 +02:00
|
|
|
.PHONY: all examples
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2010-10-12 10:02:57 +02:00
|
|
|
all: examples
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2020-04-20 17:34:28 +02:00
|
|
|
# examples: $(EMPLOYEE_DB) $(INTLEMP_DB) $(EXAMPLES_FB)/README
|
|
|
|
examples: $(FINAL_EMPDB) $(EXAMPLES_FB)/README $(EXTAUTH_PLUGIN)
|
|
|
|
|
|
|
|
$(EXTAUTH_PLUGIN): $(EXAMPLES_FB)/extauth/Makefile
|
2021-09-27 20:40:42 +02:00
|
|
|
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) -C $(EXAMPLES_FB)/extauth OUT=$(EXAMPLES_FB)/prebuilt INTERMED=$(TMP_ROOT)/examples/extauth
|
2020-04-20 17:34:28 +02:00
|
|
|
|
|
|
|
$(EXAMPLES_FB)/extauth/Makefile:
|
|
|
|
ifeq ($(TOMCRYPT_BUILD_FLG),Y)
|
|
|
|
mkdir -p $(EXAMPLES_FB)/extauth/tomcrypt.include
|
|
|
|
$(CP) $(ROOT)/extern/libtomcrypt/src/headers/* $(EXAMPLES_FB)/extauth/tomcrypt.include
|
|
|
|
endif
|
|
|
|
tar cf - -C $(ROOT)/examples/extauth . | tar xf - -C $(EXAMPLES_FB)/extauth/
|
2012-03-15 10:52:55 +01:00
|
|
|
|
|
|
|
$(FINAL_EMPDB): $(EMPLOYEE_DB)
|
|
|
|
$(RM) $(FINAL_EMPDB)
|
|
|
|
$(CP) $(EMPLOYEE_DB) $(FINAL_EMPDB)
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2020-04-20 17:34:28 +02:00
|
|
|
$(EXAMPLES_FB)/README:
|
|
|
|
$(CP) $(ROOT)/examples/*.* $(EXAMPLES_FB)/
|
|
|
|
$(CP) $(ROOT)/examples/api/*.* $(EXAMPLES_FB)/api/
|
|
|
|
$(CP) $(ROOT)/examples/dbcrypt/*.* $(EXAMPLES_FB)/dbcrypt/
|
|
|
|
$(CP) $(ROOT)/examples/include/*.* $(EXAMPLES_FB)/include/
|
|
|
|
$(CP) $(ROOT)/examples/interfaces/*.* $(EXAMPLES_FB)/interfaces/
|
|
|
|
$(CP) $(ROOT)/examples/package/*.* $(EXAMPLES_FB)/package/
|
|
|
|
$(CP) $(ROOT)/examples/stat/*.* $(EXAMPLES_FB)/stat/
|
|
|
|
$(CP) $(ROOT)/examples/udf/*.* $(EXAMPLES_FB)/udf/
|
|
|
|
$(CP) $(ROOT)/examples/udr/*.* $(EXAMPLES_FB)/udr/
|
2022-01-27 11:25:14 +01:00
|
|
|
$(CP) $(ROOT)/examples/object_pascal/*.* $(EXAMPLES_FB)/object_pascal/
|
|
|
|
$(CP) $(ROOT)/examples/object_pascal/[mM]ake* $(EXAMPLES_FB)/object_pascal/
|
|
|
|
$(CP) $(ROOT)/examples/object_pascal/common/*.* $(EXAMPLES_FB)/object_pascal/common/
|
2020-04-20 17:34:28 +02:00
|
|
|
# $(CP) intlemp.fdb $(EXAMPLES_FB)/empbuild/
|
|
|
|
$(CP) $(ROOT)/examples/readme $(EXAMPLES_FB)/README
|
2020-08-17 17:03:22 +02:00
|
|
|
$(CP) $(ROOT)/examples/empbuild/employe2.sql $(EXAMPLES_FB)/empbuild/
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
$(EXAMPLES_DEST)% : $(EXAMPLES_SRC)%
|
|
|
|
$(CP) $^ $@
|
|
|
|
|
|
|
|
# Ok the following little story is, first build empbuild.fdb an empty db
|
2021-09-15 13:37:17 +02:00
|
|
|
# using a script file. Then we can compile the empbuild.epp file, then we
|
2003-07-17 04:15:46 +02:00
|
|
|
# can run it to create employee.fdb database populated with data by the
|
|
|
|
# program. Thats how I found it.
|
|
|
|
# MOD July-2001
|
|
|
|
#
|
|
|
|
# Another problem here is that empbuild does not fail when it gets an error
|
|
|
|
# so MAKE thinks it's all run ok. empbuild should be modified to return an
|
2020-04-19 04:10:09 +02:00
|
|
|
# error when it fails.
|
2003-07-17 04:15:46 +02:00
|
|
|
# MOD 28-July-2002
|
|
|
|
|
|
|
|
|
2009-11-03 14:35:19 +01:00
|
|
|
$(EMPLOYEE_DB): $(EXAMPLES_DEST)/empbuild$(EXEC_EXT) $(INPUT_Sources) $(EXAMPLES_DEST)/isql$(EXEC_EXT)
|
|
|
|
-$(RM) $(EMPLOYEE_DB)
|
|
|
|
./empbuild $(EMPLOYEE_DB)
|
2011-08-22 03:07:27 +02:00
|
|
|
$(GFIX) -write sync $(EMPLOYEE_DB)
|
2009-11-03 14:35:19 +01:00
|
|
|
-$(CHMOD_6) $(EMPLOYEE_DB)
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2010-10-12 10:02:57 +02:00
|
|
|
# To get past the fact isql is called from the programs, we create a local link in this directory
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/isql$(EXEC_EXT):
|
2010-10-25 17:07:11 +02:00
|
|
|
-$(RM) $(EXAMPLES_DEST)/isql$(EXEC_EXT)
|
|
|
|
$(LN) $(ISQL) $(EXAMPLES_DEST)/isql$(EXEC_EXT)
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2010-10-12 10:02:57 +02:00
|
|
|
$(EXAMPLES_DEST)/empbuild$(EXEC_EXT): $(EMPBLD_Objects) $(COMMON_LIB)
|
2016-05-25 14:14:01 +02:00
|
|
|
$(EXE_LINK) $(EXE_LINK_OPTIONS) $(LSB_UNDEF) $^ -o $@ -L$(LIB) $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)
|
2003-07-17 04:15:46 +02:00
|
|
|
|
2021-09-15 13:37:17 +02:00
|
|
|
$(EXAMPLES_DEST)/empbuild.cpp: $(EXAMPLES_DEST)/empbuild.fdb $(EXAMPLES_DEST)/empbuild.epp
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/empbuild.fdb : $(EXAMPLES_DEST)/empddl.sql $(EXAMPLES_DEST)/empbld.sql $(EXAMPLES_DEST)/isql$(EXEC_EXT)
|
|
|
|
-$(RM) $(EXAMPLES_DEST)/empbuild.fdb
|
2003-08-04 01:18:57 +02:00
|
|
|
$(EXAMPLES_DEST)/isql$(EXEC_EXT) -i empbld.sql
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
# The chain for intlemp.fdb is the same a script file to create an empty database
|
|
|
|
# to allow a .e program to be compiled, to then create and populate with data
|
|
|
|
# the intlemp.fdb database.
|
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/intlemp.fdb: $(EXAMPLES_DEST)/intlbld$(EXEC_EXT) $(INTL_Sources) $(EXAMPLES_DEST)/isql$(EXEC_EXT)
|
|
|
|
-$(RM) intlemp.fdb
|
|
|
|
./intlbld intlemp.fdb
|
|
|
|
-$(CHMOD_6) intlemp.fdb
|
|
|
|
|
2010-10-12 10:02:57 +02:00
|
|
|
$(EXAMPLES_DEST)/intlbld$(EXEC_EXT): $(INTLBLD_Objects) $(COMMON_LIB)
|
2011-12-27 09:14:58 +01:00
|
|
|
$(EXE_LINK) $(EXE_LINK_OPTIONS) @^ -o $@ -L$(LIB) $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/intlbld.c: $(EXAMPLES_DEST)/intlbuild.fdb $(EXAMPLES_DEST)/intlbld.e
|
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/intlbuild.fdb : $(EXAMPLES_DEST)/intlddl.sql $(EXAMPLES_DEST)/intlbld.sql $(EXAMPLES_DEST)/isql$(EXEC_EXT)
|
|
|
|
-$(RM) intlbuild.fdb
|
2003-08-04 01:18:57 +02:00
|
|
|
$(EXAMPLES_DEST)/isql$(EXEC_EXT) -i intlbld.sql
|
2003-07-17 04:15:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/%.sql: $(EXAMPLES_SRC)/empbuild/%.sql
|
|
|
|
$(CP) $^ $@
|
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/%.inp: $(EXAMPLES_SRC)/empbuild/%.inp
|
|
|
|
$(CP) $^ $@
|
|
|
|
|
2021-09-15 13:37:17 +02:00
|
|
|
$(EXAMPLES_DEST)/%.epp: $(EXAMPLES_SRC)/empbuild/%.epp
|
2003-07-17 04:15:46 +02:00
|
|
|
$(CP) $^ $@
|
|
|
|
|
|
|
|
$(EXAMPLES_DEST)/%.h: $(EXAMPLES_SRC)/common/%.h
|
|
|
|
$(CP) $^ $@
|