Fixed bug in statserv_remove.
[yaz-moved-to-github.git] / Makefile
1 # Copyright (C) 1995-1998, Index Data I/S 
2 # All rights reserved.
3 # Sebastian Hammer, Adam Dickmeiss
4 # $Id: Makefile,v 1.36 1998-01-29 13:43:03 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="$(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) CDEFS="$(CDEFS)" depend;\
37                  then cd ..; else exit 1; fi; done
38
39 clean:
40         for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
41         -rm lib/*.a
42
43 oclean:
44         for i in $(SUBDIR); do (cd $$i; rm -f *.o); done
45         mv lib/libyaz.a .; rm -f lib/*.a; mv libyaz.a lib
46         cd client; strip client
47         cd server; strip ztest
48
49 cleanup:
50         rm -f `find $(SUBDIR) -name "*.[oa]" -print`
51         rm -f `find $(SUBDIR) -name "core" -print`
52         rm -f `find $(SUBDIR) -name "errlist" -print`
53         rm -f `find $(SUBDIR) -name "a.out" -print`
54
55 distclean: clean cleandepend
56
57 cleandepend: 
58         for i in $(SUBDIR); do (cd $$i; \
59                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
60                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
61
62 taildepend:
63         for i in $(SUBDIR); do (cd $$i; \
64                 if sed 's/^if/#if/' <Makefile|sed 's/^include/#include/'| \
65                 sed 's/^endif/#endif/' | \
66                 sed 's/^depend: depend2/depend: depend1/g' | \
67                 sed '/^#Depend/q' >Makefile.tmp; then \
68                 mv -f Makefile.tmp Makefile; fi); done
69
70 gnudepend:
71         for i in $(SUBDIR); do (cd $$i; \
72                 if sed '/^#Depend/q' <Makefile| \
73                 sed 's/^#if/if/' |sed 's/^#include/include/'| \
74                 sed 's/^#endif/endif/' | \
75                 sed 's/^depend: depend1/depend: depend2/g' >Makefile.tmp;then \
76                 mv -f Makefile.tmp Makefile; fi); done
77
78 install: all install.misc install.lib install.bin
79
80 install.bin:
81         @if [ ! -d $(BINDIR) ]; then \
82                 echo "Making directory $(BINDIR)"; \
83                 mkdir $(BINDIR); \
84         fi
85         @echo "Installing client -> $(BINDIR)"; \
86         cp client/client $(BINDIR)/client; chmod 755 $(BINDIR)/client
87         @echo "Installing ztest -> $(BINDIR)"; \
88         cp server/ztest $(BINDIR)/ztest; chmod 755 $(BINDIR)/ztest
89
90 install.lib:
91         @if [ ! -d $(LIBDIR) ]; then \
92                 echo "Making directory $(LIBDIR)"; \
93                 mkdir $(LIBDIR); \
94         fi
95         @echo "Installing libyaz.a -> $(LIBDIR)"; \
96         cp lib/libyaz.a $(LIBDIR)/libyaz.a; \
97         chmod 644 $(LIBDIR)/libyaz.a
98         @if [ -f lib/librfc.a ]; then \
99                 echo "Installing librfc.a -> $(LIBDIR)"; \
100                 cp lib/librfc.a $(LIBDIR)/librfc.a; \
101                 chmod 644 $(LIBDIR)/librfc.a; \
102         fi
103         @if [ ! -d $(INCDIR) ]; then \
104                 echo "Making directory $(INCDIR)"; \
105                 mkdir $(INCDIR); \
106         fi
107         @cd include; for f in *.h; do \
108                 echo "Installing $$f -> $(INCDIR)"; \
109                 cp $$f $(INCDIR)/$$f; chmod 644 $(INCDIR)/$$f; \
110         done
111
112 install.misc:
113         @if [ ! -d $(YAZDIR) ]; then \
114                 echo "Making directory $(YAZDIR)"; \
115                 mkdir $(YAZDIR); \
116         fi
117         @cd tab; for f in *; do \
118                 if [ -f $$f ]; then \
119                         echo "Installing $$f -> $(YAZDIR)"; \
120                         cp $$f $(YAZDIR)/$$f; chmod 644 $(YAZDIR)/$$f; \
121                 fi; \
122         done
123
124 wc:
125         wc `find . -name '*.[ch]'`
126