27455e27c4ddc36ca7f7c8c20137139bcfb54358
[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 include @TOP_OBJDIR@/src/config/Makefile.config
10
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_sleep.o \
22         osi_sysctl.o \
23         osi_vfsops.o \
24         osi_vm.o \
25         osi_vnodeops.o \
26         xdr.o \
27         xdr_array.o \
28         xdr_int64.o
29
30 AFS_OS_NFSOBJS =
31
32 AFS_OS_NONFSOBJS =
33
34
35 # System specific build commands and flags
36 CC = gcc
37 LD = ld
38 # -Wall
39 <i386_linux22 i386_linux24>
40 CCFLAGS =   -O2 -fomit-frame-pointer \
41         -fno-strength-reduce -pipe -march=i486 -malign-loops=2 -malign-jumps=2 \
42         -malign-functions=2
43 DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ${KDEFINES}
44 <alpha_linux_22 alpha_linux_24>
45 CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -mno-fp-regs -ffixed-8
46 DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
47 <s390_linux22 s390_linux24>
48 CCFLAGS =   -O -fomit-frame-pointer -fno-strength-reduce \
49         -fno-strict-aliasing -fsigned-char 
50 DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
51 <sparc_linux22 sparc_linux24>
52 LD = ld -m elf32_sparc
53 CCFLAGS =   -O2 -fomit-frame-pointer \
54         -fno-strength-reduce -pipe -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7
55 DEFINES = -D__KERNEL__  -DCPU=sparc -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
56 <sparc64_linux22 sparc64_linux24>
57 CC = sparc64-linux-gcc
58 LD = ld -m elf64_sparc
59 CCFLAGS =   -O2 -fomit-frame-pointer \
60         -fno-strength-reduce -pipe -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare
61 DEFINES = -D__KERNEL__  -DCPU=sparc64 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
62 <ppc_linux22 ppc_linux24>
63 CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
64         -fno-strict-aliasing -fsigned-char -msoft-float -pipe \
65         -fno-builtin -ffixed-r2
66 DEFINES = -D__KERNEL__  -D__powerpc__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
67 <parisc_linux24>
68 CCFLAGS =   -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -fno-strength-reduce \
69         -fno-strict-aliasing -fsigned-char -mno-space-regs -mfast-indirect-calls \
70         -mdisable-fpregs -ffunction-sections -march=1.1 -mschedule=7100
71 DEFINES = -D__KERNEL__  -D__linux__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
72 <ia64_linux24>
73 CCFLAGS =   -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe \
74         -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step
75 DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL ${SMP_DEF} -DMODULE
76 <all>
77 INCLUDES = -I. -I../ -I${TOP_OBJDIR}/src/config
78
79 CFLAGS = $(CCFLAGS) $(DEFINES) $(INCLUDES)
80
81 # Name of directory to hold object files and libraries.
82 KOBJ = MODLOAD
83 MPS = @MPS@
84
85 # COMPDIRS is called in Makefile.common to do the actual builds.
86 COMPDIRS=linux_compdirs
87 INSTDIRS=linux_instdirs
88 DESTDIRS=linux_destdirs
89
90 include Makefile.common
91
92 LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
93 LINUX_MODULE_NAME=
94 LOCAL_SMP_DEF=
95
96 setup:
97         -$(RM) -f h net netinet sys rpc
98         -ln -fs rx rpc
99         for m in ${MPS} ; do \
100                 KDIR=$(KOBJ)-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m; \
101                 mkdir -p $${KDIR}; \
102                 ln -fs ../Makefile $${KDIR}/Makefile ; \
103                 ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
104                 ln -fs ../config $${KDIR}/config; \
105         done 
106         
107 # Compile SP and MP clients as requested
108
109 ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
110         $(RM) -f h 
111         ln -fs ${LINUX_KERNEL_PATH}/include/linux h 
112         $(RM) -f linux 
113         ln -fs ${LINUX_KERNEL_PATH}/include/linux linux 
114         $(RM) -f net 
115         ln -fs ${LINUX_KERNEL_PATH}/include/linux net 
116         $(RM) -f netinet 
117         ln -fs ${LINUX_KERNEL_PATH}/include/linux netinet 
118         $(RM) -f sys
119         ln -fs ${LINUX_KERNEL_PATH}/include/linux sys
120         $(RM) -f asm-generic
121         ln -fs ${LINUX_KERNEL_PATH}/include/asm-generic asm-generic
122         $(RM) -f asm
123 <alpha_linux_22 alpha_linux_24>
124         ln -fs ${LINUX_KERNEL_PATH}/include/asm-alpha asm
125 <i386_linux22 i386_linux24>
126         ln -fs ${LINUX_KERNEL_PATH}/include/asm-i386 asm
127 <s390_linux22 s390_linux24>
128         ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm
129 <ppc_linux22 ppc_linux24>
130         ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm 
131 <sparc_linux22 sparc_linux24>
132         ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc asm
133 <sparc64_linux22 sparc64_linux24>
134         ln -fs ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm
135 <ia64_linux24>
136         ln -fs ${LINUX_KERNEL_PATH}/include/asm-ia64 asm
137 <all>
138         for m in ${MPS} ; do \
139                 KDIR=${KOBJ}-${LINUX_VERSION}${LINUX_MODULE_NAME}-$$m ; \
140                 echo Building in directory: $${KDIR} ; \
141                 if [ "$$m" = "MP" ] ; then \
142                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
143                         TARG="libafs.mp" ; \
144                 elif [ "$$m" = "EP" ] ; then \
145                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
146                         TARG="libafs.ep" ; \
147                 else  \
148                         SMP_DEF="@RHCONFIG_SP@ ${LOCAL_SMP_DEF}" ; \
149                         TARG=libafs ; \
150                 fi ; \
151                 cd $${KDIR} ; \
152                 $(MAKE) SMP_DEF="$${SMP_DEF}" $@_$${TARG} CLIENT=${LINUX_VERSION}${LINUX_MODULE_NAME} || exit $$?; \
153                 cd ../ ; \
154         done
155
156 linux_compdirs_libafs: libafs
157 linux_compdirs_libafs.mp: libafs.mp
158 linux_compdirs_libafs.ep: libafs.ep
159 linux_instdirs_libafs: install_libafs
160 linux_instdirs_libafs.mp: install_libafs.mp
161 linux_instdirs_libafs.ep: install_libafs.ep
162 linux_destdirs_libafs: dest_libafs
163 linux_destdirs_libafs.mp: dest_libafs.mp
164 linux_destdirs_libafs.ep: dest_libafs.ep
165
166
167 # Below this line are targets when in the COMMON directory:
168 # For Linux there is no kernel NFS server.
169 LIBAFS = libafs-${CLIENT}.o
170 LIBAFS_MP = libafs-${CLIENT}.mp.o
171 LIBAFS_EP = libafs-${CLIENT}.ep.o
172
173 INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
174 INST_LIBAFS_MP = ${DESTDIR}${afskerneldir}/${LIBAFS_MP}
175 INST_LIBAFS_EP = ${DESTDIR}${afskerneldir}/${LIBAFS_EP}
176
177 DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS}
178 DEST_LIBAFS_MP = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_MP}
179 DEST_LIBAFS_EP = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS_EP}
180
181
182 libafs: $(LIBAFS) 
183         echo SP Build Complete
184
185 libafs.mp: $(LIBAFS_MP)
186         echo MP Build Complete
187
188 libafs.ep: $(LIBAFS_EP)
189         echo EP Build Complete
190
191 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
192         $(RM) -f $@
193         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
194
195 ${LIBAFS_MP}: $(AFSAOBJS) $(AFSNONFSOBJS)
196         $(RM) -f $@
197         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
198
199 ${LIBAFS_EP}: $(AFSAOBJS) $(AFSNONFSOBJS)
200         $(RM) -f $@
201         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
202
203 install_libafs: $(INST_LIBAFS) 
204         echo SP Install Complete
205
206 install_libafs.mp: $(INST_LIBAFS_MP)
207         echo MP Install Complete
208
209 install_libafs.ep: $(INST_LIBAFS_EP)
210         echo EP Install Complete
211
212 dest_libafs:    $(DEST_LIBAFS) 
213         echo SP Install Complete
214
215 dest_libafs.mp: $(DEST_LIBAFS_MP)
216         echo MP Install Complete
217
218 dest_libafs.ep: $(DEST_LIBAFS_EP)
219         echo EP Install Complete
220
221 $(INST_LIBAFS): $(LIBAFS)
222         ${INSTALL} -f $? $@
223
224 $(INST_LIBAFS_MP): $(LIBAFS_MP)
225         ${INSTALL} -f $? $@
226
227 $(INST_LIBAFS_EP): $(LIBAFS_EP)
228         ${INSTALL} -f $? $@
229
230 $(DEST_LIBAFS): $(LIBAFS)
231         ${INSTALL} -f $? $@
232
233 $(DEST_LIBAFS_MP): $(LIBAFS_MP)
234         ${INSTALL} -f $? $@
235
236 $(DEST_LIBAFS_EP): $(LIBAFS_EP)
237         ${INSTALL} -f $? $@
238
239
240 # Linux specific objects
241 osi_alloc.o: $(AFS)/osi_alloc.c
242         $(CRULE1)
243 osi_cred.o: $(AFS)/osi_cred.c
244         $(CRULE1)
245 osi_groups.o: $(AFS)/osi_groups.c
246         $(CRULE1)
247 osi_file.o: $(AFS)/osi_file.c
248         $(CRULE1)
249 osi_inode.o: $(AFS)/osi_inode.c
250         $(CRULE1)
251 osi_misc.o: $(AFS)/osi_misc.c
252         $(CRULE1)
253 osi_module.o: $(AFS)/osi_module.c
254         $(CRULE1)
255 osi_sleep.o: $(AFS)/osi_sleep.c
256         $(CRULE1)
257 osi_sysctl.o: $(AFS)/osi_sysctl.c
258         $(CRULE1)
259 osi_vfsops.o: $(AFS)/osi_vfsops.c
260         $(CRULE1)
261 osi_vm.o: $(AFS)/osi_vm.c
262         $(CRULE1)
263 osi_vnodeops.o: $(AFS)/osi_vnodeops.c
264         $(CRULE1)
265 xdr.o: $(RX)/xdr.c
266         $(CRULE1)
267 xdr_int64.o: $(RX)/xdr_int64.c
268         $(CRULE1)
269 xdr_array.o: $(RX)/xdr_array.c
270         $(CRULE1)