# --------------------------------------------------------------------- # Linux Makefile for FAUfile # This file is part of FreeAdhocUDF. # --------------------------------------------------------------------- # FreeAdhocUDF - copyright (c) 2004 - 2009 adhoc dataservice GmbH # Christoph Theuring / Peter Mandrella / Georg Horn # eMail # based on FreeUDFLibC - copyright (c) 1999 Gregory Deatz # changes by adhoc dataservice GmbH # --------------------------------------------------------------------- # InterBase/FireBird Installation Directory # uncommend to use /include and /lib form installed InterBase/FireBird # and for make install copy FAUfile.so to the $(DBDIR)/UDF/ directory # --------------------------------------------------------------------- #DBDIR=/opt/firebird #DBDIR=/usr/local/firebird #DBDIR=/opt/interbase #DBDIR=/usr/local/interbase # --------------------------------------------------------------------- # ICU includes (lib is already in the database) # --------------------------------------------------------------------- #ICU_INCL=../linux/icu/include # ---------------------------------------------------------------------- # uncomment your choice of the DB-system # for InterBase you can choose the newest version for all ib versions # for FireBird 1.x you must choose firebird_1_5 # for FireBird 2.x you can choose the newest firebird 2.x version # for FireBird 2.x amd64 you can chosse the newest firebird 2.x_64 version # ---------------------------------------------------------------------- #DBSYSTEM=interbase_6_0_2 #DBSYSTEM=interbase_7_1 #DBSYSTEM=interbase_7_5 #DBSYSTEM=interbase_2007 #DBSYSTEM=interbase_2009 #DBSYSTEM=firebird_1_5_5 #DBSYSTEM=firebird_2_0_5 #DBSYSTEM=firebird_2_0_5_amd64 DBSYSTEM=firebird_2_1_3 #DBSYSTEM=firebird_2_1_3_amd64 #DBSYSTEM=firebird_2_5_b2 #DBSYSTEM=firebird_2_5_b2_amd64 # ---------------------------------------------------------------------- # set the output name # ---------------------------------------------------------------------- ifeq (interbase, $(findstring interbase, $(DBSYSTEM))) FAU=FAUfile_IB_i32.so endif ifeq (firebird_1_5, $(findstring firebird_1_5, $(DBSYSTEM))) FAU=FAUfile_FB15x_i32.so endif ifeq (firebird_2_, $(findstring firebird_2_, $(DBSYSTEM))) ifeq (_amd64, $(findstring _amd64, $(DBSYSTEM))) FAU=FAUfile_FB2x_amd64.so else FAU=FAUfile_FB2x_i32.so endif endif # ---------------------------------------------------------------------- # Location of header files and libraries # ---------------------------------------------------------------------- # set the directory for the associated libraries ifeq (/, $(findstring /, $(DBDIR))) LIB=$(DBDIR)/lib else ifeq (_amd64, $(findstring _amd64, $(DBSYSTEM))) LIB=../linux/$(subst _amd64,,$(DBSYSTEM))_amd64/lib64 else LIB=../linux/$(DBSYSTEM)/lib endif endif # set the directory for the associated header files ifeq (/, $(findstring /, $(DBDIR))) INCLUDE=$(DBDIR)/include else ifeq (_amd64, $(findstring _amd64, $(DBSYSTEM))) INCLUDE=../linux/$(subst _amd64,,$(DBSYSTEM))_amd64/include # ICU_INCLUDE=$(ICU_INCL)64 else INCLUDE=../linux/$(DBSYSTEM)/include # ICU_INCLUDE=$(ICU_INCL)32 endif endif # ---------------------------------------------------------------------- # set compiler and linker options # ---------------------------------------------------------------------- # set the associated clientlib to the DB-system # gds for InterBase, fbclient for FireBird # ---------------------------------------------------------------------- ifeq (firebird, $(findstring firebird, $(DBSYSTEM))) CLIENTLIB=fbclient else CLIENTLIB=gds endif # ---------------------------------------------------------------------- # potential set flag for a 32 bit FreeAdhocUDF compile on a 64 bit system # ---------------------------------------------------------------------- # point to the 32bit libraries on a 64bit system LIB32=/usr/lib32 #ifneq ($(wildcard i*86), $(findstring $(wildcard i*86), $(shell uname -a))) ifeq (x86_64, $(findstring x86_64, $(shell uname -a))) SYSTEM='the system is 64bit' ifneq (_amd64, $(findstring _amd64, $(DBSYSTEM))) CF=-m32 LF=-mi386linux -L$(LIB32) FAUfile='the FAUfile is 32bit' else CF=-m64 LF= FAUfile='the FAUfile is 64bit' endif else SYSTEM='the system is 32bit' ifneq (_amd64, $(findstring _amd64, $(DBSYSTEM))) FAUfile='the FAUfile is 32bit' CF= LF= else $(error no 64bit compiling on a 32bit system!) endif endif # --------------------------------------------------------------------- # Compiler and linker Defines # --------------------------------------------------------------------- CC=gcc #CFLAGS=-Wall -fpic -O -c $(CF) -I$(INCLUDE) -I$(ICU_INCLUDE) CFLAGS=-Wall -fpic -O -c $(CF) -I$(INCLUDE) LD=ld LDFLAGS=-G -Bsymbolic $(LF) -L$(LIB) -lm -lc -lib_util # --------------------------------------------------------------------- # Generic Compilation Rules # --------------------------------------------------------------------- .c.o: $(CC) $< $(CFLAGS) -o $@ # --------------------------------------------------------------------- # The UDF objects # --------------------------------------------------------------------- UDF_OBJs = file_functions.o all: $(FAU) $(FAU): $(UDF_OBJs) $(LD) $(UDF_OBJs) -o $@ $(LDFLAGS) -l$(CLIENTLIB) clean: rm -f *.o *.bak *.~* core @echo ---------- @echo clean done @echo ---------- new: clean depend all @echo ------------------------------- @echo chosen $(DBSYSTEM) @echo libs are located $(LIB) @echo headers are located $(INCLUDE) # @echo icu_headers are located $(ICU_INCLUDE) @echo clientlib is $(CLIENTLIB) @echo $(SYSTEM) @echo $(FAUfile) @echo libname is $(FAU) @echo ------------------------------ install: all cp $(FAU) $(DBDIR)/UDF/FreeAdhocUDF.so depend: cat Makefile | sed '/^# DO NOT DELETE/,$$d' > Makefile.tmp mv Makefile.tmp Makefile chmod 777 Makefile echo "# DO NOT DELETE THIS LINE - MAKE DEPEND DEPENDS ON IT" >> Makefile echo "" >> Makefile for i in *.c; do gcc $(CFLAGS) -E -MM $$i >> Makefile; done @echo ----------- @echo depend done @echo ----------- # DO NOT DELETE THIS LINE - MAKE DEPEND DEPENDS ON IT