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