# #/* # openisis - an open implementation of the CDS/ISIS database # Version 0.8.x (patchlevel see file Version) # Copyright (C) 2001-2003 by Erik Grziwotz, erik@openisis.org # # 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. # # This library 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 License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # see README for more information #EOH */ # # # $Id: Makefile,v 1.92 2003/06/30 09:59:35 kripke Exp $ # the Makefile # TARGETS=$(BINARY) ois # some require explicit ST or MT build, other targets work with both # O switchable directory for binaries; one of # sto for single threaded unix (used by Perl, PHP, Tcl) # mto for multi threaded unix (used by Java, Tcl) # win for gates of hell (used by general failure) # # sto or win STO=sto # sto, mto or win O=sto MTFLAGS= MTLIBS= ifneq ($(WIN32),) STO=win O=win # don't support MT on windows -- Java or PHP must connect server MTFLAGS= EXE=.exe else ifneq ($(MT),) O=mto MTFLAGS=-D_REENTRANT MTLIBS=-lpthread endif endif BINARY=$(O)/openisis$(EXE) JTARGETS=openisis.jar mto/libopenjsis.so # object files in lib LOBJS=lstr.o ldb.o lrec.o lfmt.o luti.o lio.o lqry.o lbt.o lcs.o lses.o lfdt.o lstb.o ldsp.o lcli.o lenc.o leva.o # object files in server lib LSVOBJS=$(O)/lsv.o # classes in jar ifeq ($(J2EE),) EECLASSES= else # additional utilities requiring at least basic j2ee libs javax.mail, org.xml # you might have to add something like that to your CLASSPATH # /opt/tomcat/common/lib/mail.jar:/opt/tomcat/common/lib/activation.jar:/opt/tomcat/common/lib/xerces.jar EECLASSES=Mail RecToXml XmlToRec XmlTest endif CLASSES=Field Rec Db NativeDb PureDb Test Charset Fdt \ PlainSerializer Utils $(EECLASSES) XSUB=perl/blib/arch/auto/OpenIsis/OpenIsis.so # standard make defines CC=gcc RANLIB=ranlib # you may want to try jikes JC=javac # figure out where to find JNI ... ifeq ($(JNIINC),) ifeq ($(JAVAHOME),) JAVAHOME=/usr/java/jdk1.3 endif JNIINC=-I$(JAVAHOME)/include -I$(JAVAHOME)/include/linux endif # running openisis OPENISIS=$(BINARY) RUNJAVA=LD_LIBRARY_PATH=mto java -classpath openisis.jar:$(CLASSPATH) ifneq ($(WIN32),) JTARGETS=openisis.jar openjsis.dll # Note that console output redirection doesn't work well # older wine 20010731 often croaks "FIXME:pthread_rwlock_rdlock" # since 200111*, console output didn't work at all # some versions should support wine -console tty OPENISIS=wine -- win/openisis include make.mingw tclsubdir=win endif # DBG= ifeq ($(NDEBUG),) DBG=-g else DBG=-DNDEBUG endif # ARCH=-march=i586 # compile CPPFLAGS= # note that -O is necessary for -Wuninitialized warnings # -fstack-check ??? ifeq (,$(WIN32)) PIC=-fPIC else PIC= endif CFLAGS=$(DBG) -O2 -Wall -W -Wshadow -pedantic -Wno-long-long $(PIC) # ############################# link ################################## # common linker flags LDFLAGS= # link statically from openisis.a # do not use -static, since we don't want to slurp in libc LDSTATIC=$(LDFLAGS) # create shared object LDSHARED=$(LDFLAGS) -shared -Wl,-init,openIsisInit,-fini,openIsisFini # link using shared object - the default LDDYNAM=$(LDFLAGS) SYSLIBS= ifeq (solaris,$(OSTYPE)) # rt for nanosleep SYSLIBS=-lrt -lsocket -lnsl endif LDLIBS=$(SYSLIBS) # DB to use -- define DB for db/DB/DB, or DBDIR for other path ifeq ($(DB),) DB=cds endif ifeq ($(DBDIR),) DBDIR=db/$(DB)/$(DB) endif # single and multi threaded objects STOBJS=$(LOBJS:l%=$(STO)/l%) MTOBJS=$(LOBJS:l%=mto/l%) # ############################# targets ################################## # # standard default target all: $(TARGETS) .PHONY: all clean run demo lstbtest lrectest perl jar java jdoc tcl tk # do not delete intermediates .PRECIOUS: org/openisis/%.java %.class %.h clean: rm -rf sto mto win *.jar *.tmp *.exp org/openisis/*.class core jdoc Makefile.old testout.txt [ ! -f perl/Makefile ] || make -C perl clean make -C tcl clean $(O)/libopenisis.a: $(LOBJS:l%=$(O)/l%) $(AR) $(ARFLAGS) $@ $^ $(RANLIB) $@ $(O)/libopenisis.so: $(LOBJS:l%=$(O)/l%) $(CC) $(LDSHARED) $(LDLIBS) -o $@ $^ $(O)/liboisrv.a: $(LSVOBJS) $(AR) $(ARFLAGS) $@ $^ $(RANLIB) $@ $(O)/openisis$(EXE): $(O)/openisis.o $(O)/libopenisis.a $(CC) $(DBG) $(LDSTATIC) $(LDLIBS) $(MTLIBS) -o $@ $^ shared: $(O)/openisis.o $(O)/libopenisis.so $(CC) $(DBG) $(LDDYNAM) -o $(O)/openisis $^ win32: @ $(MAKE) --no-print-directory WIN32=sorry # ########################## demos and tests ############################### # demo: $(O)/demo $(O)/demo -db $(DBDIR) 42 $(O)/demo: $(O)/demo.o $(O)/libopenisis.a $(CC) $(DBG) -o $@ $^ lrectest: $(O)/lrectest $(O)/lrectest $(O)/lrectest: $(O)/lrectest.o $(O)/libopenisis.a $(CC) $(DBG) $(LDLIBS) -o $@ $^ lstbtest: $(O)/lstbtest $(O)/lstbtest $(O)/lstbtest: $(O)/lstbtest.o $(O)/libopenisis.a $(CC) $(DBG) $(LDLIBS) -o $@ $^ $(STO)/oipl: oipl.c $(CC) $(CPPFLAGS) $(CFLAGS) -rdynamic -ldl -o $@ $^ ois: $(O)/ois : $(O)/ois: $(O)/ois.o $(O)/libopenisis.a $(O)/liboisrv.a $(CC) $(LDSTATIC) $^ $(LDLIBS) $(MTLIBS) -o $@ run: $(BINARY) $(OPENISIS) -v $${V:-warn} -db $(DBDIR) $(FMT) 2>&1 | less dump: $(BINARY) $(OPENISIS) -v $${V:-warn} -db $(DBDIR) $(FMT) recode: $(BINARY) $(OPENISIS) -v $${V:-warn} -db $(DBDIR) $(FMT) | recode 850/..Latin-1 check: $(BINARY) $(OPENISIS) -v $${V:-warn} -db $(DBDIR) -check search: $(BINARY) $(OPENISIS) -v $${V:-warn} -search 'development$$' -db $(DBDIR) $(FMT) 2>&1 | less searchdump: $(BINARY) $(OPENISIS) -v $${V:-warn} -search '$$' -db $(DBDIR) $(FMT) 2>&1 terms: $(BINARY) $(OPENISIS) -v $${V:-warn} -terms '$$' -db $(DBDIR) $(FMT) 2>&1 | less test: $(BINARY) $(OPENISIS) -scan development -fmt prop -db $(DBDIR) >testout.txt $(OPENISIS) -terms '$$' -fmt prop -db $(DBDIR) >>testout.txt $(OPENISIS) -search 'devel$$' -fmt mfnf -db $(DBDIR) >>testout.txt diff testout.txt testres.txt crash: $(BINARY) time $(OPENISIS) -v $${V:-warn} -crash 'Z$$' -db db/unesb/unesb searchtest: $(BINARY) $(OPENISIS) -v $${V:-warn} -fmt mfnf -search 'a$$' -db $(DBDIR) $(FMT) >testout.txt diff testout.txt searchtest.txt pftest: $(BINARY) $(OPENISIS) -v $${V:-warn} -search 'Dacca' -db $(DBDIR) \ -pft "$${PFT:-`cat test.pft`}" shsearch: shared LD_LIBRARY_PATH=$(O) $(OPENISIS) -v $${V:-debug} -search development -db $(DBDIR) $(FMT) 2>&1 | less # take your time :) time: $(BINARY) free time $(OPENISIS) -perf 100000 -db $(DBDIR) >/dev/null free # time results for the unesb perf test differ dramatically # depending on the working of operating system caching # you may achive about 0.40 sec (12.000 recs per sec) # but immediatly after timing the cds, # the same test may take more than 40 sec utime: $(BINARY) free time $(OPENISIS) -perf 5000 -db db/unesb/unesb >/dev/null free time $(OPENISIS) -fmt mfnf -search 'k$$' -db db/unesb/unesb >/dev/null # ############################# perl ################################## # # perl: $(XSUB) : : ++++++++++++++++++++++++++++++++++++++++++++++++++++++ : +++ as root in the perl subdir, run 'make install' +++ : ++++++++++++++++++++++++++++++++++++++++++++++++++++++ ptest: $(XSUB) @$(MAKE) -C perl test perl/Makefile: perl/Makefile.PL cd perl && perl Makefile.PL # perl's Makefile doesn't know all deps $(XSUB): perl/OpenIsis.pm perl/OpenIsis.xs openisis.h $(STO)/libopenisis.a perl/Makefile @-[ ! -f perl/OpenIsis.c ] || rm perl/OpenIsis.c @$(MAKE) -C perl # standalone tree with OpenIsis module perltree: $(XSUB) @-[ -d perl/tmptree/auto/OpenIsis ] || mkdir -p perl/tmptree/auto/OpenIsis cp -p perl/OpenIsis.pm perl/tmptree cp -p $(XSUB) perl/tmptree/auto/OpenIsis - strip perl/tmptree/auto/OpenIsis/OpenIsis.so pdemo: perltree perl/demo.pl # ############################# tcl ################################## # tcl: $(O)/libopenisis.a @$(MAKE) -C tcl bin/isish tk: $(O)/libopenisis.a @$(MAKE) -C tcl bin/wisish tcltk: tcl tk ttest: tcl @$(MAKE) -C tcl test # ############################# java ################################## # java: $(JTARGETS) : jtest: java $(RUNJAVA) \ org.openisis.Test -v $${V:-warn} -db $(DBDIR) -encoding Cp850 \ -row 42 \ -search development \ -terms '' \ -mpu -row 130 \ -mhl -hta -row 130 \ -m1 -row 130 \ >testout.txt diff testout.txt jtest.txt jcrash: java $(RUNJAVA) \ org.openisis.Test -v $${V:-warn} -dbpath db/unesb -db unesb \ -crash Z # print in cds1.pft format jcds1: java $(RUNJAVA) \ org.openisis.Test -v $${V:-warn} -db $(DBDIR) -encoding Cp850 \ -m1 -dump jtime: java $(RUNJAVA) \ org.openisis.Test -search 'a$$' -v $${V:-warn} \ -db db/unesb/unesb >/dev/null jdump: java $(RUNJAVA) \ org.openisis.Test -v 9 -db $(DBDIR) 2>&1 | less jwrite: java $(RUNJAVA) \ org.openisis.Test -v 9 -db $(DBDIR) -write jxml: java ifeq ($(J2EE),) echo please be shure to have org.xml. stuff in your CLASSPATH $(MAKE) J2EE=1 jxml else $(RUNJAVA) \ -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser \ org.openisis.XmlTest $${testxml:-test.xml} endif # -overview overview.html jdoc: - mkdir jdoc javadoc \ -sourcepath . \ -encoding ISO-8859-1 \ -J-Xmx64m \ -d jdoc \ -use \ -version \ -author \ -windowtitle 'org.openisis source code documentation' \ -doctitle 'org.openisis source code documentation' \ -header 'org.openisis source code documentation' \ -footer 'this is public material' \ -bottom 'for your eyes only' \ -stylesheetfile jdocstyle.css \ -charset "iso-8859-1" \ org.openisis charset: java mkdir -p db/charset $(RUNJAVA) \ org.openisis.Charset -utf8seq >db/charset/charset.seq mx seq=db/charset/charset.seq create=db/charset/charset -all now tell=1 mx db/charset/charset fst='1 1 MHL,V1' \ ln1=db/charset/charset.lk1 ln2=db/charset/charset.lk2 +fix -all now tell=1 ifload db/charset/charset db/charset/charset.lk1 db/charset/charset.lk2 \ +fix tell=1 -reset -balan $(RUNJAVA) \ org.openisis.Charset # make additional ee classes j2ee: openisis.jar $(EECLASSES:%=org/openisis/%.class) : # openisis.jar: $(foreach cls,$(CLASSES),org/openisis/$(cls).class) openisis.jar: $(CLASSES:%=org/openisis/%.class) jar cvf $@ org/openisis/*.class %.class: %.java $(JC) -classpath .:$(CLASSPATH) $< %.h: %.class javah -jni -o $@ $(subst /,.,$*) ifneq ($(O),mto) mto/libopenjsis.so: openjsis.c $(MTOBJS) $(MAKE) MT=1 $@ else mto/openjsis.o: openjsis.c @- [ -d mto ] || mkdir mto $(CC) -c $(CPPFLAGS) $(CFLAGS) $(MTFLAGS) $(JNIINC) -o $@ $< mto/libopenjsis.so: mto/openjsis.o mto/libopenisis.a $(CC) $(LDSHARED) -o $@ $^ endif %.dll: $(CC) -mdll -o junk.tmp -Wl,--base-file,$*.tmp $($*_deps) dlltool --dllname $@ --base-file $*.tmp \ --output-exp $*.exp --input-def $*.def dlltool --dllname $@ --input-def $*.def \ --output-lib lib$*.a gcc -mdll -mconsole -o $@ $($*_deps) -Wl,$*.exp,--enable-stdcall-fixup # dependences of win32 dlls # note on cross-builds: make sure you have the proper jni headers included - # those supplied for the target platform openjsis_deps=openjsis.o $(LOBJS) openjsis.dll: $(openjsis_deps) # ############################# rules ################################## # # $@ target $^ all prerequisites $? newer $< first $* stem # mto/%.o: %.c @- [ -d mto ] || mkdir mto $(CC) -c $(CPPFLAGS) $(MTFLAGS) $(CFLAGS) -o $@ $< # sto or win $(STO)/%.o: %.c @- [ -d $(STO) ] || mkdir $(STO) $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< # maintenance targets ... most need a posix shell ci: clean : +++ enter checkin message +++ -read msg && ci -l -m"$$msg" * Version: $(BINARY) echo "OpenIsis `$(OPENISIS) -version`" >Version ./lscvs -lr | sort >>Version tar: Version @-[ -d tar ] || mkdir tar ./lscvs -r | sort | tar czvfT tar/openisis.`$(OPENISIS) -version`.tgz - snap: clean @-[ -d tar ] || mkdir tar tar czvf tar/oi`date +%y%m%d`.tgz . --exclude CVS --exclude tar --exclude WEB-INF headers: for f in *.h *.c */*.h */*.c perl/*.xs org/openisis/*.java; do \ cat Header.txt >$$f.tmp; \ sed -e '1,/^EOH/d' $$f >>$$f.tmp; \ mv -f $$f.tmp $$f; \ done for f in `grep -rl '^#EOH' .`; do \ head -n 1 $$f >$$f.tmp; \ sed -e 's/^/#/' Header.txt >>$$f.tmp; \ sed -e '1,/^#EOH/d' $$f >>$$f.tmp; \ echo $$f; \ diff $$f $$f.tmp; \ mv -f $$f.tmp $$f; \ done # please do not try to make deps w/o sed, gcc and mv ... deps: gcc -MM `./lscvs |grep '\.c$$' |sort` >deps.tmp sed -n -e '1,/^# generated deps/p' Makefile >Makefile.tmp sed -e '/^[^ ]/s/^/mto\//' >Makefile.tmp sed -e '/^[^ ]/s/^/$$(STO)\//' >Makefile.tmp rm deps.tmp mv -f Makefile Makefile.old mv Makefile.tmp Makefile -diff Makefile Makefile.old # generated deps -- do not edit below this line mto/demo.o: demo.c openisis.h mto/ioperf.o: ioperf.c mto/lbt.o: lbt.c lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h mto/lcli.o: lcli.c openisis.h loi.h lio.h luti.h lll.h lcli.h mto/lcs.o: lcs.c luti.h loi.h openisis.h lio.h lll.h lcs.h mto/ldb.o: ldb.c lstr.h lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h \ lcs.h lfdt.h mto/ldsp.o: ldsp.c openisis.h loi.h ldb.h luti.h lll.h ldsp.h lfdt.h mto/lenc.o: lenc.c openisis.h ldsp.h mto/leva.o: leva.c openisis.h ldsp.h mto/lfdt.o: lfdt.c openisis.h loi.h lfdt.h luti.h mto/lfmt.o: lfmt.c ldb.h luti.h loi.h openisis.h lll.h mto/lio.o: lio.c luti.h loi.h openisis.h lses.h lio.h lll.h lstr.h mto/lqry.o: lqry.c ldb.h luti.h loi.h openisis.h lll.h mto/lrec.o: lrec.c ldb.h luti.h loi.h openisis.h lll.h lio.h lcs.h mto/lrectest.o: lrectest.c openisis.h loi.h lfdt.h luti.h mto/lses.o: lses.c lses.h loi.h openisis.h lio.h luti.h lll.h mto/lstb.o: lstb.c openisis.h loi.h lcli.h ldb.h luti.h lll.h ldsp.h \ lfdt.h mto/lstbtest.o: lstbtest.c openisis.h loi.h ldb.h luti.h lll.h mto/lstr.o: lstr.c lstr.h luti.h loi.h openisis.h mto/lsv.o: lsv.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h mto/luti.o: luti.c openisis.h luti.h loi.h mto/mlock.o: mlock.c mto/oipl.o: oipl.c mto/ois.o: ois.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h ldsp.h mto/openisis.o: openisis.c openisis.h lio.h luti.h loi.h lll.h mto/openjsis.o: openjsis.c openisis.h org/openisis/NativeDb.h mto/tpl.o: tpl.c ldb.h luti.h loi.h openisis.h lll.h $(STO)/demo.o: demo.c openisis.h $(STO)/ioperf.o: ioperf.c $(STO)/lbt.o: lbt.c lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h $(STO)/lcli.o: lcli.c openisis.h loi.h lio.h luti.h lll.h lcli.h $(STO)/lcs.o: lcs.c luti.h loi.h openisis.h lio.h lll.h lcs.h $(STO)/ldb.o: ldb.c lstr.h lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h \ lcs.h lfdt.h $(STO)/ldsp.o: ldsp.c openisis.h loi.h ldb.h luti.h lll.h ldsp.h lfdt.h $(STO)/lenc.o: lenc.c openisis.h ldsp.h $(STO)/leva.o: leva.c openisis.h ldsp.h $(STO)/lfdt.o: lfdt.c openisis.h loi.h lfdt.h luti.h $(STO)/lfmt.o: lfmt.c ldb.h luti.h loi.h openisis.h lll.h $(STO)/lio.o: lio.c luti.h loi.h openisis.h lses.h lio.h lll.h lstr.h $(STO)/lqry.o: lqry.c ldb.h luti.h loi.h openisis.h lll.h $(STO)/lrec.o: lrec.c ldb.h luti.h loi.h openisis.h lll.h lio.h lcs.h $(STO)/lrectest.o: lrectest.c openisis.h loi.h lfdt.h luti.h $(STO)/lses.o: lses.c lses.h loi.h openisis.h lio.h luti.h lll.h $(STO)/lstb.o: lstb.c openisis.h loi.h lcli.h ldb.h luti.h lll.h ldsp.h \ lfdt.h $(STO)/lstbtest.o: lstbtest.c openisis.h loi.h ldb.h luti.h lll.h $(STO)/lstr.o: lstr.c lstr.h luti.h loi.h openisis.h $(STO)/lsv.o: lsv.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h $(STO)/luti.o: luti.c openisis.h luti.h loi.h $(STO)/mlock.o: mlock.c $(STO)/oipl.o: oipl.c $(STO)/ois.o: ois.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h ldsp.h $(STO)/openisis.o: openisis.c openisis.h lio.h luti.h loi.h lll.h $(STO)/openjsis.o: openjsis.c openisis.h org/openisis/NativeDb.h $(STO)/tpl.o: tpl.c ldb.h luti.h loi.h openisis.h lll.h