Improved installation. Moved header files to include/yaz.
[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.13 1999-11-30 13:47:10 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 INSTALL=@INSTALL@
32 INSTALL_PROGRAM=@INSTALL_PROGRAM@
33 INSTALL_DATA=@INSTALL_DATA@
34
35 # Installation directories, etc.
36 #  Binaries
37 prefix=@prefix@
38 exec_prefix=@exec_prefix@
39
40 BUILD=@build_root@
41 BINDIR=$(exec_prefix)/bin
42 #  Public libraries and header files
43 LIBDIR=$(exec_prefix)/lib
44 INCDIR=$(prefix)/include
45 #  Misc tables, etc.
46 YAZDIR=$(prefix)/lib/yaz
47 YAZTAB=$(prefix)/lib/yaz/tab
48
49 all: yaz-config 
50         for i in $(SUBDIR); do cd $$i; if $(MAKE) CC="$(CC)" \
51                 RANLIB="$(RANLIB)" LIBS="$(LIBS)" \
52                 INCLUDE="$(INCLUDE)" CFLAGS="$(CFLAGS)" \
53                 CDEFS="$(CDEFS)" \
54                 LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
55                 then cd ..; else exit 1; fi; done
56
57 dep depend:
58         for i in $(SUBDIR); do cd $$i; if $(MAKE) CPP="$(CPP)" \
59                 INCLUDE="$(INCLUDE)" CDEFS="$(CDEFS)" depend; \
60                 then cd ..; else exit 1; fi; done
61
62 clean:
63         for i in $(SUBDIR); do (cd $$i; $(MAKE) clean); done
64
65 oclean:
66         for i in $(SUBDIR); do (cd $$i; rm -f *.o); done
67         mv lib/libyaz.a .; rm -f lib/*.a; mv libyaz.a lib
68         cd client; strip client
69         cd ztest; strip ztest
70
71 cleanup:
72         rm -f `find . -name "*.[oa]" -print`
73         rm -f `find . -name "core" -print`
74         rm -f `find . -name "errlist" -print`
75         rm -f `find . -name "a.out" -print`
76         rm -f `find . -name "yaz-config" -print`
77
78 distclean: clean cleandepend
79
80 comp:
81         cd z39.50; make comp
82
83 cleandepend: 
84         for i in $(SUBDIR); do (cd $$i; \
85                 if sed '/^#Depend/q' <Makefile >Makefile.tmp; then \
86                 mv -f Makefile.tmp Makefile; fi; rm -f .depend); done
87
88 yaz-config: Makefile
89         @echo "#!/bin/sh" >yaz-config
90         @echo "# YAZ settings for developers" >>yaz-config
91         @echo "YAZBIN=\"`pwd`/bin\"" >>yaz-config
92         @echo "YAZLIB=\"`pwd`/lib\"" >>yaz-config
93         @echo "YAZTAB=\"`pwd`/tab\"" >>yaz-config
94         @echo "YAZLIB=\"-L`pwd`/lib -lyaz $(LIBS)\"" >>yaz-config
95         @echo "YAZINC=\"-I`pwd`/include\"" >>yaz-config
96
97 lib/yaz-config: Makefile
98         @echo "#!/bin/sh" >lib/yaz-config
99         @echo "# YAZ settings for developers" >>lib/yaz-config
100         @echo "YAZBIN='$(BINDIR)'" >>lib/yaz-config
101         @echo "YAZLIB='$(LIBDIR)'" >>lib/yaz-config
102         @echo "YAZTAB='$(YAZTAB)'" >>lib/yaz-config
103         @echo "YAZLIB='-L$(LIBDIR) -l yaz $(LIBS)'" >>lib/yaz-config
104         @echo "YAZINC='-I$(INCDIR)'" >>lib/yaz-config
105
106 install: all lib/yaz-config
107         $(INSTALL) -d $(BUILD)$(BINDIR)
108         $(INSTALL_PROGRAM) client/yaz-client $(BUILD)$(BINDIR)
109         $(INSTALL_PROGRAM) ztest/yaz-ztest $(BUILD)$(BINDIR)
110         $(INSTALL_PROGRAM) lib/yaz-config $(BUILD)$(BINDIR)
111         $(INSTALL) -d $(BUILD)$(LIBDIR)
112         $(INSTALL_DATA) lib/libyaz.a $(BUILD)$(LIBDIR)
113         @if [ -f lib/librfc.a ]; then \
114                 $(INSTALL_DATA) lib/librfc.a $(BUILD)$(LIBDIR); \
115         fi
116         $(INSTALL) -d $(BUILD)$(INCDIR)/yaz
117         @cd include/yaz; for f in *.h; do \
118                 $(INSTALL_DATA) $$f $(BUILD)$(INCDIR)/yaz; \
119         done
120         $(INSTALL) -d $(BUILD)$(YAZTAB)
121         @cd tab; for f in *; do \
122                 if [ -f $$f ]; then \
123                         $(INSTALL_DATA) $$f $(BUILD)$(YAZTAB); \
124                 fi; \
125         done
126
127 wc:
128         wc `find . -name '*.[ch]'`
129