LINUX: Avoid building rand-fortuna-kernel.o
[openafs.git] / src / libafs / MakefileProto.LINUX.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 srcdir=@srcdir@
9
10 include @TOP_OBJDIR@/src/config/Makefile.config
11
12 INSTALL = @INSTALL@
13 INSTALL_DATA = @INSTALL_DATA@
14 INSTALL_PROGRAM = @INSTALL_PROGRAM@
15 INSTALL_SCRIPT = @INSTALL_SCRIPT@
16
17 AFS_OS_CLEAN = .makelog
18
19 # OS specific object files:
20 AFS_OS_OBJS = \
21         osi_alloc.o \
22         osi_cred.o \
23         osi_crypto.o \
24         osi_gcpags.o \
25         osi_groups.o \
26         osi_inode.o \
27         osi_file.o \
28         osi_misc.o \
29         osi_module.o \
30         osi_probe.o \
31         osi_sleep.o \
32         osi_syscall.o \
33         osi_sysctl.o \
34         osi_vcache.o \
35         osi_vfsops.o \
36         osi_vm.o \
37 <ppc64_linux26>
38         osi_flush.o \
39 <all>
40         osi_export.o \
41         osi_nfssrv.o \
42         osi_ioctl.o \
43         osi_proc.o \
44         osi_vnodeops.o \
45         osi_pagecopy.o
46
47 AFS_OS_PAGOBJS = \
48         osi_alloc.o \
49         osi_cred.o \
50         osi_crypto.o \
51         osi_gcpags.o \
52         osi_groups.o \
53         osi_inode.o \
54         osi_misc.o \
55         osi_probe.o \
56         osi_sleep.o \
57         osi_syscall.o \
58 <ppc64_linux26>
59         osi_flush.o \
60 <all>
61         osi_ioctl.o \
62         osi_pag_module.o 
63
64 AFS_OS_NFSOBJS =
65
66 AFS_OS_NONFSOBJS =
67
68 COMMON_KERN_CFLAGS=$(KERN_DBG) $(KERN_OPTMZ) @LINUX_GCC_KOPTS@
69
70 COMMON_DEFINES=-D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
71
72 LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
73 LINUX_KERNEL_BUILD=@LINUX_KERNEL_BUILD@
74
75 CFLAGS_fcrypt.o = -I${TOP_SRCDIR}/rxkad -I$(TOP_OBJDIR)/src/rxkad
76 CFLAGS_crypt_conn.o = -I${TOP_SRCDIR}/rxkad -I$(TOP_OBJDIR)/src/rxkad
77 CFLAGS_rxkad_client.o = -I${TOP_SRCDIR}/rxkad -I$(TOP_OBJDIR)/src/rxkad
78 CFLAGS_rxkad_common.o = -I${TOP_SRCDIR}/rxkad -I$(TOP_OBJDIR)/src/rxkad
79 CFLAGS_opr_rbtree.o = -I${TOP_SRCDIR}/opr
80
81 CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
82                -DHAVE_CONFIG_H
83 CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
84 CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
85 CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
86 CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
87 CFLAGS_aes.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
88 CFLAGS_rijndael-alg-fst.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
89                             -DNO_CONFIG_H
90 CFLAGS_sha.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
91 CFLAGS_sha256-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
92 CFLAGS_md5.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
93 CFLAGS_random.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
94
95 RFC3961_INCLUDES = -I$(TOP_SRCDIR)/crypto/rfc3961 \
96                    -I$(TOP_SRCDIR)/external/heimdal/krb5
97
98 CFLAGS_crypto.o = $(RFC3961_INCLUDES)
99 CFLAGS_crypto-aes.o = $(RFC3961_INCLUDES)
100 CFLAGS_crypto-context.o = $(RFC3961_INCLUDES)
101 CFLAGS_crypto-copy.o = $(RFC3961_INCLUDES)
102 CFLAGS_crypto-ct.o = $(RFC3961_INCLUDES)
103 CFLAGS_crypto-evp.o = $(RFC3961_INCLUDES)
104 CFLAGS_crypto-data.o = $(RFC3961_INCLUDES)
105 CFLAGS_crypto-keyblock.o = $(RFC3961_INCLUDES)
106 CFLAGS_crypto-store-int.o = $(RFC3961_INCLUDES)
107 CFLAGS_crypto-random.o = $(RFC3961_INCLUDES)
108 CFLAGS_crypto-algs.o = $(RFC3961_INCLUDES)
109 CFLAGS_n-fold.o = $(RFC3961_INCLUDES)
110
111 # System specific build commands and flags
112 <linux26 linux_26>
113 # All the platform-specific and kernel-related things are provided by
114 # the kernel build system.  So we should _not_ use COMMON_KERN_CFLAGS!
115 CCFLAGS =
116 DEFINES = $(COMMON_DEFINES)
117
118 # CFLAGS_* and AFLAGS_* will be copied into the kbuild makefile
119 CFLAGS_afs_pag_user.o = -DAFS_PAG_MANAGER
120
121 <i386_umlinux26>
122 EXTRA_CFLAGS = -I$(LINUX_KERNEL_PATH)/arch/um/include -I$(LINUX_KERNEL_PATH)/arch/um/kernel/tt/include -I$(LINUX_KERNEL_PATH)/arch/um/kernel/skas/include
123
124 <all>
125 INCLUDES = -I. -I../ -I${TOP_OBJDIR}/src/config \
126   -I${TOP_SRCDIR}/rx -I${TOP_OBJDIR}/src/rxstat
127
128 CFLAGS = $(CCFLAGS) $(KERN_DBG) $(DEFINES) $(INCLUDES) @CFLAGS_WERROR@
129
130 # Name of directory to hold object files and libraries.
131 KOBJ = MODLOAD
132 MPS = @MPS@
133
134 # COMPDIRS is called in Makefile.common to do the actual builds.
135 COMPDIRS=linux_compdirs
136 INSTDIRS=linux_instdirs
137 DESTDIRS=linux_destdirs
138
139 include Makefile.common
140
141 <linux26 linux_26 umlinux26>
142 LINUX_MODULE_EXT=ko
143 <all -linux26 -linux_26 -umlinux26>
144 LINUX_MODULE_EXT=o
145 <all>
146
147 LINUX_MODULE_NAME=
148 LOCAL_SMP_DEF=
149
150 setup:
151         -$(RM) -f h net netinet sys rpc
152         -ln -fs rx rpc
153         for m in ${MPS} ; do \
154                 KDIR=$(KOBJ)-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m; \
155                 mkdir -p $${KDIR}; \
156                 ln -fs ../Makefile $${KDIR}/Makefile.afs ; \
157                 ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
158                 ln -fs ../config $${KDIR}/config; \
159         done 
160
161 # Compile SP and MP clients as requested
162
163 ${INSTDIRS} ${DESTDIRS}: ${COMPDIRS}
164         if [ "${LINUX_KERNEL_PACKAGING}" ] ; then \
165             TARGPREFIX="pack_"; \
166         fi ; \
167         for m in ${MPS} ; do \
168                 KDIR=${KOBJ}-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m ; \
169                 echo Building in directory: $${KDIR} ; \
170                 if [ "$$m" = "MP" ] ; then \
171                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
172                         TARG="libafs.mp" ; \
173                 elif [ "$$m" = "EP" ] ; then \
174                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
175                         TARG="libafs.ep" ; \
176                 elif [ "$$m" = "BM" ] ; then \
177                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
178                         TARG="libafs.bm" ; \
179                 else  \
180                         SMP_DEF="@RHCONFIG_SP@ ${LOCAL_SMP_DEF}" ; \
181                         TARG=libafs ; \
182                 fi ; \
183                 cd $${KDIR} ; \
184                 $(MAKE) -f Makefile.afs SMP_DEF="$${SMP_DEF}" $@_$${TARGPREFIX}$${TARG} CLIENT=${LINUX_VERSION}${LINUX_MODULE_NAME} KDIR=$${KDIR} || exit $$?; \
185                 cd ../ ; \
186         done
187
188 ${COMPDIRS}: setup
189         $(RM) -f h 
190         $(RM) -f sys
191         $(RM) -f netinet 
192         if [ -d ${LINUX_KERNEL_PATH}/include2 ] ; then                  \
193             ln -fs ${LINUX_KERNEL_PATH}/include2/asm/../linux h       ; \
194             ln -fs ${LINUX_KERNEL_PATH}/include2/asm/../linux sys     ; \
195             ln -fs ${LINUX_KERNEL_PATH}/include2/asm/../linux netinet ; \
196         else                                                            \
197             ln -fs ${LINUX_KERNEL_PATH}/include/linux h               ; \
198             ln -fs ${LINUX_KERNEL_PATH}/include/linux sys             ; \
199             ln -fs ${LINUX_KERNEL_PATH}/include/linux netinet         ; \
200         fi
201         $(RM) -f linux 
202         ln -fs ${LINUX_KERNEL_PATH}/include/linux linux 
203         $(RM) -f net 
204         ln -fs ${LINUX_KERNEL_PATH}/include/net net 
205         $(RM) -f asm-generic
206         ln -fs ${LINUX_KERNEL_PATH}/include/asm-generic asm-generic
207         $(RM) -f asm
208 <parisc_linux26>
209         ln -fs ${LINUX_KERNEL_PATH}/include/asm-parisc asm
210 <alpha_linux_26>
211         ln -fs ${LINUX_KERNEL_PATH}/include/asm-alpha asm
212 <i386_linux26>
213         ln -fs ${LINUX_KERNEL_PATH}/include/asm-i386 asm
214 <i386_umlinux26>
215         ln -fs ${LINUX_KERNEL_PATH}/include/asm-um asm
216         ln -fs ${LINUX_KERNEL_PATH}/arch/um/include/sysdep
217 <amd64_linux26>
218         ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm
219 <s390_linux26>
220         ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm
221 <s390x_linux26>
222         ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390x asm
223 <ppc_linux26>
224         ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm 
225 <ppc64_linux26>
226         ln -s ${LINUX_KERNEL_PATH}/include/asm-ppc64 asm 
227 <sparc_linux26>
228         ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc asm
229 <sparc64_linux26>
230         ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm
231 <ia64_linux26>
232         ln -fs ${LINUX_KERNEL_PATH}/include/asm-ia64 asm
233 <all>
234         if [ "${LINUX_KERNEL_PACKAGING}" ] ; then \
235             TARGPREFIX="pack_"; \
236         fi ; \
237         for m in ${MPS} ; do \
238                 KDIR=${KOBJ}-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m ; \
239                 echo Building in directory: $${KDIR} ; \
240                 if [ "$$m" = "MP" ] ; then \
241                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
242                         TARG="libafs.mp" ; \
243                 elif [ "$$m" = "EP" ] ; then \
244                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
245                         TARG="libafs.ep" ; \
246                 elif [ "$$m" = "BM" ] ; then \
247                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
248                         TARG="libafs.bm" ; \
249                 else  \
250                         SMP_DEF="@RHCONFIG_SP@ ${LOCAL_SMP_DEF}" ; \
251                         TARG=libafs ; \
252                 fi ; \
253                 cd $${KDIR} ; \
254                 $(MAKE) -f Makefile.afs SMP_DEF="$${SMP_DEF}" $@_$${TARGPREFIX}$${TARG} CLIENT=${LINUX_VERSION}${LINUX_MODULE_NAME} KDIR=$${KDIR} || exit $$?; \
255                 cd ../ ; \
256 <all>
257         done
258
259 linux_compdirs_libafs: depsrcs libafs
260 linux_compdirs_libafs.mp: depsrcs libafs.mp
261 linux_compdirs_libafs.ep: depsrcs libafs.ep
262 linux_compdirs_libafs.bm: depsrcs libafs.bm
263 linux_instdirs_libafs: install_libafs
264 linux_instdirs_libafs.mp: install_libafs.mp
265 linux_instdirs_libafs.ep: install_libafs.ep
266 linux_instdirs_libafs.bm: install_libafs.bm
267 linux_destdirs_libafs: dest_libafs
268 linux_destdirs_libafs.mp: dest_libafs.mp
269 linux_destdirs_libafs.ep: dest_libafs.ep
270 linux_destdirs_libafs.bm: dest_libafs.bm
271
272 linux_compdirs_pack_libafs: depsrcs pack_libafs
273 linux_instdirs_pack_libafs: install_pack_libafs
274 linux_destdirs_pack_libafs: dest_pack_libafs
275
276 # Below this line are targets when in the COMMON directory:
277 # For Linux there is no kernel NFS server.
278 LIBAFS = ${LINUX_LIBAFS_NAME}-${CLIENT}.${LINUX_MODULE_EXT}
279 LIBAFS_MP = ${LINUX_LIBAFS_NAME}-${CLIENT}.mp.${LINUX_MODULE_EXT}
280 LIBAFS_EP = ${LINUX_LIBAFS_NAME}-${CLIENT}.ep.${LINUX_MODULE_EXT}
281 LIBAFS_BM = ${LINUX_LIBAFS_NAME}-${CLIENT}.bm.${LINUX_MODULE_EXT}
282
283 INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
284 INST_LIBAFS_MP = ${DESTDIR}${afskerneldir}/${LIBAFS_MP}
285 INST_LIBAFS_EP = ${DESTDIR}${afskerneldir}/${LIBAFS_EP}
286 INST_LIBAFS_BM = ${DESTDIR}${afskerneldir}/${LIBAFS_BM}
287
288 DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS}
289 DEST_LIBAFS_MP = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_MP}
290 DEST_LIBAFS_EP = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_EP}
291 DEST_LIBAFS_BM = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_BM}
292
293 SYSTEM_LIBAFS = /lib/modules/${CLIENT}/extra/${LINUX_LIBAFS_NAME}/${LINUX_LIBAFS_NAME}.ko
294
295 INST_SYSTEM = ${DESTDIR}${SYSTEM_LIBAFS}
296 DEST_SYSTEM = ${DEST}/root.client${SYSTEM_LIBAFS}
297
298 SPARSE_MAKEFLAGS = @SPARSE_MAKEFLAGS@
299
300 libafs: $(LIBAFS) 
301         echo SP Build Complete
302
303 libafs.mp: $(LIBAFS_MP)
304         echo MP Build Complete
305
306 libafs.ep: $(LIBAFS_EP)
307         echo EP Build Complete
308
309 libafs.bm: $(LIBAFS_BM)
310         echo BM Build Complete
311
312 <linux26 linux_26 umlinux26>
313 pack_libafs: ${LINUX_LIBAFS_NAME}.ko
314         echo "Packaging Friendly Build Complete"
315
316 ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: ${LINUX_LIBAFS_NAME}.ko
317         cp ${LINUX_LIBAFS_NAME}.ko $@
318
319 .FORCE:
320 ${LINUX_LIBAFS_NAME}.ko afspag.ko: .FORCE
321         env EXTRA_CFLAGS="${EXTRA_CFLAGS}" @TOP_SRCDIR@/libafs/make_kbuild_makefile.pl ${KDIR} $@ @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
322         ( env EXTRA_CFLAGS="${EXTRA_CFLAGS}" \
323                 $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} $(SPARSE_MAKEFLAGS) modules 2>&1 \
324                 || echo "FAILURE: make exit code $$?" ) | tee .makelog
325         @if grep -E -q '^(FAILURE|WARNING)' .makelog; then \
326                 grep -q '^WARNING' .makelog && echo "Error: Undefined symbols in modules" ; \
327                 rm .makelog ; \
328                 exit 1 ; \
329         fi
330         rm .makelog
331
332 <all -linux26 -linux_26 -umlinux26>
333 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
334         $(RM) -f $@
335         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
336
337 ${LIBAFS_MP}: $(AFSAOBJS) $(AFSNONFSOBJS)
338         $(RM) -f $@
339         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
340
341 ${LIBAFS_EP}: $(AFSAOBJS) $(AFSNONFSOBJS)
342         $(RM) -f $@
343         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
344
345 ${LIBAFS_BM}: $(AFSAOBJS) $(AFSNONFSOBJS)
346         $(RM) -f $@
347         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
348 <all>
349
350 install_libafs: $(LIBAFS) 
351         ${INSTALL} -d ${DESTDIR}${afskerneldir}
352         ${INSTALL} -m 644 $(LIBAFS) $(INST_LIBAFS)
353         echo SP Install Complete
354
355 install_pack_libafs: $(LINUX_LIBAFS_NAME).ko
356         ${INSTALL} -d ${DESTDIR}/lib/modules/${CLIENT}/extra/${LINUX_LIBAFS_NAME}
357         ${INSTALL} -m 644 $(LINUX_LIBAFS_NAME).ko $(INST_SYSTEM)
358         echo Packaging Friendly Install Complete
359
360 install_libafs.mp: $(LIBAFS_MP)
361         ${INSTALL} -d ${DESTDIR}${afskerneldir}
362         ${INSTALL} -m 644 $(LIBAFS_MP) $(INST_LIBAFS_MP)
363         echo MP Install Complete
364
365 install_libafs.ep: $(LIBAFS_EP)
366         ${INSTALL} -d ${DESTDIR}${afskerneldir}
367         ${INSTALL} -m 644 $(LIBAFS_EP) $(INST_LIBAFS_EP)
368         echo EP Install Complete
369
370 install_libafs.bm: $(LIBAFS_BM)
371         ${INSTALL} -d ${DESTDIR}${afskerneldir}
372         ${INSTALL} -m 644 $(LIBAFS_BM) $(INST_LIBAFS_BM)
373         echo BM Install Complete
374
375 dest_libafs:    $(LIBAFS) 
376         ${INSTALL} -d ${DEST}/root.client/usr/vice/etc/modload
377         ${INSTALL} -m 644 $(LIBAFS) $(DEST_LIBAFS)
378         echo SP Install Complete
379
380 dest_pack_libafs: $(LINUX_LIBAFS_NAME).ko
381         ${INSTALL} -d ${DEST}/root.client/lib/modules/${CLIENT}/extra/${LINUX_LIBAFS_NAME}
382         ${INSTALL} -m 644 $(LINUX_LIBAFS_NAME).ko $(DEST_SYSTEM)
383         echo Packaging Friendly Install Complete
384
385 dest_libafs.mp: $(LIBAFS_MP)
386         ${INSTALL} -d ${DEST}/root.client/usr/vice/etc/modload
387         ${INSTALL} -m 644 $(LIBAFS_MP) $(DEST_LIBAFS_MP)
388         echo MP Install Complete
389
390 dest_libafs.ep: $(LIBAFS_EP)
391         ${INSTALL} -d ${DEST}/root.client/usr/vice/etc/modload
392         ${INSTALL} -m 644 $(LIBAFS_EP) $(DEST_LIBAFS_EP)
393         echo EP Install Complete
394
395 dest_libafs.bm: $(LIBAFS_BM)
396         ${INSTALL} -d ${DEST}/root.client/usr/vice/etc/modload
397         ${INSTALL} -m 644 $(LIBAFS_BM) $(DEST_LIBAFS_BM)
398         echo BM Install Complete