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