Windows build.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 24 Apr 2007 12:55:15 +0000 (12:55 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 24 Apr 2007 12:55:15 +0000 (12:55 +0000)
src/oidtoc.tcl
win/makefile

index 17469e3..7ef102c 100644 (file)
@@ -2,7 +2,7 @@
 # Copyright (c) Index Data 2006-2007
 # See the file LICENSE for details.
 #
 # Copyright (c) Index Data 2006-2007
 # See the file LICENSE for details.
 #
-# $Id: oidtoc.tcl,v 1.2 2007-04-18 08:08:02 adam Exp $
+# $Id: oidtoc.tcl,v 1.3 2007-04-24 12:55:15 adam Exp $
 #
 # Converts a CSV file with Object identifiers to C
 
 #
 # Converts a CSV file with Object identifiers to C
 
@@ -45,23 +45,34 @@ proc oid_to_c {srcdir input cname hname} {
     set preamble "    \\brief Standard Object Identifiers: Generated from $input */"
     puts $cfile $preamble
     puts $hfile $preamble
     set preamble "    \\brief Standard Object Identifiers: Generated from $input */"
     puts $cfile $preamble
     puts $hfile $preamble
+    puts $hfile "\#ifndef OID_STD_H"
+    puts $hfile "\#define OID_STD_H"
 
 
-
+    # Define this. So that we don't get duplicate declartions with MSVC
+    puts $cfile "\#define OID_STD_H"
     puts $cfile "\#include <yaz/oid_db.h>"
     puts $cfile ""
     puts $cfile "\#include <yaz/oid_db.h>"
     puts $cfile ""
+    # To avoid LNK4049
+    puts $hfile "\#ifdef YAZ_DLL"
+    puts $hfile "\#define OID_EXPORT YAZ_EXPORT"
+    puts $hfile "\#else"
+    puts $hfile "\#define OID_EXPORT YAZ_IMPORT"
+    puts $hfile "\#endif"
+
+    puts $hfile "YAZ_BEGIN_CDECL"
     foreach oid $oids {
        set lname [string tolower [lindex $oid 2]]
        set lname [string map {- _ . _ { } _ ( {} ) {}} $lname]
        set prefix [string tolower [lindex $oid 0]]
        
     foreach oid $oids {
        set lname [string tolower [lindex $oid 2]]
        set lname [string map {- _ . _ { } _ ( {} ) {}} $lname]
        set prefix [string tolower [lindex $oid 0]]
        
-       puts -nonewline $cfile "const int yaz_oid_${prefix}_${lname}\[\] = \{"
+       puts -nonewline $cfile "YAZ_EXPORT const int yaz_oid_${prefix}_${lname}\[\] = \{"
        puts -nonewline $cfile [string map {. ,} [lindex $oid 1]]
        puts $cfile ",-1\};"
 
        puts -nonewline $cfile [string map {. ,} [lindex $oid 1]]
        puts $cfile ",-1\};"
 
-       puts $hfile "extern const int yaz_oid_${prefix}_${lname}\[\];"
+       puts $hfile "OID_EXPORT extern const int yaz_oid_${prefix}_${lname}\[\];"
     }
 
     }
 
-    puts $cfile "struct yaz_oid_entry yaz_oid_standard_entries\[\] ="
+    puts $cfile "YAZ_EXPORT struct yaz_oid_entry yaz_oid_standard_entries\[\] ="
     puts $cfile "\{"
     foreach oid $oids {
        set lname [string tolower [lindex $oid 2]]
     puts $cfile "\{"
     foreach oid $oids {
        set lname [string tolower [lindex $oid 2]]
@@ -77,7 +88,9 @@ proc oid_to_c {srcdir input cname hname} {
     puts $cfile "\t\{CLASS_NOP, 0, 0\}"
     puts $cfile "\};"
 
     puts $cfile "\t\{CLASS_NOP, 0, 0\}"
     puts $cfile "\};"
 
-    puts $hfile "extern struct yaz_oid_entry yaz_oid_standard_entries\[\];"
+    puts $hfile "OID_EXPORT extern struct yaz_oid_entry yaz_oid_standard_entries\[\];"
+    puts $hfile "YAZ_END_CDECL"
+    puts $hfile "\#endif"
     close $cfile
     close $hfile
 }
     close $cfile
     close $hfile
 }
index c7c8f33..7d0e146 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright (C) 1995-2007, Index Data ApS
 # All rights reserved.
 # Copyright (C) 1995-2007, Index Data ApS
 # All rights reserved.
-# $Id: makefile,v 1.130 2007-03-21 19:47:28 adam Exp $
+# $Id: makefile,v 1.131 2007-04-24 12:55:15 adam Exp $
 #
 # Programmed by
 #  Heikki Levanto & Adam Dickmeiss
 #
 # Programmed by
 #  Heikki Levanto & Adam Dickmeiss
@@ -328,6 +328,7 @@ TST_TIMING_OBJS = \
 
 MISC_OBJS= \
    $(OBJDIR)\version.obj \
 
 MISC_OBJS= \
    $(OBJDIR)\version.obj \
+   $(OBJDIR)\oid_std.obj \
    $(OBJDIR)\eventl.obj \
    $(OBJDIR)\requestq.obj \
    $(OBJDIR)\service.obj \
    $(OBJDIR)\eventl.obj \
    $(OBJDIR)\requestq.obj \
    $(OBJDIR)\service.obj \
@@ -378,7 +379,8 @@ MISC_OBJS= \
    $(OBJDIR)\marc_read_line.obj \
    $(OBJDIR)\nmem.obj \
    $(OBJDIR)\nmemsdup.obj \
    $(OBJDIR)\marc_read_line.obj \
    $(OBJDIR)\nmem.obj \
    $(OBJDIR)\nmemsdup.obj \
-   $(OBJDIR)\oid.obj \
+   $(OBJDIR)\oid_db.obj \
+   $(OBJDIR)\oid_util.obj \
    $(OBJDIR)\options.obj \
    $(OBJDIR)\readconf.obj \
    $(OBJDIR)\tpath.obj \
    $(OBJDIR)\options.obj \
    $(OBJDIR)\readconf.obj \
    $(OBJDIR)\tpath.obj \
@@ -404,7 +406,6 @@ MISC_OBJS= \
    $(OBJDIR)\yaz-ccl.obj \
    $(OBJDIR)\otherinfo.obj \
    $(OBJDIR)\sortspec.obj \
    $(OBJDIR)\yaz-ccl.obj \
    $(OBJDIR)\otherinfo.obj \
    $(OBJDIR)\sortspec.obj \
-   $(OBJDIR)\z3950oid.obj \
    $(OBJDIR)\charneg.obj \
    $(OBJDIR)\grs1disp.obj \
    $(OBJDIR)\opacdisp.obj \
    $(OBJDIR)\charneg.obj \
    $(OBJDIR)\grs1disp.obj \
    $(OBJDIR)\opacdisp.obj \
@@ -611,7 +612,7 @@ generated_files: \
 
 # Various YAZ source directories
 {$(SRCDIR)}.c{$(OBJDIR)}.obj:
 
 # Various YAZ source directories
 {$(SRCDIR)}.c{$(OBJDIR)}.obj:
-       $(CPP) $(COPT) $< 
+       $(CPP) $(COPT) /D"YAZ_DLL" $< 
 
 {$(ZOOMDIR)}.c{$(OBJDIR)}.obj:
        $(CPP) $(COPT) $< 
 
 {$(ZOOMDIR)}.c{$(OBJDIR)}.obj:
        $(CPP) $(COPT) $< 
@@ -684,6 +685,10 @@ $(SRCDIR)\marc8r.c: $(SRCDIR)\codetables.xml $(SRCDIR)\charconv.tcl
        @cd $(SRCDIR)
        $(TCL) charconv.tcl -r -p marc8r codetables.xml -o marc8r.c
 
        @cd $(SRCDIR)
        $(TCL) charconv.tcl -r -p marc8r codetables.xml -o marc8r.c
 
+$(SRCDIR)\oid_std.c: $(SRCDIR)\oid.csv $(SRCDIR)\charconv.tcl
+       @cd $(SRCDIR)
+       $(TCL) oidtoc.tcl $(SRCDIR) oid.csv oid_std.c oid_std.h
+
 $(SRCDIR)\diagbib1.c: $(SRCDIR)\bib1.csv
        @cd $(SRCDIR)
        $(TCL) csvtobib1.tcl $(SRCDIR)
 $(SRCDIR)\diagbib1.c: $(SRCDIR)\bib1.csv
        @cd $(SRCDIR)
        $(TCL) csvtobib1.tcl $(SRCDIR)