Unix: Rework build system
[openafs.git] / src / ptserver / 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 srcdir=@srcdir@
8 include @TOP_OBJDIR@/src/config/Makefile.config
9 include @TOP_OBJDIR@/src/config/Makefile.lwp
10
11 INSTALL = @INSTALL@
12 INSTALL_DATA = @INSTALL_DATA@
13 INSTALL_PROGRAM = @INSTALL_PROGRAM@
14 INSTALL_SCRIPT = @INSTALL_SCRIPT@
15 ENABLE_PTHREADED_UBIK=@ENABLE_PTHREADED_UBIK@
16
17 INCLS=${TOP_INCDIR}/ubik.h \
18         ${TOP_INCDIR}/lock.h  \
19         ${TOP_INCDIR}/lwp.h \
20         ${TOP_INCDIR}/rx/rx.h \
21         ${TOP_INCDIR}/rx/xdr.h \
22         ${TOP_INCDIR}/afs/keys.h \
23         ${TOP_INCDIR}/afs/cellconfig.h \
24         ptserver.h ptclient.h ptuser.h ptint.h pterror.h map.h ptprototypes.h
25
26 LINCLS=${TOP_INCDIR}/ubik.h \
27         ${TOP_INCDIR}/lock.h \
28         ${TOP_INCDIR}/rx/rx.h \
29         ${TOP_INCDIR}/rx/xdr.h  \
30         ${TOP_INCDIR}/rx/rxkad.h \
31         ${TOP_INCDIR}/afs/auth.h \
32         ${TOP_INCDIR}/afs/cellconfig.h \
33         ptclient.h ptuser.h ptint.h pterror.h
34
35 LIBS=${TOP_LIBDIR}/libubik.a \
36         ${TOP_LIBDIR}/libauth.a \
37         ${TOP_LIBDIR}/librxkad.a \
38         ${TOP_LIBDIR}/librxstat.a \
39         ${TOP_LIBDIR}/librx.a \
40         ${TOP_LIBDIR}/liblwp.a \
41         ${TOP_LIBDIR}/libdes.a \
42         ${TOP_LIBDIR}/libcmd.a \
43         ${TOP_LIBDIR}/libcom_err.a \
44         ${TOP_LIBDIR}/libsys.a \
45         ${TOP_LIBDIR}/libafsutil.a
46
47
48 all: ptserver pts pt_util db_verify ${TOP_LIBDIR}/libprot.a \
49         depinstall readgroup readpwd testpt
50
51 generated: \
52         pterror.h pterror.c \
53         ptint.cs.c ptint.ss.c ptint.xdr.c ptint.h
54
55 depinstall: \
56         ptint.cs.c ptint.xdr.c \
57         ${TOP_INCDIR}/afs/prclient.h \
58         ${TOP_INCDIR}/afs/prerror.h \
59         ${TOP_INCDIR}/afs/print.h \
60         ${TOP_INCDIR}/afs/prserver.h \
61         ${TOP_INCDIR}/afs/ptclient.h \
62         ${TOP_INCDIR}/afs/ptuser.h \
63         ${TOP_INCDIR}/afs/pterror.h \
64         ${TOP_INCDIR}/afs/ptint.h \
65         ${TOP_INCDIR}/afs/ptserver.h
66
67 ${TOP_LIBDIR}/libprot.a: libprot.a
68         ${INSTALL_DATA} $? $@
69
70 ${TOP_INCDIR}/afs/prclient.h: ptclient.h
71         ${INSTALL_DATA} $? $@
72
73 ${TOP_INCDIR}/afs/prerror.h: pterror.h
74         ${INSTALL_DATA} $? $@
75
76 ${TOP_INCDIR}/afs/print.h: ptint.h
77         ${INSTALL_DATA} $? $@
78
79 ${TOP_INCDIR}/afs/prserver.h: ptserver.h
80         ${INSTALL_DATA} $? $@
81
82 ${TOP_INCDIR}/afs/ptclient.h: ptclient.h
83         ${INSTALL_DATA} $? $@
84
85 ${TOP_INCDIR}/afs/ptuser.h: ptuser.h
86         ${INSTALL_DATA} $? $@
87
88 ${TOP_INCDIR}/afs/pterror.h: pterror.h
89         ${INSTALL_DATA} $? $@
90
91 ${TOP_INCDIR}/afs/ptint.h: ptint.h
92         ${INSTALL_DATA} $? $@
93
94 ${TOP_INCDIR}/afs/ptserver.h: ptserver.h
95         ${INSTALL_DATA} $? $@
96
97 #
98 # Build targets
99 #
100 ptserver: ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o utils.o $(LIBS) ${TOP_LIBDIR}/libaudit.a map.o
101         $(AFS_LDRULE) ptserver.o ptutils.o ptprocs.o ptint.ss.o ptint.xdr.o \
102                 utils.o map.o $(LIBS) ${XLIBS} ${TOP_LIBDIR}/libaudit.a
103
104 ptserver.o: ptserver.c ${INCLS} AFS_component_version_number.c
105
106 # When supergroups is enabled, some parts of ptserver cast between
107 # incompatible structs.
108 CFLAGS_ptutils.o = @CFLAGS_NOSTRICT@
109 CFLAGS_ptprocs.o = @CFLAGS_NOSTRICT@
110
111 ptutils.o: ptutils.c ${INCLS}
112 ptprocs.o: ptprocs.c ${INCLS}
113 utils.o: utils.c ${INCLS} 
114 map.o: map.c ${INCLS}
115 ptint.ss.o: ptint.ss.c ptint.xdr.c ptint.xg
116 ptint.cs.o: ptint.cs.c ptint.xdr.c ptint.xg
117 ptint.xdr.o: ptint.xdr.c ptint.h ptint.xg
118
119 ptint.cs.c: ptint.xg
120         ${RXGEN} -A -x -C -u -o $@ ${srcdir}/ptint.xg
121
122 ptint.ss.c: ptint.xg
123         ${RXGEN} -A -x -S -o $@ ${srcdir}/ptint.xg
124
125 ptint.xdr.c: ptint.xg
126         ${RXGEN} -A -x -c -o $@ ${srcdir}/ptint.xg
127
128 ptint.h: ptint.xg
129         ${RXGEN} -A -x -h -u -o $@ ${srcdir}/ptint.xg
130
131 ptint.cs.c: ptint.h
132 ptint.ss.c: ptint.h
133 ptint.xdr.c: ptint.h
134
135 Kptint.cs.c: ptint.xg Kptint.h
136         ${RXGEN} -A -x -k -C -o Kptint.cs.c ${srcdir}/ptint.xg
137
138 Kptint.xdr.c: ptint.xg
139         ${RXGEN} -A -x -k -c -o Kptint.xdr.c ${srcdir}/ptint.xg
140
141 Kptint.h: ptint.xg
142         ${RXGEN} -A -x -k -h -o Kptint.h ${srcdir}/ptint.xg
143
144 display.o: display.c ${INCLS}
145
146 db_verify.o: db_verify.c ${INCLS} AFS_component_version_number.c
147
148 db_verify: db_verify.o pterror.o display.o $(LIBS)
149         $(AFS_LDRULE) db_verify.o display.o pterror.o $(LIBS) ${XLIBS}
150
151 ptclient: ptclient.o display.o libprot.a $(LIBS)
152         $(AFS_LDRULE) ptclient.o display.o libprot.a $(LIBS) ${XLIBS}
153
154 ptclient.o: ptclient.c ${INCLS} AFS_component_version_number.c
155
156 ptuser.o: ptuser.c ${LINCLS}
157
158 pterror.h pterror.c: pterror.et
159         $(RM) -f pterror.h pterror.c
160         ${COMPILE_ET} -p ${srcdir} pterror
161
162 libprot.a: ptuser.o pterror.o ptint.cs.o ptint.xdr.o AFS_component_version_number.o
163         $(RM) -f $@
164         $(AR) crv $@ ptuser.o pterror.o ptint.cs.o ptint.xdr.o AFS_component_version_number.o
165         $(RANLIB) $@
166
167 pts: pts.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS)
168         $(AFS_LDRULE) pts.o ${TOP_LIBDIR}/libcmd.a libprot.a ${LIBS} ${XLIBS}
169
170 pts.o: pts.c ${LINCLS} ${TOP_INCDIR}/afs/cmd.h AFS_component_version_number.c
171
172 readgroup: readgroup.o libprot.a $(LIBS)
173         $(AFS_LDRULE) readgroup.o libprot.a ${LIBS} ${XLIBS}
174
175 readgroup.o: readgroup.c ${LINCLS} AFS_component_version_number.c
176
177 readpwd: readpwd.o libprot.a $(LIBS)
178         $(AFS_LDRULE) readpwd.o libprot.a ${LIBS} ${XLIBS}
179
180 readpwd.o: readpwd.c ${LINCLS} AFS_component_version_number.c
181
182 testpt: testpt.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS)
183         case "$(SYS_NAME)" in \
184         *_darwin_12 ) \
185                 $(AFS_LDRULE) testpt.o ${TOP_LIBDIR}/libcmd.a \
186                         libprot.a $(LIBS) ;; \
187         * ) \
188                 $(AFS_LDRULE) testpt.o -lm ${TOP_LIBDIR}/libcmd.a \
189                         libprot.a $(LIBS) ${XLIBS} ;; \
190         esac
191
192 testpt.o: testpt.c ${INCLS} ${TOP_INCDIR}/afs/cmd.h AFS_component_version_number.c
193
194 pt_util: pt_util.o ptutils.o ubik.o utils.o map.o libprot.a $(LIBS)
195         $(AFS_LDRULE) pt_util.o ptutils.o ubik.o utils.o map.o libprot.a \
196                 ${TOP_LIBDIR}/libcmd.a $(LIBS) ${XLIBS}
197
198 ubik.o: ubik.c ${INCLS}
199
200 prerror.h: pterror.h
201         ${INSTALL_DATA} $? $@
202         echo '#define ERROR_TABLE_BASE_pr ERROR_TABLE_BASE_PT' >> $@
203
204 #
205 # Installation targets
206 #
207 install: ptserver pts pt_util db_verify libprot.a ptclient.h pterror.h \
208                 ptint.h ptserver.h
209         ${INSTALL} -d ${DESTDIR}${afssrvlibexecdir}
210         ${INSTALL} -d ${DESTDIR}${afssrvbindir}
211         ${INSTALL} -d ${DESTDIR}${afssrvsbindir}
212         ${INSTALL} -d ${DESTDIR}${bindir}
213         ${INSTALL} -d ${DESTDIR}${libdir}/afs
214         ${INSTALL} -d ${DESTDIR}${includedir}/afs
215         if [ "x$(ENABLE_PTHREADED_UBIK)" != "xyes" ] ; then \
216                 ${INSTALL_PROGRAM} ptserver ${DESTDIR}${afssrvlibexecdir}/ptserver; \
217                 ${INSTALL_PROGRAM} pts ${DESTDIR}${afssrvbindir}/pts; \
218                 ${INSTALL_PROGRAM} pts ${DESTDIR}${bindir}/pts; \
219                 ${INSTALL_PROGRAM} pt_util ${DESTDIR}${afssrvsbindir}/pt_util; \
220                 ${INSTALL_PROGRAM} db_verify ${DESTDIR}${afssrvsbindir}/prdb_check; \
221         fi
222         ${INSTALL_DATA} libprot.a ${DESTDIR}${libdir}/afs/libprot.a
223         ${INSTALL_DATA} ${srcdir}/ptclient.h ${DESTDIR}${includedir}/afs/prclient.h
224         ${INSTALL_DATA} pterror.h ${DESTDIR}${includedir}/afs/prerror.h
225         ${INSTALL_DATA} ptint.h ${DESTDIR}${includedir}/afs/print.h
226         ${INSTALL_DATA} ${srcdir}/ptserver.h ${DESTDIR}${includedir}/afs/prserver.h
227         ${INSTALL_DATA} ${srcdir}/ptclient.h ${DESTDIR}${includedir}/afs/ptclient.h
228         ${INSTALL_DATA} ${srcdir}/ptuser.h ${DESTDIR}${includedir}/afs/ptuser.h
229         ${INSTALL_DATA} pterror.h ${DESTDIR}${includedir}/afs/pterror.h
230         ${INSTALL_DATA} ptint.h ${DESTDIR}${includedir}/afs/ptint.h
231         ${INSTALL_DATA} ${srcdir}/ptserver.h ${DESTDIR}${includedir}/afs/ptserver.h
232
233 dest: ptserver pts pt_util db_verify libprot.a ptclient.h pterror.h \
234                 ptint.h ptserver.h
235         ${INSTALL} -d ${DEST}/root.server/usr/afs/bin
236         ${INSTALL} -d ${DEST}/bin
237         ${INSTALL} -d ${DEST}/etc
238         ${INSTALL} -d ${DEST}/lib/afs
239         ${INSTALL} -d ${DEST}/include/afs
240         if [ "x$(ENABLE_PTHREADED_UBIK)" != "xyes" ] ; then \
241                 ${INSTALL_PROGRAM} ptserver ${DEST}/root.server/usr/afs/bin/ptserver; \
242                 ${INSTALL_PROGRAM} pts ${DEST}/root.server/usr/afs/bin/pts; \
243                 ${INSTALL_PROGRAM} pts ${DEST}/bin/pts; \
244                 ${INSTALL_PROGRAM} pt_util ${DEST}/root.server/usr/afs/bin/pt_util; \
245                 ${INSTALL_PROGRAM} db_verify ${DEST}/etc/prdb_check; \
246         fi;
247         ${INSTALL_DATA} libprot.a ${DEST}/lib/afs/libprot.a
248         ${INSTALL_DATA} ${srcdir}/ptclient.h ${DEST}/include/afs/prclient.h
249         ${INSTALL_DATA} pterror.h ${DEST}/include/afs/prerror.h
250         ${INSTALL_DATA} ptint.h ${DEST}/include/afs/print.h
251         ${INSTALL_DATA} ${srcdir}/ptserver.h ${DEST}/include/afs/prserver.h
252         ${INSTALL_DATA} ${srcdir}/ptclient.h ${DEST}/include/afs/ptclient.h
253         ${INSTALL_DATA} ${srcdir}/ptuser.h ${DEST}/include/afs/ptuser.h
254         ${INSTALL_DATA} pterror.h ${DEST}/include/afs/pterror.h
255         ${INSTALL_DATA} ptint.h ${DEST}/include/afs/ptint.h
256         ${INSTALL_DATA} ${srcdir}/ptserver.h ${DEST}/include/afs/ptserver.h
257
258 #
259 # Misc. targets
260 #
261 clean:
262         $(RM) -f *.a *.o ptserver ptint.cs.c ptint.ss.c ptclient ptint.xdr.c ptint.h \
263         libprot.a pts readgroup readpwd db_verify testpt pt_util pterror.h pterror.c \
264         core AFS_component_version_number.c Kptint.cs.c Kptint.h Kptint.xdr.c
265
266 include ../config/Makefile.version