shlib-overhaul-20060802
[openafs.git] / src / kopenafs / Makefile.in
1 # Copyright 2000, International Business Machines Corporation and others.
2 # All Rights Reserved.
3
4 # This software has been released under the terms of the IBM Public
5 # License.  For details, see the LICENSE file in the top-level source
6 # directory or online at http://www.openafs.org/dl/license10.html
7 #
8 # Portions Copyright (c) 2003 Apple Computer, Inc.
9
10 srcdir=@srcdir@
11 include @TOP_OBJDIR@/src/config/Makefile.config
12
13 # API version. When something changes, increment as appropriate. 
14 # Ignore at your own risk.
15 MAJOR           = 1
16 MINOR           = 0
17
18 CC              = ${MT_CC}
19 INCLUDES        = -I. -I${srcdir} -I../sys
20 CFLAGS          = ${COMMON_CFLAGS} ${INCLUDES} ${MT_CFLAGS} ${SHLIB_CFLAGS}
21
22 SYS             = ${srcdir}/../sys
23 SYSOBJS         = glue.o pioctl.o setpag.o
24 LIBOBJS         = kopenafs.o ${SYSOBJS} AFS_component_version_number.o
25
26 LIBKOPENAFS     = libkopenafs.${SHLIB_SUFFIX}.${MAJOR}.${MINOR}
27
28 all: ${TOP_LIBDIR}/${LIBKOPENAFS} ${TOP_LIBDIR}/libkopenafs.a \
29                 ${TOP_INCDIR}/kopenafs.h
30
31 ${TOP_LIBDIR}/${LIBKOPENAFS}: ${LIBKOPENAFS}
32         ../config/shlib-install -d ${TOP_LIBDIR} \
33                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
34
35 ${TOP_LIBDIR}/libkopenafs.a: libkopenafs.a
36         ${INSTALL_DATA} libkopenafs.a $@
37
38 ${TOP_INCDIR}/kopenafs.h: kopenafs.h
39         ${INSTALL_DATA} kopenafs.h $@
40
41 glue.o: ${SYS}/glue.c ${SYS}/afssyscalls.h
42         ${CCOBJ} ${CFLAGS} -c ${SYS}/glue.c
43
44 pioctl.o: ${SYS}/pioctl.c ${SYS}/afssyscalls.h
45         ${CCOBJ} ${CFLAGS} -c ${SYS}/pioctl.c
46
47 setpag.o: ${SYS}/setpag.c ${SYS}/afssyscalls.h
48         ${CCOBJ} ${CFLAGS} -c ${SYS}/setpag.c
49
50 # This file is only actually used on SGI and AIX, but some systems can't cope
51 # with an empty .o file being included in a link.
52 syscall.o: ${SYS}/syscall.s
53         @set -e; set -x; case "$(SYS_NAME)" in \
54         sgi_*) \
55                 ${CC} ${CFLAGS} -c ${SYS}/syscall.s; \
56                 ;; \
57         rs_aix* | hp_ux10*) \
58                 /lib/cpp -P ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \
59                 as -o syscall.o syscall.ss; \
60                 $(RM) syscall.ss; \
61                 ;; \
62         *) \
63                 touch syscall.o ; \
64                 ;; \
65         esac
66
67 libkopenafs.a: ${LIBOBJS}
68         ${RM} -f $@
69         @set -e; set -x; case "$(SYS_NAME)" in \
70         sgi_* | rs_aix* | hp_ux10*) \
71                 ${AR} crv $@ ${LIBOBJS} syscall.o ;; \
72         *) \
73                 ${AR} crv $@ ${LIBOBJS} ;; \
74         esac
75         ${RANLIB} $@
76
77 ${LIBKOPENAFS}: ${LIBOBJS}
78         @set -e; set -x; case ${SYS_NAME} in \
79         sgi_* | rs_aix* | hp_ux10*) \
80                 ../config/shlib-build -d $(srcdir) -l libkopenafs \
81                         -M ${MAJOR} -m ${MINOR} -- \
82                         ${LIBOBJS} syscall.o ${MT_LIBS} ; \
83                 ;; \
84         *) \
85                 ../config/shlib-build -d $(srcdir) -l libkopenafs \
86                         -M ${MAJOR} -m ${MINOR} -- \
87                         ${LIBOBJS} ${MT_LIBS} ; \
88                 ;; \
89         esac
90
91 test-unlog: test-unlog.o libkopenafs.a
92         ${CC} -o test-unlog test-unlog.o libkopenafs.a ${XLIBS} ${CFLAGS}
93
94 test-setpag: test-setpag.o libkopenafs.a
95         ${CC} -o test-setpag test-setpag.o libkopenafs.a ${XLIBS} ${CFLAGS}
96
97 #
98 # Installation targets
99 #
100 install: ${LIBKOPENAFS}
101         ${INSTALL} -d ${DESTDIR}${libdir}
102         ${INSTALL} -d ${DESTDIR}${includedir}
103         ${INSTALL_DATA} libkopenafs.a ${DESTDIR}${libdir}/libkopenafs.a
104         ${INSTALL_DATA} kopenafs.h ${DESTDIR}${includedir}/kopenafs.h
105         ../config/shlib-install -d ${DESTDIR}${libdir} \
106                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
107
108 dest: ${LIBKOPENAFS}
109         ${INSTALL} -d ${DEST}/lib
110         ${INSTALL} -d ${DEST}/include
111         ${INSTALL_DATA} libkopenafs.a ${DEST}/lib/libkopenafs.a
112         ${INSTALL_DATA} kopenafs.h ${DEST}/include/kopenafs.h
113         ../config/shlib-install -d ${DEST}/lib \
114                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
115
116 #
117 # Misc targets
118 #
119 clean:
120         $(RM) -f *.o *.a ${LIBKOPENAFS} AFS_component_version_number.c \
121                 test-setpag test-unlog
122
123 include ../config/Makefile.version