linux-afs-translator-xen-20060731
[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 # OS specific object files:
13 AFS_OS_OBJS = \
14         osi_alloc.o \
15         osi_cred.o \
16         osi_groups.o \
17         osi_inode.o \
18         osi_file.o \
19         osi_misc.o \
20         osi_module.o \
21         osi_probe.o \
22         osi_sleep.o \
23         osi_syscall.o \
24         osi_sysctl.o \
25         osi_vfsops.o \
26         osi_vm.o \
27 <ppc64_linux26>
28         osi_flush.o \
29 <linux26 linux_26>
30         osi_export.o \
31         osi_nfssrv.o \
32 <linux24 linux_24 linux26 linux_26>
33         osi_ioctl.o \
34         osi_proc.o \
35 <all>
36         osi_vnodeops.o 
37
38 AFS_OS_PAGOBJS = \
39         osi_alloc.o \
40         osi_cred.o \
41         osi_groups.o \
42         osi_inode.o \
43         osi_misc.o \
44         osi_probe.o \
45         osi_sleep.o \
46         osi_syscall.o \
47 <ppc64_linux26>
48         osi_flush.o \
49 <linux24 linux_24 linux26 linux_26>
50         osi_ioctl.o \
51 <all>
52         osi_pag_module.o 
53
54 AFS_OS_NFSOBJS =
55
56 AFS_OS_NONFSOBJS =
57
58 COMMON_KERN_CFLAGS=$(KERN_DBG) $(KERN_OPTMZ) @LINUX_GCC_KOPTS@
59
60 COMMON_DEFINES=-D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
61
62 LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
63
64 # System specific build commands and flags
65 <linux26 linux_26>
66 # All the platform-specific and kernel-related things are provided by
67 # the kernel build system.  So we should _not_ use COMMON_KERN_CFLAGS!
68 CCFLAGS = -Wno-strict-prototypes
69 DEFINES = $(COMMON_DEFINES)
70
71 # CFLAGS_* and AFLAGS_* will be copied into the kbuild makefile
72 CFLAGS_afs_pag_user.o = -DAFS_PAG_MANAGER
73
74 <i386_linux22 i386_linux24>
75 CCFLAGS = $(COMMON_KERN_CFLAGS) @P5PLUS_KOPTS@
76 DEFINES = $(COMMON_DEFINES) -DCPU=586
77
78 <amd64_linux24 amd64_linux26>
79 CCFLAGS = $(COMMON_KERN_CFLAGS) -mcmodel=kernel -mno-red-zone
80 DEFINES = $(COMMON_DEFINES) 
81
82 <i386_umlinux22 i386_umlinux24 i386_umlinux26>
83 CCFLAGS = $(COMMON_KERN_CFLAGS) @P5PLUS_KOPTS@ -Wno-strict-prototypes -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
84 DEFINES = $(COMMON_DEFINES) -DCPU=586
85
86 <i386_umlinux26>
87 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
88
89 <alpha_linux_22 alpha_linux_24 alpha_linux_26>
90 CCFLAGS = $(COMMON_KERN_CFLAGS) -mno-fp-regs -ffixed-8
91 DEFINES = $(COMMON_DEFINES)
92
93 <s390_linux22 s390_linux24 s390_linux26>
94 CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
95 DEFINES = $(COMMON_DEFINES) -D__s390__ 
96
97 <s390x_linux22 s390x_linux24 s390x_linux26>
98 CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char
99 DEFINES = $(COMMON_DEFINES) -D__s390x__ 
100
101 <sparc_linux22 sparc_linux24>
102 LD = ld -m elf32_sparc
103 CCFLAGS = $(COMMON_KERN_CFLAGS) -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7
104 DEFINES = $(COMMON_DEFINES) -DCPU=sparc
105
106 <sparc64_linux22 sparc64_linux24>
107 CC = sparc64-linux-gcc
108 LD = ld -m elf64_sparc
109 CCFLAGS = $(COMMON_KERN_CFLAGS) \
110       -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare
111 DEFINES = $(COMMON_DEFINES) -DCPU=sparc64
112
113 <ppc_linux22 ppc_linux24 ppc64_linux24 ppc64_linux26>
114 CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char -msoft-float -fno-builtin -ffixed-r2
115 DEFINES = $(COMMON_DEFINES) -D__powerpc__
116
117 <parisc_linux24>
118 CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char -mno-space-regs \
119       -mfast-indirect-calls -mdisable-fpregs -ffunction-sections \
120       -march=1.1 -mschedule=7100
121 DEFINES = $(COMMON_DEFINES) -D__linux__
122
123 <ia64_linux24>
124 CCFLAGS = $(COMMON_KERN_CFLAGS) -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step
125 DEFINES = $(COMMON_DEFINES)
126
127 <all>
128 INCLUDES = -I. -I../ -I${TOP_OBJDIR}/src/config \
129   -I${TOP_SRCDIR}/rx -I${TOP_OBJDIR}/src/rxstat
130
131 CFLAGS = $(CCFLAGS) $(DEFINES) $(INCLUDES)
132
133 # Name of directory to hold object files and libraries.
134 KOBJ = MODLOAD
135 MPS = @MPS@
136
137 # COMPDIRS is called in Makefile.common to do the actual builds.
138 COMPDIRS=linux_compdirs
139 INSTDIRS=linux_instdirs
140 DESTDIRS=linux_destdirs
141
142 include Makefile.common
143
144 <linux26 linux_26 umlinux26>
145 LINUX_MODULE_EXT=ko
146 <all -linux26 -linux_26 -umlinux26>
147 LINUX_MODULE_EXT=o
148 <all>
149
150 LINUX_MODULE_NAME=
151 LOCAL_SMP_DEF=
152
153 setup:
154         -$(RM) -f h net netinet sys rpc
155         -ln -fs rx rpc
156         for m in ${MPS} ; do \
157                 KDIR=$(KOBJ)-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m; \
158                 mkdir -p $${KDIR}; \
159                 ln -fs ../Makefile $${KDIR}/Makefile.afs ; \
160                 ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
161                 ln -fs ../config $${KDIR}/config; \
162         done 
163         
164 # Compile SP and MP clients as requested
165
166 ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
167         $(RM) -f h 
168         $(RM) -f sys
169         $(RM) -f netinet 
170         if [ -d ${LINUX_KERNEL_PATH}/include2 ] ; then                  \
171             ln -fs ${LINUX_KERNEL_PATH}/include2/asm/../linux h       ; \
172             ln -fs ${LINUX_KERNEL_PATH}/include2/asm/../linux sys     ; \
173             ln -fs ${LINUX_KERNEL_PATH}/include2/asm/../linux netinet ; \
174         else                                                            \
175             ln -fs ${LINUX_KERNEL_PATH}/include/linux h               ; \
176             ln -fs ${LINUX_KERNEL_PATH}/include/linux sys             ; \
177             ln -fs ${LINUX_KERNEL_PATH}/include/linux netinet         ; \
178         fi
179         $(RM) -f linux 
180         ln -fs ${LINUX_KERNEL_PATH}/include/linux linux 
181         $(RM) -f net 
182         ln -fs ${LINUX_KERNEL_PATH}/include/net net 
183         $(RM) -f asm-generic
184         ln -fs ${LINUX_KERNEL_PATH}/include/asm-generic asm-generic
185         $(RM) -f asm
186 <parisc_linux22 parisc_linux24 parisc_linux26>
187         ln -fs ${LINUX_KERNEL_PATH}/include/asm-parisc asm
188 <alpha_linux_22 alpha_linux_24 alpha_linux_26>
189         ln -fs ${LINUX_KERNEL_PATH}/include/asm-alpha asm
190 <i386_linux22 i386_linux24 i386_linux26>
191         ln -fs ${LINUX_KERNEL_PATH}/include/asm-i386 asm
192 <i386_umlinux22 i386_umlinux24 i386_umlinux26>
193         ln -fs ${LINUX_KERNEL_PATH}/include/asm-um asm
194         ln -fs ${LINUX_KERNEL_PATH}/arch/um/include/sysdep
195 <amd64_linux24 amd64_linux26>
196         ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm
197 <s390_linux22 s390_linux24 s390_linux26 s390x_linux26>
198         ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm
199 <s390x_linux22 s390x_linux24 s390x_linux26>
200         ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390x asm
201 <ppc_linux22 ppc_linux24 ppc_linux26>
202         ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm 
203 <ppc64_linux24 ppc64_linux26>
204         ln -s ${LINUX_KERNEL_PATH}/include/asm-ppc64 asm 
205 <sparc_linux22 sparc_linux24 sparc_linux26>
206         ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc asm
207 <sparc64_linux22 sparc64_linux24 sparc64_linux26>
208         ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm
209 <ia64_linux24 ia64_linux26>
210         ln -fs ${LINUX_KERNEL_PATH}/include/asm-ia64 asm
211 <all>
212         for m in ${MPS} ; do \
213                 KDIR=${KOBJ}-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m ; \
214                 echo Building in directory: $${KDIR} ; \
215                 if [ "$$m" = "MP" ] ; then \
216                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
217                         TARG="libafs.mp" ; \
218                 elif [ "$$m" = "EP" ] ; then \
219                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
220                         TARG="libafs.ep" ; \
221                 elif [ "$$m" = "BM" ] ; then \
222                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
223                         TARG="libafs.bm" ; \
224                 else  \
225                         SMP_DEF="@RHCONFIG_SP@ ${LOCAL_SMP_DEF}" ; \
226                         TARG=libafs ; \
227                 fi ; \
228                 cd $${KDIR} ; \
229                 $(MAKE) -f Makefile.afs SMP_DEF="$${SMP_DEF}" $@_$${TARG} CLIENT=${LINUX_VERSION}${LINUX_MODULE_NAME} KDIR=$${KDIR} || exit $$?; \
230                 cd ../ ; \
231 <all>
232         done
233
234 linux_compdirs_libafs: depsrcs libafs
235 linux_compdirs_libafs.mp: depsrcs libafs.mp
236 linux_compdirs_libafs.ep: depsrcs libafs.ep
237 linux_compdirs_libafs.bm: depsrcs libafs.bm
238 linux_instdirs_libafs: install_libafs
239 linux_instdirs_libafs.mp: install_libafs.mp
240 linux_instdirs_libafs.ep: install_libafs.ep
241 linux_instdirs_libafs.bm: install_libafs.bm
242 linux_destdirs_libafs: dest_libafs
243 linux_destdirs_libafs.mp: dest_libafs.mp
244 linux_destdirs_libafs.ep: dest_libafs.ep
245 linux_destdirs_libafs.bm: dest_libafs.bm
246
247
248 # Below this line are targets when in the COMMON directory:
249 # For Linux there is no kernel NFS server.
250 LIBAFS = libafs-${CLIENT}.${LINUX_MODULE_EXT}
251 LIBAFS_MP = libafs-${CLIENT}.mp.${LINUX_MODULE_EXT}
252 LIBAFS_EP = libafs-${CLIENT}.ep.${LINUX_MODULE_EXT}
253 LIBAFS_BM = libafs-${CLIENT}.bm.${LINUX_MODULE_EXT}
254
255 INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
256 INST_LIBAFS_MP = ${DESTDIR}${afskerneldir}/${LIBAFS_MP}
257 INST_LIBAFS_EP = ${DESTDIR}${afskerneldir}/${LIBAFS_EP}
258 INST_LIBAFS_BM = ${DESTDIR}${afskerneldir}/${LIBAFS_BM}
259
260 DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS}
261 DEST_LIBAFS_MP = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_MP}
262 DEST_LIBAFS_EP = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_EP}
263 DEST_LIBAFS_BM = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_BM}
264
265
266 libafs: $(LIBAFS) 
267         echo SP Build Complete
268
269 libafs.mp: $(LIBAFS_MP)
270         echo MP Build Complete
271
272 libafs.ep: $(LIBAFS_EP)
273         echo EP Build Complete
274
275 libafs.bm: $(LIBAFS_BM)
276         echo BM Build Complete
277
278 <linux26 linux_26 umlinux26>
279 ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: libafs.ko
280         cp libafs.ko $@
281
282 .FORCE:
283 libafs.ko afspag.ko: .FORCE
284         env EXTRA_CFLAGS="${EXTRA_CFLAGS}" @TOP_SRCDIR@/libafs/make_kbuild_makefile.pl ${KDIR} @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
285         env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules
286         
287 <all -linux26 -linux_26 -umlinux26>
288 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
289         $(RM) -f $@
290         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
291
292 ${LIBAFS_MP}: $(AFSAOBJS) $(AFSNONFSOBJS)
293         $(RM) -f $@
294         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
295
296 ${LIBAFS_EP}: $(AFSAOBJS) $(AFSNONFSOBJS)
297         $(RM) -f $@
298         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
299
300 ${LIBAFS_BM}: $(AFSAOBJS) $(AFSNONFSOBJS)
301         $(RM) -f $@
302         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
303 <all>
304
305 install_libafs: $(INST_LIBAFS) 
306         echo SP Install Complete
307
308 install_libafs.mp: $(INST_LIBAFS_MP)
309         echo MP Install Complete
310
311 install_libafs.ep: $(INST_LIBAFS_EP)
312         echo EP Install Complete
313
314 install_libafs.bm: $(INST_LIBAFS_BM)
315         echo BM Install Complete
316
317 dest_libafs:    $(DEST_LIBAFS) 
318         echo SP Install Complete
319
320 dest_libafs.mp: $(DEST_LIBAFS_MP)
321         echo MP Install Complete
322
323 dest_libafs.ep: $(DEST_LIBAFS_EP)
324         echo EP Install Complete
325
326 dest_libafs.bm: $(DEST_LIBAFS_BM)
327         echo BM Install Complete
328
329 $(INST_LIBAFS): $(LIBAFS)
330         ${INSTALL} -f $? $@
331
332 $(INST_LIBAFS_MP): $(LIBAFS_MP)
333         ${INSTALL} -f $? $@
334
335 $(INST_LIBAFS_EP): $(LIBAFS_EP)
336         ${INSTALL} -f $? $@
337
338 $(INST_LIBAFS_BM): $(LIBAFS_BM)
339         ${INSTALL} -f $? $@
340
341 $(DEST_LIBAFS): $(LIBAFS)
342         ${INSTALL} -f $? $@
343
344 $(DEST_LIBAFS_MP): $(LIBAFS_MP)
345         ${INSTALL} -f $? $@
346
347 $(DEST_LIBAFS_EP): $(LIBAFS_EP)
348         ${INSTALL} -f $? $@
349
350 $(DEST_LIBAFS_BM): $(LIBAFS_BM)
351         ${INSTALL} -f $? $@