# Makefile for QDBM #================================================================ # Setting Variables #================================================================ # Generic settings SHELL = @SHELL@ srcdir = @srcdir@ VPATH = @srcdir@ SUBDIRS = plus java perl ruby cgi lab bros # Packaging PACKAGE = @PACKAGE_NAME@ VERSION = @PACKAGE_VERSION@ PACKAGEDIR = $(PACKAGE)-$(VERSION) PACKAGETGZ = $(PACKAGE)-$(VERSION).tar.gz # Targets MYHEADS = depot.h curia.h relic.h hovel.h cabin.h villa.h vista.h odeum.h MYLIBOBJS = depot.o curia.o relic.o hovel.o cabin.o villa.o vista.o odeum.o myconf.o MYLIBS = libqdbm.a libqdbm.so.1.0.0 libqdbm.so.1 libqdbm.so MYBINS = dpmgr dptest dptsv crmgr crtest crtsv rlmgr rltest hvmgr hvtest \ cbtest cbcodec vlmgr vltest vltsv odmgr odtest odidx MYMAN3S = qdbm.3 depot.3 dpopen.3 curia.3 cropen.3 relic.3 hovel.3 \ cabin.3 villa.3 vlopen.3 vista.3 odeum.3 odopen.3 MYDOCS = spex.html spex-ja.html COPYING ChangeLog THANKS # Install destinations prefix = @prefix@ exec_prefix = @exec_prefix@ MYHEADDIR = @includedir@ MYLIBDIR = @libdir@ MYBINDIR = @bindir@ MYMAN3DIR = @mandir@/man3 MYSHAREDIR = $(prefix)/share/$(PACKAGE) DESTDIR = # Building binaries CC = gcc RELCFLAGS = -O3 -DNDEBUG CPPFLAGS = -I$(srcdir) @MYDEFS@ -D_GNU_SOURCE \ -D__EXTENSIONS__ -D_POSIX_C_SOURCE=200112 -D__XSI_VISIBLE -DPIC -D_REENTRANT CFLAGS = -Wall -ansi -pedantic -fPIC -fsigned-char $(RELCFLAGS) LD = @LD@ LIBS = -lqdbm @LIBS@ LIBLDFLAGS = @LIBS@ LDFLAGS = -L. $(LIBS) LDENV = LD_RUN_PATH=/lib:/usr/lib:$(MYLIBDIR) AR = @AR@ ARFLAGS = rcsv RUNENV = LD_LIBRARY_PATH=. #================================================================ # Suffix rules #================================================================ .SUFFIXES : .SUFFIXES : .c .o .c.o : $(CC) -c $(CPPFLAGS) $(CFLAGS) $< #================================================================ # Actions #================================================================ targets : @TARGETS@ all : $(MYLIBS) $(MYBINS) @printf '\n' @printf '#================================================================\n' @printf '# Ready to install.\n' @printf '#================================================================\n' static : make LDFLAGS="-static $(LDFLAGS)" all debug : make RELCFLAGS="-g" LDFLAGS="-static $(LDFLAGS)" all devel : make RELCFLAGS="-g -O2 -pipe" all sync ; sync profile : make RELCFLAGS="-pg -g -O2 -Werror -DNDEBUG" LDFLAGS="-static $(LDFLAGS)" all unsigned : make CFLAGS="-Wall -ansi -pedantic -fPIC -funsigned-char -g -O2" all clean : rm -rf $(MYLIBS) $(MYBINS) *.o *.lo *.la a.out .libs \ *.exe *.dll.a *.dll *.dylib *.sl TAGS srcdoc gmon.out leak.log casket casket.* *~ version : sed 's/_QDBM_VERSION.*/_QDBM_VERSION "$(VERSION)"/' myconf.h > myconf.h~ [ -f myconf.h~ ] && mv -f myconf.h~ myconf.h install : mkdir -p $(DESTDIR)$(MYHEADDIR) cd $(srcdir) && cp -Rf $(MYHEADS) $(DESTDIR)$(MYHEADDIR) mkdir -p $(DESTDIR)$(MYLIBDIR) cp -Rf $(MYLIBS) $(DESTDIR)$(MYLIBDIR) mkdir -p $(DESTDIR)$(MYBINDIR) cp -Rf $(MYBINS) $(DESTDIR)$(MYBINDIR) mkdir -p $(DESTDIR)$(MYMAN3DIR) cd $(srcdir)/man && cp -Rf $(MYMAN3S) $(DESTDIR)$(MYMAN3DIR) mkdir -p $(DESTDIR)$(MYSHAREDIR) cd $(srcdir) && cp -Rf $(MYDOCS) $(DESTDIR)$(MYSHAREDIR) @printf '\n' @printf '#================================================================\n' @printf '# Thanks for using QDBM.\n' @printf '#================================================================\n' install-strip : make DESTDIR=$(DESTDIR) install cd $(DESTDIR)$(MYBINDIR) && strip $(MYBINS) uninstall : cd $(DESTDIR)$(MYHEADDIR) && rm -f $(MYHEADS) cd $(DESTDIR)$(MYLIBDIR) && rm -f $(MYLIBS) cd $(DESTDIR)$(MYBINDIR) && rm -f $(MYBINS) cd $(DESTDIR)$(MYMAN3DIR) && rm -f $(MYMAN3S) rm -rf $(DESTDIR)$(MYSHAREDIR) dist : sync ; sync for dir in $(SUBDIRS) ; \ do \ if [ -d $$dir ] ; \ then \ echo Making $@ in $$dir ; \ ( cd $$dir && if [ -f configure.in ] ; then autoconf ; ./configure ; \ make dist ; fi ) ; \ fi ; \ done make version make distclean cd .. && tar cvf - $(PACKAGEDIR) | gzip -c > $(PACKAGETGZ) sync ; sync distclean : clean for dir in $(SUBDIRS) ; \ do \ if [ -d $$dir ] ; \ then \ echo Making $@ in $$dir ; \ ( cd $$dir && if [ -f Makefile ] ; then make distclean ; fi ) ; \ fi ; \ done rm -rf Makefile LTmakefile rpmspec config.cache config.log config.status \ autom4te.cache rpm-tmp *-win32 TAGS : etags -o $@ *.c *.h sdoc : rm -rf srcdoc ./lab/ccdoc -d srcdoc -t "Source Documents of QDBM" *.h *.c check : sync ; sync rm -rf casket* $(RUNENV) ./dptest write casket 50000 5000 $(RUNENV) ./dptest read casket $(RUNENV) ./dptest rcat casket 50000 50 500 32 $(RUNENV) ./dptest combo casket $(RUNENV) ./dptest wicked casket 5000 rm -rf casket* $(RUNENV) ./crtest write casket 50000 500 10 $(RUNENV) ./crtest read casket $(RUNENV) ./crtest rcat casket 50000 5 10 500 32 $(RUNENV) ./crtest combo casket $(RUNENV) ./crtest wicked casket 5000 rm -rf casket* $(RUNENV) ./crtest write -lob casket 1000 50 10 $(RUNENV) ./crtest read -lob casket rm -rf casket* $(RUNENV) ./rltest write casket 50000 $(RUNENV) ./rltest read casket 50000 rm -rf casket* $(RUNENV) ./hvtest write casket 50000 $(RUNENV) ./hvtest read casket 50000 rm -rf casket* $(RUNENV) ./hvtest write -qdbm casket 50000 $(RUNENV) ./hvtest read -qdbm casket 50000 rm -rf casket* $(RUNENV) ./cbtest sort 5000 $(RUNENV) ./cbtest list 50000 $(RUNENV) ./cbtest map 50000 $(RUNENV) ./cbtest wicked 5000 $(RUNENV) ./cbtest misc rm -rf casket* $(RUNENV) ./vltest write -tune 25 64 32 32 casket 50000 $(RUNENV) ./vltest read casket $(RUNENV) ./vltest rdup -tune 25 64 256 256 casket 50000 50000 $(RUNENV) ./vltest combo casket $(RUNENV) ./vltest wicked casket 5000 rm -rf casket* $(RUNENV) ./odtest write casket 500 50 5000 $(RUNENV) ./odtest read casket $(RUNENV) ./odtest combo casket $(RUNENV) ./odtest wicked casket 500 rm -rf casket* @printf '\n' @printf '#================================================================\n' @printf '# Checking completed.\n' @printf '#================================================================\n' world : make clean ; make cd plus ; [ -f Makefile ] || ./configure ; make clean ; make cd java ; [ -f Makefile ] || ./configure ; make clean ; make cd perl ; [ -f Makefile ] || ./configure ; make clean ; make cd ruby ; [ -f Makefile ] || ./configure ; make clean ; make cd cgi ; [ -f Makefile ] || ./configure ; make clean ; make install-world : make install cd plus ; [ -f Makefile ] || ./configure ; make install cd java ; [ -f Makefile ] || ./configure ; make install cd perl ; [ -f Makefile ] || ./configure ; make install cd ruby ; [ -f Makefile ] || ./configure ; make install uninstall-world : make uninstall cd plus ; [ -f Makefile ] || ./configure ; make uninstall cd java ; [ -f Makefile ] || ./configure ; make uninstall cd perl ; [ -f Makefile ] || ./configure ; make uninstall cd ruby ; [ -f Makefile ] || ./configure ; make uninstall check-world : make check cd plus ; [ -f Makefile ] || ./configure ; make check cd java ; [ -f Makefile ] || ./configure ; make check cd perl ; [ -f Makefile ] || ./configure ; make check cd ruby ; [ -f Makefile ] || ./configure ; make check rpm : ../$(PACKAGETGZ) rpmspec mkdir -p rpm-tmp/{BUILD,RPMS,SOURCES,SPECS,SRPMS} mkdir -p rpm-tmp/RPMS/i386 cp ../$(PACKAGETGZ) rpm-tmp/SOURCES rpm -bb --buildroot /tmp/qdbm-root --target i386 rpmspec mv -f rpm-tmp/RPMS/i386/$(PACKAGE)-$(VERSION)* .. rm -rf rpm-tmp win32pkg : make uninstall && make uninstall-win && make clean make mingw && make install-win cd java ; ./configure cd java ; make uninstall && make uninstall-win && make clean cd java ; make mingw cd cgi ; ./configure cd cgi ; make clean cd cgi ; make mingw mkdir -p $(PACKAGE)-$(VERSION)-win32 cp -rf $(MYHEADS) libqdbm.dll.a qdbm.dll *.exe *.html \ misc/README-win32.txt misc/COPYING.txt misc/win32check.bat $(PACKAGE)-$(VERSION)-win32 cp -rf java/jqdbm.dll java/qdbm.jar java/*.html java/japidoc $(PACKAGE)-$(VERSION)-win32 mkdir -p $(PACKAGE)-$(VERSION)-win32/cgi cp -rf cgi/*.cgi cgi/*.conf cgi/*.html $(PACKAGE)-$(VERSION)-win32/cgi zip -r $(PACKAGE)-$(VERSION)-win32.zip $(PACKAGE)-$(VERSION)-win32 mv -f $(PACKAGE)-$(VERSION)-win32.zip .. rm -rf $(PACKAGE)-$(VERSION)-win32 make uninstall && make uninstall-win && make clean cd java ; make uninstall && make uninstall-win && make clean unix : make CC="cc" CPPFLAGS="-I. -DDP_VERSION=\\\"$(VERSION)\\\"" CFLAGS="" \ LDFLAGS="-L. -lqdbm -lc" LDENV="" install-unix : make install uninstall-unix : make uninstall win : make MYLIBS="libqdbm.dll.a" CFLAGS="-Wall -ansi -pedantic -fsigned-char -O3 -DNDEBUG" mingw : make CC="gcc -mno-cygwin" MYLIBS="libqdbm.dll.a" \ CFLAGS="-Wall -fsigned-char -O3 -DNDEBUG" LIBLDFLAGS="" LDFLAGS="-L. -lqdbm" check-win : make check install-win : make MYBINS="`for file in $(MYBINS) ; do echo $$file.exe ; done | tr '\n' ' '`" \ MYLIBS="libqdbm.dll.a" install cp -Rf qdbm.dll "`printf '%s' $$SYSTEMROOT | tr '\\\\' '/'`/SYSTEM32" uninstall-win : make MYBINS="`for file in $(MYBINS) ; do echo $$file.exe ; done | tr '\n' ' '`" \ MYLIBS="libqdbm.dll.a" uninstall rm -f "`printf '%s' $$SYSTEMROOT | tr '\\\\' '/'`/SYSTEM32/qdbm.dll" mac : make MYLIBS="libqdbm.a libqdbm.1.0.0.dylib libqdbm.1.dylib libqdbm.dylib" \ CFLAGS="-Wall -fsigned-char -fno-common -O2 -DNDEBUG" check-mac : make RUNENV="DYLD_LIBRARY_PATH=." check install-mac : make MYLIBS="libqdbm.a libqdbm.1.0.0.dylib libqdbm.1.dylib libqdbm.dylib" install uninstall-mac : make MYLIBS="libqdbm.a libqdbm.1.0.0.dylib libqdbm.1.dylib libqdbm.dylib" uninstall hpux : make MYLIBS="libqdbm.a libqdbm.sl" check-hpux : make RUNENV="SHLIB_PATH=." check install-hpux : make MYLIBS="libqdbm.a libqdbm.sl" install uninstall-hpux : make MYLIBS="libqdbm.a libqdbm.sl" uninstall .PHONY : all clean install check #================================================================ # Building binaries #================================================================ libqdbm.a : $(MYLIBOBJS) $(AR) $(ARFLAGS) $@ $(MYLIBOBJS) libqdbm.so.1.0.0 : $(MYLIBOBJS) if $(LD) -V | grep "GNU" > /dev/null ; \ then \ $(LD) -shared -soname libqdbm.so.1 -o $@ $(MYLIBOBJS) $(LIBLDFLAGS) ; \ else \ $(LD) -G -h libqdbm.so.1 -o $@ $(MYLIBOBJS) $(LIBLDFLAGS) ; \ fi libqdbm.so.1 : libqdbm.so.1.0.0 ln -f -s libqdbm.so.1.0.0 $@ libqdbm.so : libqdbm.so.1.0.0 ln -f -s libqdbm.so.1.0.0 $@ libqdbm.dll.a : qdbm.dll qdbm.dll : $(MYLIBOBJS) $(CC) -shared -o $@ \ -Wl,--out-implib=lib$@.a \ -Wl,--export-all-symbols \ -Wl,--enable-auto-import \ -Wl,--add-stdcall-alias \ -Wl,--whole-archive $(MYLIBOBJS) \ -Wl,--no-whole-archive $(LIBLDFLAGS) libqdbm.1.0.0.dylib : $(CC) -dynamiclib -o $@ \ -install_name libqdbm.1.dylib \ -current_version 1.0.0 \ -compatibility_version 1.0 \ $(MYLIBOBJS) $(LIBLDFLAGS) libqdbm.1.dylib : libqdbm.1.0.0.dylib ln -f -s libqdbm.1.0.0.dylib $@ libqdbm.dylib : libqdbm.1.0.0.dylib ln -f -s libqdbm.1.0.0.dylib $@ libqdbm.sl : $(MYLIBOBJS) $(LD) -b -o $@ $(MYLIBOBJS) $(LIBLDFLAGS) dpmgr : dpmgr.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ dpmgr.o $(LDFLAGS) dptest : dptest.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ dptest.o $(LDFLAGS) dptsv : dptsv.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ dptsv.o $(LDFLAGS) crmgr : crmgr.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ crmgr.o $(LDFLAGS) crtest : crtest.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ crtest.o $(LDFLAGS) crtsv : crtsv.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ crtsv.o $(LDFLAGS) rlmgr : rlmgr.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ rlmgr.o $(LDFLAGS) rltest : rltest.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ rltest.o $(LDFLAGS) hvmgr : hvmgr.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ hvmgr.o $(LDFLAGS) hvtest : hvtest.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ hvtest.o $(LDFLAGS) cbtest : cbtest.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ cbtest.o $(LDFLAGS) cbcodec : cbcodec.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ cbcodec.o $(LDFLAGS) vlmgr : vlmgr.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ vlmgr.o $(LDFLAGS) vltest : vltest.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ vltest.o $(LDFLAGS) vltsv : vltsv.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ vltsv.o $(LDFLAGS) odmgr : odmgr.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ odmgr.o $(LDFLAGS) odtest : odtest.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ odtest.o $(LDFLAGS) odidx : odidx.o $(MYLIBS) $(LDENV) $(CC) $(CFLAGS) -o $@ odidx.o $(LDFLAGS) depot.o dpmgr.o dptest.o dptsv.o : depot.h myconf.h curia.o crmgr.o crtest.o crtsv.o : curia.h depot.h myconf.h relic.o rlmgr.o rltest.o : relic.h depot.h myconf.h hovel.o hvmgr.o hvtest.o : hovel.h depot.h curia.h myconf.h cabin.o cbtest.o cbcodec.o : cabin.h myconf.h villa.o vlmgr.o vltest.o vltsv.o : villa.h depot.h cabin.h myconf.h vista.o : vista.h villa.h depot.h curia.h cabin.h myconf.h odeum.o odmgr.o odtest.o odidx.o : odeum.h depot.h curia.h cabin.h villa.h myconf.h myconf.o : myconf.h # END OF FILE