Creating idzebra.dll instead of static zebra.lib. Using yaz.lib or
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 30 Aug 2005 12:25:38 +0000 (12:25 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 30 Aug 2005 12:25:38 +0000 (12:25 +0000)
yazd.lib depending on DEBUG=0|1.

win/makefile

index f84fb9b..144d290 100644 (file)
@@ -1,11 +1,11 @@
 # Zebra makefile for MS NMAKE
-# $Id: makefile,v 1.37 2005-08-25 12:46:17 adam Exp $
+# $Id: makefile,v 1.38 2005-08-30 12:25:38 adam Exp $
  
 ###########################################################
 ############### Parameters 
 ###########################################################
 
-DEBUG=0   # 0 for release, 1 for debug
+DEBUG=1   # 0 for release, 1 for debug
 
 # EXPAT is optional. It's required for grs.xml-filters.
 HAVE_EXPAT=1
@@ -15,9 +15,23 @@ EXPAT_DIR=c:\Expat-1.95.8
 HAVE_ICONV=1
 ICONV_DIR=c:\iconv-1.9.1.win32
 
+# libxslt. For xslt+alvis
+HAVE_LIBXSLT=1
+LIBXSLT_DIR=c:\libxslt-1.1.14.win32
+
+# libxml2. Used by libxslt
+HAVE_LIBXML2=1
+LIBXML2_DIR=c:\libxml2-2.6.20.win32
+
+# zlib compression.  Used by libxml2
+ZLIB_DIR = c:\zlib-1.2.3.win32
+
+# get WIN32 binaries libxml2 & iconv & zlib from here:
+#  http://www.zlatkovic.com/libxml.en.html
+
 default: all
 
-all: dirs iconv zebralib zserver zindex 
+all: dirs expat iconv libxml2 libxslt yaz dll zserver zindex 
 
 ###########################################################
 ############### Directories
@@ -29,11 +43,17 @@ ROOTDIR=..   # The home of zebra
 # YAZ include files, libraries, etc.
 YAZDIR=$(ROOTDIR)\..\YAZ
 YAZINCL=$(YAZDIR)\include
-YAZLIB=$(YAZDIR)\lib\yaz.lib
 YAZLIBS=$(YAZLIB)
 YAZBINDIR=$(YAZDIR)\bin
+!if $(DEBUG)
+YAZLIB=$(YAZDIR)\lib\yazd.lib
+YAZ_DLL_SOURCE=$(YAZBINDIR)\yazd.dll
+YAZ_DLL_TARGET=$(BINDIR)\yazd.dll
+!else
+YAZLIB=$(YAZDIR)\lib\yaz.lib
 YAZ_DLL_SOURCE=$(YAZBINDIR)\yaz.dll
 YAZ_DLL_TARGET=$(BINDIR)\yaz.dll
+!endif
 
 # BZIP2 settings. Uncomment and specify if you wish to use LIBBZIP2.
 # (C) 1996-1999 Julian Seward <jseward@acm.org> http://www.bzip2.org
@@ -47,7 +67,11 @@ INCLDIR=$(ROOTDIR)\include  # our includes
 LIBDIR=$(ROOTDIR)\lib       # We produce .lib, .exp etc there
 BINDIR=$(ROOTDIR)\bin       # We produce exes and dlls there
 WINDIR=$(ROOTDIR)\win       # all these Win make things
+!if $(DEBUG)
+OBJDIR=$(WINDIR)\dobj       # where we store intermediate files
+!else
 OBJDIR=$(WINDIR)\obj        # where we store intermediate files
+!endif
 UNIXDIR=$(ROOTDIR)\unix     # corresponding unix things
 SRCDIR=$(ROOTDIR)           # for the case we move them under src
 
@@ -87,17 +111,25 @@ nsis:
 ############### Targets - what to make
 ###########################################################
 
-ZEBRALIB=$(LIBDIR)\zebra.lib
+!if $(DEBUG)
+DLL=$(BINDIR)\idzebrad.dll
+IMPLIB=$(LIBDIR)\idzebrad.lib
+!else
+DLL=$(BINDIR)\idzebra.dll
+IMPLIB=$(LIBDIR)\idzebra.lib
+!endif
+
+ZEBRA_RES=$(OBJDIR)\idzebra.res
+
 ZSERVER=$(BINDIR)\zebrasrv.exe
 ZINDEX=$(BINDIR)\zebraidx.exe
 APITEST=$(BINDIR)\apitest.exe
 
 # shortcut names defined here
-zebralib: $(ZEBRALIB)
 zindex: $(ZINDEX)
 zserver: $(ZSERVER)
 apitest: $(APITEST)
-
+dll: $(DLL) 
 ###########################################################
 ############### Compiler and linker options 
 ###########################################################
@@ -107,6 +139,8 @@ EXPAT_DEF= /D HAVE_EXPAT_H=1 /I"$(EXPAT_DIR)\source\lib"
 EXPAT_LIB= "$(EXPAT_DIR)\libs\libexpat.lib"
 EXPAT_DLL_SOURCE= "$(EXPAT_DIR)\libs\libexpat.dll"
 EXPAT_DLL_TARGET="$(BINDIR)\libexpat.dll"
+expat: $(EXPAT_DLL_TARGET)
+
 $(EXPAT_DLL_TARGET) : $(EXPAT_DLL_SOURCE)
        copy $(EXPAT_DLL_SOURCE) $(EXPAT_DLL_TARGET)
 !else
@@ -114,6 +148,7 @@ EXPAT_DEF= /D HAVE_EXPAT_H=0
 EXPAT_LIB=
 EXPAT_DLL_SOURCE=
 EXPAT_DLL_TARGET=
+expat:
 !endif
 
 !if $(HAVE_ICONV)
@@ -122,13 +157,46 @@ ICONV_LIB= $(ICONV_DIR)\lib\iconv.lib
 iconv: $(BINDIR)\iconv.dll
 
 $(BINDIR)\iconv.dll:
-       copy "$(ICONV_DIR)\lib\iconv.dll" $(BINDIR)
+       copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
 !else
 ICONV_DEF= /D HAVE_ICONV_H=0
 ICONV_LIB=
 iconv:
 !endif
 
+!if $(HAVE_LIBXML2)
+LIBXML2_LIB="$(LIBXML2_DIR)\lib\libxml2.lib"
+LIBXML2_DEF=/D HAVE_XML2=1 /I"$(LIBXML2_DIR)\include"
+libxml2: $(BINDIR)\libxml2.dll $(BINDIR)\zlib1.dll
+
+$(BINDIR)\libxml2.dll:
+  copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
+
+$(BINDIR)\zlib1.dll:
+  copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
+
+!else
+LIBXML2_LIB=
+LIBXML2_DEF=/D HAVE_XML2=0
+libxml2: 
+
+!endif
+
+!if $(HAVE_LIBXSLT)
+LIBXSLT_LIB="$(LIBXSLT_DIR)\lib\libxslt.lib"
+LIBXSLT_DEF=/D HAVE_XSLT=1 /I"$(LIBXSLT_DIR)\include"
+libxslt: $(BINDIR)\libxslt.dll 
+
+$(BINDIR)\libxslt.dll:
+  copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
+
+!else
+LIBXSLT_LIB=
+LIBXSLT_DEF=/D HAVE_XSLT=0
+libxslt: 
+
+!endif
+
 ### C and CPP compiler  (the same thing)
 # Note: $(CPP) has already been defined in the environment
 # (if you set things up right!)
@@ -139,6 +207,8 @@ COMMON_C_OPTIONS=          \
   /D"_CONSOLE" /D"_MBCS"   \
   $(ICONV_DEF)             \
   $(EXPAT_DEF)             \
+  $(LIBXML2_DEF)           \
+  $(LIBXSLT_DEF)           \
   /FR"$(OBJDIR)\\"         \
   /Fo"$(OBJDIR)\\"         \
   /Fd"$(OBJDIR)\\"         \
@@ -149,6 +219,10 @@ COMMON_C_OPTIONS=          \
   /DIDZEBRA_STATIC_GRS_XML=1 \
   /DIDZEBRA_STATIC_GRS_REGX=1 \
   /DIDZEBRA_STATIC_GRS_MARC=1 \
+  /DIDZEBRA_STATIC_GRS_DANBIB=1 \
+  /DIDZEBRA_STATIC_ALVIS=1 \
+  /DIDZEBRA_STATIC_XSLT=1 \
+  /DIDZEBRA_STATIC_SAFARI=1 \
   $(BZIP2DEF)
 
 COMMON_C_INCLUDES= \
@@ -186,7 +260,8 @@ LINK=link.exe
 LINK_LIBS= kernel32.lib user32.lib   gdi32.lib   winspool.lib \
            comdlg32.lib advapi32.lib shell32.lib ole32.lib    \
            oleaut32.lib uuid.lib     odbc32.lib  odbccp32.lib \
-           wsock32.lib  advapi32.lib $(ICONV_LIB) $(EXPAT_LIB)
+           wsock32.lib  advapi32.lib \
+          $(ICONV_LIB) $(EXPAT_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB)
 
 COMMON_LNK_OPTIONS= /nologo /machine:i386 /incremental:no
 
@@ -196,6 +271,8 @@ RELEASE_LNK_OPTIONS=
 
 ZEBRALIB_LINK_OPTIONS= -lib 
 
+DLL_LINK_OPTIONS= /dll  
+
 ZSERVER_LINK_OPTIONS= /subsystem:console  
 ZINDEX_LINK_OPTIONS= /subsystem:console  
 APITEST_LINK_OPTIONS= /subsystem:console  
@@ -267,7 +344,6 @@ ZEBRALIB_OBJS= \
        $(OBJDIR)\zvrank.obj \
        $(OBJDIR)\rank1.obj \
        $(OBJDIR)\rankstatic.obj \
-       $(OBJDIR)\readfile.obj \
        $(OBJDIR)\recctrl.obj \
        $(OBJDIR)\recgrs.obj \
        $(OBJDIR)\recindex.obj \
@@ -275,7 +351,10 @@ ZEBRALIB_OBJS= \
        $(OBJDIR)\rectext.obj \
        $(OBJDIR)\regxread.obj \
        $(OBJDIR)\xmlread.obj \
+       $(OBJDIR)\alvis.obj \
+       $(OBJDIR)\xslt.obj \
        $(OBJDIR)\danbibr.obj \
+       $(OBJDIR)\safari.obj \
        $(OBJDIR)\res.obj \
        $(OBJDIR)\retrieve.obj \
        $(OBJDIR)\rsbool.obj \
@@ -394,51 +473,56 @@ ALL_OBJS=\
 ############### Linking
 ###########################################################
 
-$(ZSERVER) : "$(BINDIR)" $(ZSERVER_OBJS) $(ZEBRALIB) $(YAZLIBS)
+$(ZSERVER) : "$(BINDIR)" $(ZSERVER_OBJS) $(IMPLIB)
        @echo Linking the server $(ZSERVER)
        $(LINK) @<<
                $(LNKOPT) 
                $(ZSERVER_LINK_OPTIONS)
                /out:$(ZSERVER) 
+               $(IMPLIB)
                $(YAZLIBS)
-               $(ZEBRALIB)
                $(BZIP2LIB)
                $(LINK_LIBS) 
                $(ZSERVER_OBJS) 
 <<
 
-$(ZINDEX) : "$(BINDIR)" $(ZEBRAIDX_OBJS) $(ZEBRALIB) $(YAZLIBS)
+$(ZINDEX) : "$(BINDIR)" $(ZEBRAIDX_OBJS)  $(IMPLIB)
        @echo Linking the indexer $(ZINDEX)
        $(LINK) @<<
                $(LNKOPT) 
                $(ZINDEX_LINK_OPTIONS)
                /out:$(ZINDEX) 
+               $(IMPLIB)
                $(YAZLIBS)
-               $(ZEBRALIB)
                $(BZIP2LIB)
                $(LINK_LIBS) 
                $(ZEBRAIDX_OBJS) 
 <<
 
-$(APITEST) : "$(BINDIR)" $(APITEST_OBJS) $(ZEBRALIB) $(YAZLIBS)
+$(APITEST) : "$(BINDIR)" $(APITEST_OBJS) $(YAZLIBS)
        @echo Linking the test program $(APITEST)
        $(LINK) @<<
                $(LNKOPT) 
                $(APITEST_LINK_OPTIONS)
                /out:$(APITEST) 
+               $(IMPLIB)
                $(YAZLIBS)
-               $(ZEBRALIB)
                $(BZIP2LIB)
                $(LINK_LIBS) 
                $(APITEST_OBJS)
 <<
 
-$(ZEBRALIB) : "$(BINDIR)" $(ZEBRALIB_OBJS) 
-       @echo Linking library  $(ZEBRALIB)
-       $(LINK) $(ZEBRALIB_LINK_OPTIONS) @<<
-               /nologo
-               $(ZEBRALIB_OBJS) 
-               /out:$(ZEBRALIB) 
+$(DLL) $(IMPLIB): "$(BINDIR)" $(ZEBRALIB_OBJS)
+       @echo Linking the dll  $(DLL)
+       $(LINK) @<<
+               $(LNKOPT) 
+               $(LINK_LIBS) 
+               $(DLL_LINK_OPTIONS)
+               $(ZEBRALIB_OBJS)
+               /out:$(DLL) 
+               $(YAZLIBS)
+               /implib:"$(IMPLIB)"
+               /map:"$(LIBDIR)\idzebra.map"  
 <<
 
 ###########################################################
@@ -453,11 +537,12 @@ clean:
        -del $(LIBDIR)\*.lib
 
 ########### check directories and create if needed
-dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR) \
-       $(EXPAT_DLL_TARGET) $(YAZ_DLL_TARGET)
+dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
 
 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
-       if not exist "$@/$(NUL)" mkdir "$@"
+       if not exist "$@/$(NUL)" mkdir "$@"
+
+yaz: $(YAZ_DLL_TARGET)
 
 $(YAZ_DLL_TARGET) : $(YAZ_DLL_SOURCE)
        copy $(YAZBINDIR)\*.dll $(BINDIR)