ffcb4851a2a8fbc310cc58c2fb4899ac25c2e979
[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 INSTALL = @INSTALL@
13 INSTALL_DATA = @INSTALL_DATA@
14 INSTALL_PROGRAM = @INSTALL_PROGRAM@
15 INSTALL_SCRIPT = @INSTALL_SCRIPT@
16
17 # API version. When something changes, increment as appropriate. 
18 # Ignore at your own risk.
19 MAJOR           = 1
20 MINOR           = 0
21
22 CC              = ${MT_CC}
23 INCLUDES        = -I. -I${srcdir} -I../sys
24 CFLAGS          = ${COMMON_CFLAGS} ${INCLUDES} ${MT_CFLAGS} ${SHLIB_CFLAGS}
25
26 SFLAGS          = -I${TOP_INCDIR}
27 SYS             = ${srcdir}/../sys
28 SYSOBJS         = glue.o pioctl.o setpag.o
29 LIBOBJS         = kopenafs.o ${SYSOBJS} AFS_component_version_number.o
30
31 LIBKOPENAFS     = libkopenafs.${SHLIB_SUFFIX}.${MAJOR}.${MINOR}
32
33 all: ${TOP_LIBDIR}/${LIBKOPENAFS} ${TOP_LIBDIR}/libkopenafs.a \
34                 ${TOP_INCDIR}/kopenafs.h
35
36 ${TOP_LIBDIR}/${LIBKOPENAFS}: ${LIBKOPENAFS}
37         ../config/shlib-install -d ${TOP_LIBDIR} \
38                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
39
40 ${TOP_LIBDIR}/libkopenafs.a: libkopenafs.a
41         ${INSTALL_DATA} libkopenafs.a $@
42
43 ${TOP_INCDIR}/kopenafs.h: kopenafs.h
44         ${INSTALL_DATA} $? $@
45
46 glue.o: ${SYS}/glue.c ${SYS}/afssyscalls.h
47         ${CCOBJ} ${CFLAGS} -c ${SYS}/glue.c
48
49 pioctl.o: ${SYS}/pioctl.c ${SYS}/afssyscalls.h
50         ${CCOBJ} ${CFLAGS} -c ${SYS}/pioctl.c
51
52 setpag.o: ${SYS}/setpag.c ${SYS}/afssyscalls.h
53         ${CCOBJ} ${CFLAGS} -c ${SYS}/setpag.c
54
55 # This file is only actually used on SGI and AIX, but some systems can't cope
56 # with an empty .o file being included in a link.
57 syscall.o: ${SYS}/syscall.s
58         @set -e; set -x; case "$(SYS_NAME)" in \
59         sgi_*) \
60                 ${CC} ${CFLAGS} -c ${SYS}/syscall.s; \
61                 ;; \
62         rs_aix* | hp_ux10*) \
63                 $(PATH_CPP) -P ${SFLAGS} ${SYS}/syscall.s > syscall.ss; \
64                 as -o syscall.o syscall.ss; \
65                 $(RM) syscall.ss; \
66                 ;; \
67         *) \
68                 touch syscall.o ; \
69                 ;; \
70         esac
71
72 libkopenafs.a: ${LIBOBJS} syscall.o
73         ${RM} -f $@
74         @set -e; set -x; case "$(SYS_NAME)" in \
75         sgi_* | rs_aix* | hp_ux10*) \
76                 ${AR} crv $@ ${LIBOBJS} syscall.o ;; \
77         *) \
78                 ${AR} crv $@ ${LIBOBJS} ;; \
79         esac
80         ${RANLIB} $@
81
82 ${LIBKOPENAFS}: ${LIBOBJS} syscall.o
83         @set -e; set -x; case ${SYS_NAME} in \
84         sgi_* | rs_aix* | hp_ux10*) \
85                 ../config/shlib-build -d $(srcdir) -l libkopenafs \
86                         -M ${MAJOR} -m ${MINOR} -- \
87                         ${LIBOBJS} syscall.o ${MT_LIBS} ; \
88                 ;; \
89         *) \
90                 ../config/shlib-build -d $(srcdir) -l libkopenafs \
91                         -M ${MAJOR} -m ${MINOR} -- \
92                         ${LIBOBJS} ${MT_LIBS} ; \
93                 ;; \
94         esac
95
96 test-unlog: test-unlog.o libkopenafs.a
97         ${CC} -o test-unlog test-unlog.o libkopenafs.a ${XLIBS} ${CFLAGS}
98
99 test-setpag: test-setpag.o libkopenafs.a
100         ${CC} -o test-setpag test-setpag.o libkopenafs.a ${XLIBS} ${CFLAGS}
101
102 #
103 # Installation targets
104 #
105 install: ${LIBKOPENAFS}
106         ${INSTALL} -d ${DESTDIR}${libdir}
107         ${INSTALL} -d ${DESTDIR}${includedir}
108         ${INSTALL_DATA} libkopenafs.a ${DESTDIR}${libdir}/libkopenafs.a
109         ${INSTALL_DATA} kopenafs.h ${DESTDIR}${includedir}/kopenafs.h
110         ../config/shlib-install -d ${DESTDIR}${libdir} \
111                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
112
113 dest: ${LIBKOPENAFS}
114         ${INSTALL} -d ${DEST}/lib
115         ${INSTALL} -d ${DEST}/include
116         ${INSTALL_DATA} libkopenafs.a ${DEST}/lib/libkopenafs.a
117         ${INSTALL_DATA} kopenafs.h ${DEST}/include/kopenafs.h
118         ../config/shlib-install -d ${DEST}/lib \
119                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
120
121 #
122 # Misc targets
123 #
124 clean:
125         $(RM) -f *.o *.a ${LIBKOPENAFS} AFS_component_version_number.c \
126                 test-setpag test-unlog
127
128 include ../config/Makefile.version