Unix: Rework build system
[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 INSTALL = @INSTALL@
15 INSTALL_DATA = @INSTALL_DATA@
16 INSTALL_PROGRAM = @INSTALL_PROGRAM@
17 INSTALL_SCRIPT = @INSTALL_SCRIPT@
18
19 # API version. When something changes, increment as appropriate. 
20 # Ignore at your own risk.
21 MAJOR           = 1
22 MINOR           = 1
23
24 MODULE_INCLUDE  = -I. -I${srcdir} -I../sys
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         $(AFS_CCRULE) $(SYS)/glue.c
48
49 pioctl.o: ${SYS}/pioctl.c ${SYS}/afssyscalls.h
50         $(AFS_CCRULE) $(SYS)/pioctl.c
51
52 setpag.o: ${SYS}/setpag.c ${SYS}/afssyscalls.h
53         $(AFS_CCRULE) $(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
58 syscall.o: ${SYS}/syscall.s
59         @set -e; set -x; case "$(SYS_NAME)" in \
60         sgi_*) \
61                 $(AFS_CCRULE) ${SYS}/syscall.s; \
62                 ;; \
63         rs_aix* | hp_ux10*) \
64                 $(PATH_CPP) -P ${SFLAGS} ${SYS}/syscall.s > syscall.ss; \
65                 as -o syscall.o syscall.ss; \
66                 $(RM) syscall.ss; \
67                 ;; \
68         *) \
69                 touch syscall.o ; \
70                 ;; \
71         esac
72
73 libkopenafs.a: ${LIBOBJS} syscall.o
74         ${RM} -f $@
75         @set -e; set -x; case "$(SYS_NAME)" in \
76         sgi_* | rs_aix* | hp_ux10*) \
77                 ${AR} crv $@ ${LIBOBJS} syscall.o ;; \
78         *) \
79                 ${AR} crv $@ ${LIBOBJS} ;; \
80         esac
81         ${RANLIB} $@
82
83 ${LIBKOPENAFS}: ${LIBOBJS} syscall.o libkopenafs.map
84         @set -e; set -x; case ${SYS_NAME} in \
85         sgi_* | rs_aix* | hp_ux10*) \
86                 ../config/shlib-build -d $(srcdir) -l libkopenafs \
87                         -M ${MAJOR} -m ${MINOR} -- \
88                         ${LIBOBJS} syscall.o ${MT_LIBS} ; \
89                 ;; \
90         *) \
91                 ../config/shlib-build -d $(srcdir) -l libkopenafs \
92                         -M ${MAJOR} -m ${MINOR} -- \
93                         ${LIBOBJS} ${MT_LIBS} ; \
94                 ;; \
95         esac
96
97 test-unlog: test-unlog.o libkopenafs.a
98         $(AFS_LDRULE) test-unlog.o libkopenafs.a ${XLIBS}
99
100 test-setpag: test-setpag.o libkopenafs.a
101         $(AFS_LDRULE) test-setpag.o libkopenafs.a ${XLIBS}
102
103 #
104 # Installation targets
105 #
106 install: ${LIBKOPENAFS}
107         ${INSTALL} -d ${DESTDIR}${libdir}
108         ${INSTALL} -d ${DESTDIR}${includedir}
109         ${INSTALL_DATA} libkopenafs.a ${DESTDIR}${libdir}/libkopenafs.a
110         ${INSTALL_DATA} ${srcdir}/kopenafs.h ${DESTDIR}${includedir}/kopenafs.h
111         ../config/shlib-install -d ${DESTDIR}${libdir} \
112                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
113
114 dest: ${LIBKOPENAFS}
115         ${INSTALL} -d ${DEST}/lib
116         ${INSTALL} -d ${DEST}/include
117         ${INSTALL_DATA} libkopenafs.a ${DEST}/lib/libkopenafs.a
118         ${INSTALL_DATA} ${srcdir}/kopenafs.h ${DEST}/include/kopenafs.h
119         ../config/shlib-install -d ${DEST}/lib \
120                 -l libkopenafs -M ${MAJOR} -m ${MINOR}
121
122 #
123 # Misc targets
124 #
125 clean:
126         $(RM) -f *.o *.a ${LIBKOPENAFS} AFS_component_version_number.c \
127                 test-setpag test-unlog libkopenafs.exp
128
129 include ../config/Makefile.version