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