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