Commit a84ff919 authored by Charles Plessy's avatar Charles Plessy

Imported Upstream version 2.3.3-4~dfsg

parent a3ee9b3a
......@@ -37,6 +37,9 @@ SUBDIRS = \
libs \
tools
# common targets for non-leaf Makefiles; must follow a definition of SUBDIRS
include $(TOP)/build/Makefile.targets
default: $(SUBDIRS)
test: $(SUBDIRS)
......@@ -49,51 +52,19 @@ $(SUBDIRS) test:
#-------------------------------------------------------------------------------
# all
#
SUBDIRS_ALL = $(addsuffix _all,$(SUBDIRS))
all: $(SUBDIRS_ALL)
$(SUBDIRS_ALL):
@ $(MAKE) -C $(subst _all,,$@) all
.PHONY: all $(SUBDIRS_ALL)
#-------------------------------------------------------------------------------
# std
#
SUBDIRS_STD = $(addsuffix _std,$(SUBDIRS))
std: $(SUBDIRS_STD)
$(SUBDIRS_STD):
@ $(MAKE) -C $(subst _std,,$@) std
.PHONY: std $(SUBDIRS_STD)
#-------------------------------------------------------------------------------
# clean
#
SUBDIRS_CLEAN = $(addsuffix _clean,$(SUBDIRS_ALL))
clean: $(SUBDIRS_CLEAN)
$(SUBDIRS_CLEAN):
@ $(MAKE) -s -C $(subst _all_clean,,$@) clean
.PHONY: clean $(SUBDIRS_CLEAN)
#-------------------------------------------------------------------------------
# runtests
#
SUBDIRS_RUNTESTS = $(addsuffix _runtests, libs tools test)
runtests: std $(SUBDIRS_RUNTESTS)
$(SUBDIRS_RUNTESTS):
@ $(MAKE) -C $(subst _runtests,,$@) runtests
clean: clean_test
.PHONY: runtests $(SUBDIRS_RUNTESTS)
clean_test:
#-------------------------------------------------------------------------------
# pass-through targets
......
......@@ -131,19 +131,18 @@ MAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \
TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(OBJDIR) -f $(SRCDIR)/Makefile
# directory and link creation
SUBDIRS = bin test-bin ilib lib mod wmod
SUBDIRS = bin test-bin ilib lib
OUTDIRS = schema
# clean rules
stdclean:
@ -rm -rf $(OBJDIR)
@ rm -rf $(addsuffix .vers.h,$(ALL_TOOLS) $(ALL_LIBS)) \
$(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \
@ rm -rf $(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \
$(addsuffix .*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \
$(addsuffix .*,$(addprefix $(MODDIR)/,$(ALL_LIBS))) \
$(addsuffix .*,$(addprefix $(WMODDIR)/,$(ALL_LIBS))) \
$(addsuffix *,$(addprefix $(BINDIR)/,$(ALL_TOOLS) $(ALL_LIBS))) \
$(addsuffix *,$(addprefix $(TEST_BINDIR)/,$(TEST_TOOLS)))
$(addsuffix *,$(addprefix $(TEST_BINDIR)/,$(ALL_TOOLS) $(TEST_TOOLS)))
# removing symbolic links that point to specific builds
removelinks:
......@@ -308,10 +307,12 @@ LDFLAGS = $(DBG) $(PROF) $(CARCH)
#-------------------------------------------------------------------------------
# runtests
#
# MallocScribble=1 is for catching allocation problems on Mac
#
ifeq ($(RUNTESTS_OVERRIDE),)
runtests: std $(TEST_TOOLS)
@ echo "$0 $*"; export LD_LIBRARY_PATH=$(LIBDIR);\
@ echo "$0 $*"; export LD_LIBRARY_PATH=$(LIBDIR);export MallocScribble=1;\
for i in $(TEST_TOOLS);\
do\
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\
......@@ -321,3 +322,22 @@ runtests: std $(TEST_TOOLS)
.PHONY: runtests
endif
#-------------------------------------------------------------------------------
# buildtests
#
buildtests: std $(TEST_TOOLS) $(SLOW_TEST_TOOLS)
#-------------------------------------------------------------------------------
# slowtests
#
slowtests: std $(SLOW_TEST_TOOLS)
@ echo "$0 $*"; export LD_LIBRARY_PATH=$(LIBDIR);\
for i in $(SLOW_TEST_TOOLS);\
do\
echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\
echo Run $(TEST_BINDIR)/$$i;eval $(TEST_BINDIR)/$$i;r=$$?; \
if [ "$$r" != "0" ] ; then exit $$r; fi; \
done
.PHONY: slowtests buildtests
......@@ -104,17 +104,6 @@ else
SRCDIR=$(TOP)
endif
# set OUTDIR
ifndef OUTDIR
OUTDIR = $(shell test -f $(TOP)/build/OUTDIR && mv $(TOP)/build/OUTDIR $(TOP)/build/OUTDIR.$(BUILD_OS); test -f $(TOP)/build/OUTDIR.$(BUILD_OS) && cat $(TOP)/build/OUTDIR.$(BUILD_OS) || echo $(TOP))
ifeq (,$(OUTDIR))
OUTDIR = $(TOP)
endif
ifeq (.,$(OUTDIR))
OUTDIR = $(TOP)
endif
endif
# set COMP, LNKG and BUILD
COMP = $(shell test -f $(TOP)/build/COMP && mv $(TOP)/build/COMP $(TOP)/build/COMP.$(OS); test -f $(TOP)/build/COMP.$(OS) && cat $(TOP)/build/COMP.$(OS) || echo gcc)
LNKG = $(shell test -f $(TOP)/build/STATIC && mv $(TOP)/build/STATIC $(TOP)/build/LNKG.$(OS) && echo stat > $(TOP)/build/LNKG.$(OS); test -f $(TOP)/build/LNKG.$(OS) && cat $(TOP)/build/LNKG.$(OS) || echo stat)
......@@ -132,6 +121,17 @@ endif
endif
# set OUTDIR
ifndef OUTDIR
OUTDIR = $(shell test -f $(TOP)/build/OUTDIR && mv $(TOP)/build/OUTDIR $(TOP)/build/OUTDIR.$(BUILD_OS); test -f $(TOP)/build/OUTDIR.$(BUILD_OS) && cat $(TOP)/build/OUTDIR.$(BUILD_OS) || echo $(TOP))
ifeq (,$(OUTDIR))
OUTDIR = $(TOP)
endif
endif
ifeq (,$(ROUTDIR))
ROUTDIR = $(RHOME)
endif
# OS flavor is normally OS
OSFLAV = $(OS)
......
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software/database is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the author's official duties as a United States Government employee and
# thus cannot be copyrighted. This software/database is freely available
# to the public for use. The National Library of Medicine and the U.S.
# Government have not placed any restriction on its use or reproduction.
#
# Although all reasonable efforts have been taken to ensure the accuracy
# and reliability of the software and data, the NLM and the U.S.
# Government do not and cannot warrant the performance or results that
# may be obtained by using this software or data. The NLM and the U.S.
# Government disclaim all warranties, express or implied, including
# warranties of performance, merchantability or fitness for any particular
# purpose.
#
# Please cite the author in any work or product based on this material.
#
# ===========================================================================
# defines make targets commonly used in non-leaf directories:
# default
# all
# std
# clean
# buildtests
# runtests
# slowtests
#
# requires $(SUBDIRS) to be defined
#
# to control which subdirectories are affected by a specific target, define
# SUBDIRS_CLEAN, SUBDIRS_RUNTESTS, etc., like this:
# SUBDIRS_CLEAN = $(addsuffix _clean, du4r1 dir2 dir3)
#
default: $(SUBDIRS)
#-------------------------------------------------------------------------------
# all
#
SUBDIRS_ALL ?= $(addsuffix _all,$(SUBDIRS))
all: $(SUBDIRS_ALL)
$(SUBDIRS_ALL):
@ $(MAKE) -C $(subst _all,,$@) all
.PHONY: all $(SUBDIRS_ALL)
#-------------------------------------------------------------------------------
# std
#
SUBDIRS_STD = $(addsuffix _std,$(SUBDIRS))
std: $(SUBDIRS_STD)
$(SUBDIRS_STD):
@ $(MAKE) -C $(subst _std,,$@) std
.PHONY: std $(SUBDIRS_STD)
#-------------------------------------------------------------------------------
# clean
#
SUBDIRS_CLEAN ?= $(addsuffix _clean,$(SUBDIRS))
clean: $(SUBDIRS_CLEAN)
$(SUBDIRS_CLEAN):
@ $(MAKE) -s -C $(subst _clean,,$@) clean
.PHONY: clean $(SUBDIRS_CLEAN)
#-------------------------------------------------------------------------------
# runtests
#
SUBDIRS_RUNTESTS ?= $(addsuffix _runtests,$(SUBDIRS))
runtests: std $(SUBDIRS_RUNTESTS)
$(SUBDIRS_RUNTESTS):
@ $(MAKE) -s -C $(subst _runtests,,$@) runtests
.PHONY: runtests $(SUBDIRS_RUNTESTS)
#-------------------------------------------------------------------------------
# buildtests
#
SUBDIRS_BUILDTESTS ?= $(addsuffix _buildtests, $(SUBDIRS))
buildtests: std $(SUBDIRS_BUILDTESTS)
$(SUBDIRS_BUILDTESTS):
@ $(MAKE) -C $(subst _buildtests,,$@) buildtests
.PHONY: buildtests $(SUBDIRS_BUILDTESTS)
#-------------------------------------------------------------------------------
# slowtests
#
SUBDIRS_SLOWTESTS ?= $(addsuffix _slowtests, $(SUBDIRS))
slowtests: $(SUBDIRS_SLOWTESTS)
$(SUBDIRS_SLOWTESTS):
@ $(MAKE) -C $(subst _slowtests,,$@) slowtests
.PHONY: slowtests $(SUBDIRS_SLOWTESTS)
......@@ -66,8 +66,9 @@ KPROC=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
THREADS=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
KRYPTO=$(expr $MODE % 2)
CRYPTO=$(expr $MODE / 2)
HAVE_M=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
HAVE_XML=$(expr $MODE % 2)
# decode SCMFLAGS
CHECKSUM=$(expr $SCMFLAGS % 2)
......
......@@ -69,7 +69,7 @@ CMD="$CMD $OBJS"
SLIBS=''
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
DEPS="$SRCDIR/Makefile"
if [ "$LIBS" != "" ]
then
# tack on paths
......@@ -274,6 +274,18 @@ then
CMD="$CMD -lpthread"
fi
# add in xml
if [ $HAVE_XML -ne 0 ]
then
CMD="$CMD -lxml2"
fi
# add in math library
if [ $HAVE_M -ne 0 ]
then
CMD="$CMD -lm"
fi
# produce shared library
echo "$CMD"
$CMD || exit $?
......
......@@ -288,6 +288,18 @@ then
CMD="$CMD -lpthread"
fi
# add in xml
if [ $HAVE_XML -ne 0 ]
then
CMD="$CMD -lxml2"
fi
# add in math library
if [ $HAVE_M -ne 0 ]
then
CMD="$CMD -lm"
fi
# produce shared library
echo $CMD
$CMD || exit $?
......
......@@ -63,8 +63,8 @@ convert-static ()
local m=
for m in $mbrs
do
mv $m $NAME-$m
CMD="$CMD ld-tmp/$NAME-$m"
mv $m $LIBNAME-$m
CMD="$CMD ld-tmp/$LIBNAME-$m"
done
# return to prior location
......@@ -87,7 +87,7 @@ CMD="$CMD $OBJS"
SLIBS=''
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
DEPS="$SRCDIR/Makefile"
if [ "$LIBS" != "" ]
then
# tack on libraries, finding as we go
......
......@@ -66,8 +66,9 @@ KPROC=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
THREADS=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
KRYPTO=$(expr $MODE % 2)
CRYPTO=$(expr $MODE / 2)
HAVE_M=$(expr $MODE % 2)
MODE=$(expr $MODE / 2)
HAVE_XML=$(expr $MODE % 2)
# decode SCMFLAGS
CHECKSUM=$(expr $SCMFLAGS % 2)
......
......@@ -63,8 +63,36 @@ CMD="$DLIB_CMD $LDFLAGS"
# tack on object files
CMD="$CMD $OBJS"
# function to convert an archive into individual object files
convert-static ()
{
# list members
local path="$1"
local mbrs="$(ar -t $path | grep -v '__.SYMDEF SORTED')"
# unpack archive into temporary directory
mkdir -p ld-tmp
if ! cd ld-tmp
then
echo "$SELF_NAME: failed to cd to ld-tmp"
exit 5
fi
ar -x "$path"
# rename and add to source files list
local m=
for m in $mbrs
do
mv $m $LIBNAME-$m
CMD="$CMD ld-tmp/$LIBNAME-$m"
done
# return to prior location
cd - > /dev/null
}
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
DEPS="$SRCDIR/Makefile"
if [ "$LIBS" != "" ]
then
# tack on paths
......@@ -129,9 +157,10 @@ then
DEPS="$DEPS $LIBPATH"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME-static"
# load-static
# load-all-symbols
# CMD="$CMD -l$LIBNAME-static"
convert-static "$LIBPATH" || exit $?
fi
fi
......@@ -149,9 +178,10 @@ then
DEPS="$DEPS $LIBPATH"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
# load-static
# load-all-symbols
# CMD="$CMD -l$LIBNAME"
convert-static "$LIBPATH" || exit $?
fi
fi
......@@ -201,9 +231,10 @@ then
DEPS="$DEPS $LIBPATH"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME-static"
# load-static
# load-all-symbols
# CMD="$CMD -l$LIBNAME-static"
convert-static "$LIBPATH" || exit $?
fi
......@@ -220,9 +251,10 @@ then
DEPS="$DEPS $LIBPATH"
# load static
load-static
load-all-symbols
CMD="$CMD -l$LIBNAME"
# load-static
# load-all-symbols
# CMD="$CMD -l$LIBNAME"
convert-static "$LIBPATH" || exit $?
fi
fi
......@@ -303,10 +335,25 @@ then
CMD="$CMD -lpthread"
fi
# add in xml
if [ $HAVE_XML -ne 0 ]
then
CMD="$CMD -lxml2"
fi
# add in math library
if [ $HAVE_M -ne 0 ]
then
CMD="$CMD -lm"
fi
# produce shared library
echo "$CMD"
$CMD || exit $?
# remove temporaries
rm -rf ld-tmp
# produce dependencies
if [ "$DEPFILE" != "" ]
then
......
......@@ -316,6 +316,18 @@ then
CMD="$CMD -lpthread"
fi
# add in xml
if [ $HAVE_XML -ne 0 ]
then
CMD="$CMD -lxml2"
fi
# add in math library
if [ $HAVE_M -ne 0 ]
then
CMD="$CMD -lm"
fi
# produce shared library
echo $CMD
$CMD || exit $?
......
......@@ -62,8 +62,8 @@ convert-static ()
local m=
for m in $mbrs
do
mv $m $NAME-$m
CMD="$CMD ld-tmp/$NAME-$m"
mv $m $LIBNAME-$m
CMD="$CMD ld-tmp/$LIBNAME-$m"
done
# return to prior location
......@@ -83,7 +83,7 @@ fi
CMD="$CMD $OBJS"
# initial dependency upon Makefile and vers file
DEPS="$SRCDIR/Makefile $VERSFILE"
DEPS="$SRCDIR/Makefile"
if [ "$LIBS" != "" ]
then
# tack on libraries, finding as we go
......
......@@ -54,18 +54,20 @@ STATIC=0
DYLD=0
STATICSYSLIBS=0
CHECKSUM=0
KPROC=0
KPROC=4
THREADS=0
HAVE_KSPROC=0
NEED_KPROC=0
NEED_KPROC=1
HAVE_GZIP=0
NEED_GZIP=0
NEED_GZIP=1
HAVE_BZIP=0
NEED_BZIP=0
HAVE_SRAPATH=0
NEED_SRAPATH=0
NEED_BZIP=1
HAVE_DL=0
NEED_DL=0
NEED_DL=1
HAVE_M=0
NEED_M=1
HAVE_XML=0
NEED_XML=0
unset BUILD
unset LDIRS
unset XDIRS
......@@ -83,6 +85,8 @@ unset DEPFILE
unset RHOME
unset LHOME
unset RHOST
unset LOUTDIR
unset ROUTDIR
unset PROXY_TOOL
while [ $# -ne 0 ]
......@@ -147,6 +151,16 @@ do
shift
;;
--loutdir)
LOUTDIR="$2"
shift
;;
--routdir)
ROUTDIR="$2"
shift
;;
--rhost)
RHOST="$2"
shift
......@@ -234,42 +248,39 @@ do
LIBS="$LIBS $1"
HAVE_GZIP=1
;;
-lbz2|-sbz2|-dbz2)