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