8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 00:03:02 +01:00
firebird-mirror/builds/posix/Makefile.in.examples

200 lines
7.0 KiB
Makefile
Raw Normal View History

# 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
#
# 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
#
# 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
# history command.
#
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
#
# Contributor(s):
2020-04-19 04:10:09 +02:00
#
#
#
ROOT=$(shell cd ../..; pwd)
%.cpp: %.epp
$(GPRE_CURRENT) $(GPRE_FLAGS) $< $@
%.o: %.cpp
$(CXX) $(WCXXFLAGS) -c $(firstword $<) -o $@
# Add the install include directory to the search path since the
# examples need to build using those headers values.
CFLAGS := $(CFLAGS) -I$(FB_BUILD)/include
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
include $(ROOT)/gen/make.platform
2008-09-02 16:22:42 +02:00
endif
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)
#DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):$(GEN_ROOT)/firebird/lib
2010-10-12 10:02:57 +02:00
#export DYLD_LIBRARY_PATH
#else
#LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(GEN_ROOT)/firebird/lib
2010-10-12 10:02:57 +02:00
#export LD_LIBRARY_PATH
#endif
GPRE_FLAGS= -m -z -n
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
LIB_LINK_MAPFILE =
2010-10-12 10:02:57 +02:00
EXAMPLES_DEST= $(GEN_ROOT)/examples
EXAMPLES_SRC= $(ROOT)/examples
EXAMPLES_FB= $(FIREBIRD)/examples
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
FINAL_EMPDB= $(EXAMPLES_FB)/empbuild/employee.fdb
INTLEMP_DB= $(EXAMPLES_DEST)/intlemp.fdb
EXTAUTH_PLUGIN= $(EXAMPLES_FB)/prebuilt/libfbSampleExtAuth.$(SHRLIB_EXT)
2010-10-12 10:02:57 +02:00
.PHONY: all examples
2010-10-12 10:02:57 +02:00
all: examples
# examples: $(EMPLOYEE_DB) $(INTLEMP_DB) $(EXAMPLES_FB)/README
examples: $(FINAL_EMPDB) $(EXAMPLES_FB)/README $(EXTAUTH_PLUGIN)
$(EXTAUTH_PLUGIN): $(EXAMPLES_FB)/extauth/Makefile
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" $(MAKE) -C $(EXAMPLES_FB)/extauth OUT=$(EXAMPLES_FB)/prebuilt INTERMED=$(TMP_ROOT)/examples/extauth
$(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)
$(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/
$(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/
# $(CP) intlemp.fdb $(EXAMPLES_FB)/empbuild/
$(CP) $(ROOT)/examples/readme $(EXAMPLES_FB)/README
$(CP) $(ROOT)/examples/empbuild/employe2.sql $(EXAMPLES_FB)/empbuild/
$(EXAMPLES_DEST)% : $(EXAMPLES_SRC)%
$(CP) $^ $@
# Ok the following little story is, first build empbuild.fdb an empty db
# using a script file. Then we can compile the empbuild.epp file, then we
# 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.
# MOD 28-July-2002
$(EMPLOYEE_DB): $(EXAMPLES_DEST)/empbuild$(EXEC_EXT) $(INPUT_Sources) $(EXAMPLES_DEST)/isql$(EXEC_EXT)
-$(RM) $(EMPLOYEE_DB)
./empbuild $(EMPLOYEE_DB)
$(GFIX) -write sync $(EMPLOYEE_DB)
-$(CHMOD_6) $(EMPLOYEE_DB)
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
$(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)
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)
$(EXAMPLES_DEST)/empbuild.cpp: $(EXAMPLES_DEST)/empbuild.fdb $(EXAMPLES_DEST)/empbuild.epp
$(EXAMPLES_DEST)/empbuild.fdb : $(EXAMPLES_DEST)/empddl.sql $(EXAMPLES_DEST)/empbld.sql $(EXAMPLES_DEST)/isql$(EXEC_EXT)
-$(RM) $(EXAMPLES_DEST)/empbuild.fdb
$(EXAMPLES_DEST)/isql$(EXEC_EXT) -i empbld.sql
# 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)
$(EXE_LINK) $(EXE_LINK_OPTIONS) @^ -o $@ -L$(LIB) $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS)
$(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
$(EXAMPLES_DEST)/isql$(EXEC_EXT) -i intlbld.sql
$(EXAMPLES_DEST)/%.sql: $(EXAMPLES_SRC)/empbuild/%.sql
$(CP) $^ $@
$(EXAMPLES_DEST)/%.inp: $(EXAMPLES_SRC)/empbuild/%.inp
$(CP) $^ $@
$(EXAMPLES_DEST)/%.epp: $(EXAMPLES_SRC)/empbuild/%.epp
$(CP) $^ $@
$(EXAMPLES_DEST)/%.h: $(EXAMPLES_SRC)/common/%.h
$(CP) $^ $@