New windows NT/95 port using MSV5.0. To export DLL functions the
[yaz-moved-to-github.git] / Makefile
1 # Copyright (C) 1995-1997, Index Data I/S 
2 # All rights reserved.
3 # Sebastian Hammer, Adam Dickmeiss
4 # $Id: Makefile,v 1.33 1997-09-01 08:47:18 adam Exp $
5
6 # Uncomment the lines below to enable mOSI communcation.
7 #ODEFS=-DUSE_XTIMOSI
8 #RFC1006=rfc1006
9 #LIBMOSI=../../xtimosi/src/libmosi.a ../lib/librfc.a
10 #XMOSI=xmosi.o
11
12 CDEFS=$(ODEFS) 
13 #CC=
14 SHELL=/bin/sh
15 MAKE=make
16 SUBDIR=util odr asn $(RFC1006) ccl comstack retrieval client server ztest makelib
17 # Add external libraries to the ELIBS macro
18 ELIBS=
19 CONTROL=RANLIB="ranlib" ELIBS="$(ELIBS)"
20
21 # Installation directories, etc.
22 #  Binaries
23 BINDIR=/usr/local/bin
24 #  Public libraries and header files
25 LIBDIR=/usr/local/lib
26 INCDIR=/usr/local/include
27 #  Misc tables, etc.
28 YAZDIR=/usr/local/lib/yaz
29
30 all:
31         for i in $(SUBDIR); do cd $$i; if $(MAKE) $(CONTROL) \
32         CFLAGS="$(CFLAGS) $(CDEFS)" LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
33         then cd ..; else exit 1; fi; done
34
35 dep depend:
36         for i in $(SUBDIR); do cd $$i; if $(MAKE) depend; then cd ..; else exit 1; fi; done
37
38 clean:
39         for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
40         -rm lib/*.a
41
42 oclean:
43         for i in $(SUBDIR); do (cd $$i; rm -f *.o); done
44         mv lib/libyaz.a .; rm -f lib/*.a; mv libyaz.a lib
45         cd client; strip client
46         cd server; strip ztest
47
48 cleanup:
49         rm -f `find $(SUBDIR) -name "*.[oa]" -print`
50         rm -f `find $(SUBDIR) -name "core" -print`
51         rm -f `find $(SUBDIR) -name "errlist" -print`
52         rm -f `find $(SUBDIR) -name "a.out" -print`
53
54 distclean: clean cleandepend
55
56 cleandepend: 
57         for i in $(SUBDIR); do (cd $$i; \
58                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
59                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
60
61 taildepend:
62         for i in $(SUBDIR); do (cd $$i; \
63                 if sed 's/^if/#if/' <Makefile|sed 's/^include/#include/'| \
64                 sed 's/^endif/#endif/' | \
65                 sed 's/^depend: depend2/depend: depend1/g' | \
66                 sed '/^#Depend/q' >Makefile.tmp; then \
67                 mv -f Makefile.tmp Makefile; fi); done
68
69 gnudepend:
70         for i in $(SUBDIR); do (cd $$i; \
71                 if sed '/^#Depend/q' <Makefile| \
72                 sed 's/^#if/if/' |sed 's/^#include/include/'| \
73                 sed 's/^#endif/endif/' | \
74                 sed 's/^depend: depend1/depend: depend2/g' >Makefile.tmp;then \
75                 mv -f Makefile.tmp Makefile; fi); done
76
77 install: all install.misc install.lib install.bin
78
79 install.bin:
80         @if [ ! -d $(BINDIR) ]; then \
81                 echo "Making directory $(BINDIR)"; \
82                 mkdir $(BINDIR); \
83         fi
84         @echo "Installing client -> $(BINDIR)"; \
85         cp client/client $(BINDIR)/client; chmod 755 $(BINDIR)/client
86         @echo "Installing ztest -> $(BINDIR)"; \
87         cp server/ztest $(BINDIR)/ztest; chmod 755 $(BINDIR)/ztest
88
89 install.lib:
90         @if [ ! -d $(LIBDIR) ]; then \
91                 echo "Making directory $(LIBDIR)"; \
92                 mkdir $(LIBDIR); \
93         fi
94         @echo "Installing libyaz.a -> $(LIBDIR)"; \
95         cp lib/libyaz.a $(LIBDIR)/libyaz.a; \
96         chmod 644 $(LIBDIR)/libyaz.a
97         @if [ -f lib/librfc.a ]; then \
98                 echo "Installing librfc.a -> $(LIBDIR)"; \
99                 cp lib/librfc.a $(LIBDIR)/librfc.a; \
100                 chmod 644 $(LIBDIR)/librfc.a; \
101         fi
102         @if [ ! -d $(INCDIR) ]; then \
103                 echo "Making directory $(INCDIR)"; \
104                 mkdir $(INCDIR); \
105         fi
106         @cd include; for f in *.h; do \
107                 echo "Installing $$f -> $(INCDIR)"; \
108                 cp $$f $(INCDIR)/$$f; chmod 644 $(INCDIR)/$$f; \
109         done
110
111 install.misc:
112         @if [ ! -d $(YAZDIR) ]; then \
113                 echo "Making directory $(YAZDIR)"; \
114                 mkdir $(YAZDIR); \
115         fi
116         @cd tab; for f in *; do \
117                 if [ -f $$f ]; then \
118                         echo "Installing $$f -> $(YAZDIR)"; \
119                         cp $$f $(YAZDIR)/$$f; chmod 644 $(YAZDIR)/$$f; \
120                 fi; \
121         done
122
123 wc:
124         wc `find . -name '*.[ch]'`
125