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