3 # openisis - an open implementation of the CDS/ISIS database
4 # Version 0.8.x (patchlevel see file Version)
5 # Copyright (C) 2001-2003 by Erik Grziwotz, erik@openisis.org
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # see README for more information
25 # $Id: Makefile,v 1.92 2003/06/30 09:59:35 kripke Exp $
31 # some require explicit ST or MT build, other targets work with both
32 # O switchable directory for binaries; one of
33 # sto for single threaded unix (used by Perl, PHP, Tcl)
34 # mto for multi threaded unix (used by Java, Tcl)
35 # win for gates of hell (used by general failure)
47 # don't support MT on windows -- Java or PHP must connect server
58 BINARY=$(O)/openisis$(EXE)
59 JTARGETS=openisis.jar mto/libopenjsis.so
61 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
62 # object files in server lib
68 # additional utilities requiring at least basic j2ee libs javax.mail, org.xml
69 # you might have to add something like that to your CLASSPATH
70 # /opt/tomcat/common/lib/mail.jar:/opt/tomcat/common/lib/activation.jar:/opt/tomcat/common/lib/xerces.jar
71 EECLASSES=Mail RecToXml XmlToRec XmlTest
73 CLASSES=Field Rec Db NativeDb PureDb Test Charset Fdt \
74 PlainSerializer Utils $(EECLASSES)
75 XSUB=perl/blib/arch/auto/OpenIsis/OpenIsis.so
77 # standard make defines
81 # you may want to try jikes
84 # figure out where to find JNI ...
87 JAVAHOME=/usr/java/jdk1.3
89 JNIINC=-I$(JAVAHOME)/include -I$(JAVAHOME)/include/linux
94 RUNJAVA=LD_LIBRARY_PATH=mto java -classpath openisis.jar:$(CLASSPATH)
97 JTARGETS=openisis.jar openjsis.dll
98 # Note that console output redirection doesn't work well
99 # older wine 20010731 often croaks "FIXME:pthread_rwlock_rdlock"
100 # since 200111*, console output didn't work at all
101 # some versions should support wine -console tty
102 OPENISIS=wine -- win/openisis
120 # note that -O is necessary for -Wuninitialized warnings
127 CFLAGS=$(DBG) -O2 -Wall -W -Wshadow -pedantic -Wno-long-long $(PIC)
131 # ############################# link ##################################
132 # common linker flags
135 # link statically from openisis.a
136 # do not use -static, since we don't want to slurp in libc
139 # create shared object
140 LDSHARED=$(LDFLAGS) -shared -Wl,-init,openIsisInit,-fini,openIsisFini
142 # link using shared object - the default
146 ifeq (solaris,$(OSTYPE))
148 SYSLIBS=-lrt -lsocket -lnsl
153 # DB to use -- define DB for db/DB/DB, or DBDIR for other path
161 # single and multi threaded objects
162 STOBJS=$(LOBJS:l%=$(STO)/l%)
163 MTOBJS=$(LOBJS:l%=mto/l%)
167 # ############################# targets ##################################
169 # standard default target
172 .PHONY: all clean run demo lstbtest lrectest perl jar java jdoc tcl tk
173 # do not delete intermediates
174 .PRECIOUS: org/openisis/%.java %.class %.h
177 rm -rf sto mto win *.jar *.tmp *.exp org/openisis/*.class core jdoc Makefile.old testout.txt
178 [ ! -f perl/Makefile ] || make -C perl clean
181 $(O)/libopenisis.a: $(LOBJS:l%=$(O)/l%)
182 $(AR) $(ARFLAGS) $@ $^
185 $(O)/libopenisis.so: $(LOBJS:l%=$(O)/l%)
186 $(CC) $(LDSHARED) $(LDLIBS) -o $@ $^
188 $(O)/liboisrv.a: $(LSVOBJS)
189 $(AR) $(ARFLAGS) $@ $^
192 $(O)/openisis$(EXE): $(O)/openisis.o $(O)/libopenisis.a
193 $(CC) $(DBG) $(LDSTATIC) $(LDLIBS) $(MTLIBS) -o $@ $^
195 shared: $(O)/openisis.o $(O)/libopenisis.so
196 $(CC) $(DBG) $(LDDYNAM) -o $(O)/openisis $^
199 @ $(MAKE) --no-print-directory WIN32=sorry
203 # ########################## demos and tests ###############################
206 $(O)/demo -db $(DBDIR) 42
208 $(O)/demo: $(O)/demo.o $(O)/libopenisis.a
209 $(CC) $(DBG) -o $@ $^
211 lrectest: $(O)/lrectest
214 $(O)/lrectest: $(O)/lrectest.o $(O)/libopenisis.a
215 $(CC) $(DBG) $(LDLIBS) -o $@ $^
217 lstbtest: $(O)/lstbtest
220 $(O)/lstbtest: $(O)/lstbtest.o $(O)/libopenisis.a
221 $(CC) $(DBG) $(LDLIBS) -o $@ $^
224 $(CC) $(CPPFLAGS) $(CFLAGS) -rdynamic -ldl -o $@ $^
229 $(O)/ois: $(O)/ois.o $(O)/libopenisis.a $(O)/liboisrv.a
230 $(CC) $(LDSTATIC) $^ $(LDLIBS) $(MTLIBS) -o $@
234 $(OPENISIS) -v $${V:-warn} -db $(DBDIR) $(FMT) 2>&1 | less
237 $(OPENISIS) -v $${V:-warn} -db $(DBDIR) $(FMT)
240 $(OPENISIS) -v $${V:-warn} -db $(DBDIR) $(FMT) | recode 850/..Latin-1
243 $(OPENISIS) -v $${V:-warn} -db $(DBDIR) -check
246 $(OPENISIS) -v $${V:-warn} -search 'development$$' -db $(DBDIR) $(FMT) 2>&1 | less
248 searchdump: $(BINARY)
249 $(OPENISIS) -v $${V:-warn} -search '$$' -db $(DBDIR) $(FMT) 2>&1
252 $(OPENISIS) -v $${V:-warn} -terms '$$' -db $(DBDIR) $(FMT) 2>&1 | less
255 $(OPENISIS) -scan development -fmt prop -db $(DBDIR) >testout.txt
256 $(OPENISIS) -terms '$$' -fmt prop -db $(DBDIR) >>testout.txt
257 $(OPENISIS) -search 'devel$$' -fmt mfnf -db $(DBDIR) >>testout.txt
258 diff testout.txt testres.txt
261 time $(OPENISIS) -v $${V:-warn} -crash 'Z$$' -db db/unesb/unesb
263 searchtest: $(BINARY)
264 $(OPENISIS) -v $${V:-warn} -fmt mfnf -search 'a$$' -db $(DBDIR) $(FMT) >testout.txt
265 diff testout.txt searchtest.txt
268 $(OPENISIS) -v $${V:-warn} -search 'Dacca' -db $(DBDIR) \
269 -pft "$${PFT:-`cat test.pft`}"
272 LD_LIBRARY_PATH=$(O) $(OPENISIS) -v $${V:-debug} -search development -db $(DBDIR) $(FMT) 2>&1 | less
277 time $(OPENISIS) -perf 100000 -db $(DBDIR) >/dev/null
280 # time results for the unesb perf test differ dramatically
281 # depending on the working of operating system caching
282 # you may achive about 0.40 sec (12.000 recs per sec)
283 # but immediatly after timing the cds,
284 # the same test may take more than 40 sec
287 time $(OPENISIS) -perf 5000 -db db/unesb/unesb >/dev/null
289 time $(OPENISIS) -fmt mfnf -search 'k$$' -db db/unesb/unesb >/dev/null
294 # ############################# perl ##################################
299 : ++++++++++++++++++++++++++++++++++++++++++++++++++++++
300 : +++ as root in the perl subdir, run 'make install' +++
301 : ++++++++++++++++++++++++++++++++++++++++++++++++++++++
304 @$(MAKE) -C perl test
306 perl/Makefile: perl/Makefile.PL
307 cd perl && perl Makefile.PL
309 # perl's Makefile doesn't know all deps
310 $(XSUB): perl/OpenIsis.pm perl/OpenIsis.xs openisis.h $(STO)/libopenisis.a perl/Makefile
311 @-[ ! -f perl/OpenIsis.c ] || rm perl/OpenIsis.c
314 # standalone tree with OpenIsis module
316 @-[ -d perl/tmptree/auto/OpenIsis ] || mkdir -p perl/tmptree/auto/OpenIsis
317 cp -p perl/OpenIsis.pm perl/tmptree
318 cp -p $(XSUB) perl/tmptree/auto/OpenIsis
319 - strip perl/tmptree/auto/OpenIsis/OpenIsis.so
326 # ############################# tcl ##################################
328 tcl: $(O)/libopenisis.a
329 @$(MAKE) -C tcl bin/isish
331 tk: $(O)/libopenisis.a
332 @$(MAKE) -C tcl bin/wisish
342 # ############################# java ##################################
349 org.openisis.Test -v $${V:-warn} -db $(DBDIR) -encoding Cp850 \
351 -search development \
357 diff testout.txt jtest.txt
361 org.openisis.Test -v $${V:-warn} -dbpath db/unesb -db unesb \
364 # print in cds1.pft format
367 org.openisis.Test -v $${V:-warn} -db $(DBDIR) -encoding Cp850 \
372 org.openisis.Test -search 'a$$' -v $${V:-warn} \
373 -db db/unesb/unesb >/dev/null
377 org.openisis.Test -v 9 -db $(DBDIR) 2>&1 | less
381 org.openisis.Test -v 9 -db $(DBDIR) -write
385 echo please be shure to have org.xml. stuff in your CLASSPATH
389 -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser \
390 org.openisis.XmlTest $${testxml:-test.xml}
393 # -overview overview.html
398 -encoding ISO-8859-1 \
404 -windowtitle 'org.openisis source code documentation' \
405 -doctitle 'org.openisis source code documentation' \
406 -header 'org.openisis source code documentation' \
407 -footer 'this is <b>public</b> material' \
408 -bottom 'for <b>your</b> eyes only' \
409 -stylesheetfile jdocstyle.css \
410 -charset "iso-8859-1" \
416 org.openisis.Charset -utf8seq >db/charset/charset.seq
417 mx seq=db/charset/charset.seq create=db/charset/charset -all now tell=1
418 mx db/charset/charset fst='1 1 MHL,V1' \
419 ln1=db/charset/charset.lk1 ln2=db/charset/charset.lk2 +fix -all now tell=1
420 ifload db/charset/charset db/charset/charset.lk1 db/charset/charset.lk2 \
421 +fix tell=1 -reset -balan
425 # make additional ee classes
426 j2ee: openisis.jar $(EECLASSES:%=org/openisis/%.class)
429 # openisis.jar: $(foreach cls,$(CLASSES),org/openisis/$(cls).class)
430 openisis.jar: $(CLASSES:%=org/openisis/%.class)
431 jar cvf $@ org/openisis/*.class
434 $(JC) -classpath .:$(CLASSPATH) $<
437 javah -jni -o $@ $(subst /,.,$*)
440 mto/libopenjsis.so: openjsis.c $(MTOBJS)
443 mto/openjsis.o: openjsis.c
444 @- [ -d mto ] || mkdir mto
445 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(MTFLAGS) $(JNIINC) -o $@ $<
447 mto/libopenjsis.so: mto/openjsis.o mto/libopenisis.a
448 $(CC) $(LDSHARED) -o $@ $^
452 $(CC) -mdll -o junk.tmp -Wl,--base-file,$*.tmp $($*_deps)
453 dlltool --dllname $@ --base-file $*.tmp \
454 --output-exp $*.exp --input-def $*.def
455 dlltool --dllname $@ --input-def $*.def \
457 gcc -mdll -mconsole -o $@ $($*_deps) -Wl,$*.exp,--enable-stdcall-fixup
459 # dependences of win32 dlls
460 # note on cross-builds: make sure you have the proper jni headers included -
461 # those supplied for the target platform
462 openjsis_deps=openjsis.o $(LOBJS)
463 openjsis.dll: $(openjsis_deps)
467 # ############################# rules ##################################
469 # $@ target $^ all prerequisites $? newer $< first $* stem
472 @- [ -d mto ] || mkdir mto
473 $(CC) -c $(CPPFLAGS) $(MTFLAGS) $(CFLAGS) -o $@ $<
477 @- [ -d $(STO) ] || mkdir $(STO)
478 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
481 # maintenance targets ... most need a posix shell
483 : +++ enter checkin message +++
484 -read msg && ci -l -m"$$msg" *
487 echo "OpenIsis `$(OPENISIS) -version`" >Version
488 ./lscvs -lr | sort >>Version
491 @-[ -d tar ] || mkdir tar
492 ./lscvs -r | sort | tar czvfT tar/openisis.`$(OPENISIS) -version`.tgz -
495 @-[ -d tar ] || mkdir tar
496 tar czvf tar/oi`date +%y%m%d`.tgz . --exclude CVS --exclude tar --exclude WEB-INF
499 for f in *.h *.c */*.h */*.c perl/*.xs org/openisis/*.java; do \
500 cat Header.txt >$$f.tmp; \
501 sed -e '1,/^EOH/d' $$f >>$$f.tmp; \
504 for f in `grep -rl '^#EOH' .`; do \
505 head -n 1 $$f >$$f.tmp; \
506 sed -e 's/^/#/' Header.txt >>$$f.tmp; \
507 sed -e '1,/^#EOH/d' $$f >>$$f.tmp; \
513 # please do not try to make deps w/o sed, gcc and mv ...
515 gcc -MM `./lscvs |grep '\.c$$' |sort` >deps.tmp
516 sed -n -e '1,/^# generated deps/p' Makefile >Makefile.tmp
517 sed -e '/^[^ ]/s/^/mto\//' <deps.tmp >>Makefile.tmp
518 sed -e '/^[^ ]/s/^/$$(STO)\//' <deps.tmp >>Makefile.tmp
520 mv -f Makefile Makefile.old
521 mv Makefile.tmp Makefile
522 -diff Makefile Makefile.old
524 # generated deps -- do not edit below this line
525 mto/demo.o: demo.c openisis.h
526 mto/ioperf.o: ioperf.c
527 mto/lbt.o: lbt.c lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h
528 mto/lcli.o: lcli.c openisis.h loi.h lio.h luti.h lll.h lcli.h
529 mto/lcs.o: lcs.c luti.h loi.h openisis.h lio.h lll.h lcs.h
530 mto/ldb.o: ldb.c lstr.h lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h \
532 mto/ldsp.o: ldsp.c openisis.h loi.h ldb.h luti.h lll.h ldsp.h lfdt.h
533 mto/lenc.o: lenc.c openisis.h ldsp.h
534 mto/leva.o: leva.c openisis.h ldsp.h
535 mto/lfdt.o: lfdt.c openisis.h loi.h lfdt.h luti.h
536 mto/lfmt.o: lfmt.c ldb.h luti.h loi.h openisis.h lll.h
537 mto/lio.o: lio.c luti.h loi.h openisis.h lses.h lio.h lll.h lstr.h
538 mto/lqry.o: lqry.c ldb.h luti.h loi.h openisis.h lll.h
539 mto/lrec.o: lrec.c ldb.h luti.h loi.h openisis.h lll.h lio.h lcs.h
540 mto/lrectest.o: lrectest.c openisis.h loi.h lfdt.h luti.h
541 mto/lses.o: lses.c lses.h loi.h openisis.h lio.h luti.h lll.h
542 mto/lstb.o: lstb.c openisis.h loi.h lcli.h ldb.h luti.h lll.h ldsp.h \
544 mto/lstbtest.o: lstbtest.c openisis.h loi.h ldb.h luti.h lll.h
545 mto/lstr.o: lstr.c lstr.h luti.h loi.h openisis.h
546 mto/lsv.o: lsv.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h
547 mto/luti.o: luti.c openisis.h luti.h loi.h
550 mto/ois.o: ois.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h ldsp.h
551 mto/openisis.o: openisis.c openisis.h lio.h luti.h loi.h lll.h
552 mto/openjsis.o: openjsis.c openisis.h org/openisis/NativeDb.h
553 mto/tpl.o: tpl.c ldb.h luti.h loi.h openisis.h lll.h
554 $(STO)/demo.o: demo.c openisis.h
555 $(STO)/ioperf.o: ioperf.c
556 $(STO)/lbt.o: lbt.c lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h
557 $(STO)/lcli.o: lcli.c openisis.h loi.h lio.h luti.h lll.h lcli.h
558 $(STO)/lcs.o: lcs.c luti.h loi.h openisis.h lio.h lll.h lcs.h
559 $(STO)/ldb.o: ldb.c lstr.h lio.h luti.h loi.h openisis.h lll.h lbt.h ldb.h \
561 $(STO)/ldsp.o: ldsp.c openisis.h loi.h ldb.h luti.h lll.h ldsp.h lfdt.h
562 $(STO)/lenc.o: lenc.c openisis.h ldsp.h
563 $(STO)/leva.o: leva.c openisis.h ldsp.h
564 $(STO)/lfdt.o: lfdt.c openisis.h loi.h lfdt.h luti.h
565 $(STO)/lfmt.o: lfmt.c ldb.h luti.h loi.h openisis.h lll.h
566 $(STO)/lio.o: lio.c luti.h loi.h openisis.h lses.h lio.h lll.h lstr.h
567 $(STO)/lqry.o: lqry.c ldb.h luti.h loi.h openisis.h lll.h
568 $(STO)/lrec.o: lrec.c ldb.h luti.h loi.h openisis.h lll.h lio.h lcs.h
569 $(STO)/lrectest.o: lrectest.c openisis.h loi.h lfdt.h luti.h
570 $(STO)/lses.o: lses.c lses.h loi.h openisis.h lio.h luti.h lll.h
571 $(STO)/lstb.o: lstb.c openisis.h loi.h lcli.h ldb.h luti.h lll.h ldsp.h \
573 $(STO)/lstbtest.o: lstbtest.c openisis.h loi.h ldb.h luti.h lll.h
574 $(STO)/lstr.o: lstr.c lstr.h luti.h loi.h openisis.h
575 $(STO)/lsv.o: lsv.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h
576 $(STO)/luti.o: luti.c openisis.h luti.h loi.h
577 $(STO)/mlock.o: mlock.c
578 $(STO)/oipl.o: oipl.c
579 $(STO)/ois.o: ois.c lsv.h loi.h openisis.h lio.h luti.h lll.h lses.h ldsp.h
580 $(STO)/openisis.o: openisis.c openisis.h lio.h luti.h loi.h lll.h
581 $(STO)/openjsis.o: openjsis.c openisis.h org/openisis/NativeDb.h
582 $(STO)/tpl.o: tpl.c ldb.h luti.h loi.h openisis.h lll.h