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