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