libafs-make-subtree-during-build-for-later-use-20010829
[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 DESTDIR=@DESTDIR@
11 SRCDIR=@SRCDIR@
12 TOP_SRCDIR=@TOP_SRCDIR@
13 SYS_NAME=@AFS_SYSNAME@
14
15 include config/Makefile.${SYS_NAME}
16
17 # OS specific object files:
18 AFS_OS_OBJS = \
19         osi_alloc.o \
20         osi_cred.o \
21         osi_groups.o \
22         osi_inode.o \
23         osi_file.o \
24         osi_misc.o \
25         osi_module.o \
26         osi_sleep.o \
27         osi_vfsops.o \
28         osi_vm.o \
29         osi_vnodeops.o \
30         xdr.o \
31         xdr_array.o \
32         xdr_int64.o
33
34 AFS_OS_NFSOBJS =
35
36 AFS_OS_NONFSOBJS =
37
38
39 # System specific build commands and flags
40 CC = gcc
41 LD = ld
42 # -Wall
43 <i386_linux22 i386_linux24>
44 CCFLAGS =   -O2 -fomit-frame-pointer \
45         -fno-strength-reduce -pipe -march=i486 -malign-loops=2 -malign-jumps=2 \
46         -malign-functions=2
47 DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ${KDEFINES}
48 <alpha_linux_22 alpha_linux_24>
49 CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -mno-fp-regs -ffixed-8
50 DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
51 <s390_linux22 s390_linux24>
52 CCFLAGS =   -O -fomit-frame-pointer -fno-strength-reduce \
53         -fno-strict-aliasing -fsigned-char 
54 DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
55 <sparc_linux22 sparc_linux24>
56 LD = ld -m elf32_sparc
57 CCFLAGS =   -O2 -fomit-frame-pointer \
58         -fno-strength-reduce -pipe -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7
59 DEFINES = -D__KERNEL__  -DCPU=sparc -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
60 <sparc64_linux22 sparc64_linux24>
61 CC = sparc64-linux-gcc
62 LD = ld -m elf64_sparc
63 CCFLAGS =   -O2 -fomit-frame-pointer \
64         -fno-strength-reduce -pipe -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare
65 DEFINES = -D__KERNEL__  -DCPU=sparc64 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
66 <ppc_linux22 ppc_linux24>
67 CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
68         -fno-strict-aliasing -fsigned-char -msoft-float -pipe \
69         -fno-builtin -ffixed-r2
70 DEFINES = -D__KERNEL__  -D__powerpc__ -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_SRCDIR}/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
88 include Makefile.common
89
90 LINUX_VERS=@LINUX_VERSION@
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 -s rx rpc
98         for m in ${MPS} ; do \
99                 KDIR=$(KOBJ)-${LINUX_VERS}${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}:
109         rm -f h 
110         ln -s ${LINUX_KERNEL_PATH}/include/linux h 
111         rm -f linux 
112         ln -s ${LINUX_KERNEL_PATH}/include/linux linux 
113         rm -f net 
114         ln -s ${LINUX_KERNEL_PATH}/include/linux net 
115         rm -f netinet 
116         ln -s ${LINUX_KERNEL_PATH}/include/linux netinet 
117         rm -f sys
118         ln -s ${LINUX_KERNEL_PATH}/include/linux sys
119         rm -f asm-generic
120         ln -s ${LINUX_KERNEL_PATH}/include/asm-generic asm-generic
121         rm -f asm
122 <alpha_linux_22 alpha_linux_24>
123         ln -s ${LINUX_KERNEL_PATH}/include/asm-alpha asm
124 <i386_linux22 i386_linux24>
125         ln -s ${LINUX_KERNEL_PATH}/include/asm-i386 asm
126 <s390_linux22 s390_linux24>
127         ln -s ${LINUX_KERNEL_PATH}/include/asm-s390 asm
128 <ppc_linux22 ppc_linux24>
129         ln -s ${LINUX_KERNEL_PATH}/include/asm-ppc asm 
130 <sparc_linux22 sparc_linux24>
131         ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc asm
132 <sparc64_linux22 sparc64_linux24>
133         ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm
134 <ia64_linux24>
135         ln -s ${LINUX_KERNEL_PATH}/include/asm-ia64 asm
136 <all>
137         for m in ${MPS} ; do \
138                 KDIR=${KOBJ}-${LINUX_VERS}${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                 else  \
144                         SMP_DEF="@RHCONFIG_SP@ ${LOCAL_SMP_DEF}" ; \
145                         TARG=libafs ; \
146                 fi ; \
147                 cd $${KDIR} ; \
148                 $(MAKE) SMP_DEF="$${SMP_DEF}" $${TARG} CLIENT=${LINUX_VERS}${LINUX_MODULE_NAME} || exit $$?; \
149                 cd ../ ; \
150         done
151
152 linux_compdirs_libafs: libafs
153 linux_compdirs_libafs.mp: libafs.mp
154 linux_instdirs_libafs: install_libafs
155 linux_instdirs_libafs.mp: install_libafs.mp
156
157
158 # Below this line are targets when in the COMMON directory:
159 # For Linux there is no kernel NFS server.
160 LIBAFS = libafs-${CLIENT}.o
161 LIBAFS_MP = libafs-${CLIENT}.mp.o
162
163 DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS}
164 DEST_LIBAFS_MP = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS_MP}
165
166
167 libafs: $(LIBAFS) 
168         echo SP Build Complete
169
170 libafs.mp: $(LIBAFS_MP)
171         echo MP Build Complete
172
173 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
174         $(RM) -f $@
175         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
176
177 ${LIBAFS_MP}: $(AFSAOBJS) $(AFSNONFSOBJS)
178         $(RM) -f $@
179         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
180
181 install_libafs: $(DEST_LIBAFS) 
182         echo SP Install Complete
183
184 install_libafs.mp: $(DEST_LIBAFS_MP)
185         echo MP Install Complete
186
187 $(DEST_LIBAFS): $(LIBAFS)
188         ${INSTALL} -f $? $@
189
190 $(DEST_LIBAFS_MP): $(LIBAFS_MP)
191         ${INSTALL} -f $? $@
192
193
194 # Linux specific objects
195 osi_alloc.o: $(AFS)/osi_alloc.c
196         $(CRULE1);
197 osi_cred.o: $(AFS)/osi_cred.c
198         $(CRULE1);
199 osi_groups.o: $(AFS)/osi_groups.c
200         $(CRULE1);
201 osi_file.o: $(AFS)/osi_file.c
202         $(CRULE1);
203 osi_inode.o: $(AFS)/osi_inode.c
204         $(CRULE1);
205 osi_misc.o: $(AFS)/osi_misc.c
206         $(CRULE1);
207 osi_module.o: $(AFS)/osi_module.c
208         $(CRULE1);
209 osi_sleep.o: $(AFS)/osi_sleep.c
210         $(CRULE1);
211 osi_vfsops.o: $(AFS)/osi_vfsops.c
212         $(CRULE1);
213 osi_vm.o: $(AFS)/osi_vm.c
214         $(CRULE1);
215 osi_vnodeops.o: $(AFS)/osi_vnodeops.c
216         $(CRULE1);
217 xdr.o: $(RX)/xdr.c
218         $(CRULE1);
219 xdr_int64.o: $(RX)/xdr_int64.c
220         $(CRULE1);
221 xdr_array.o: $(RX)/xdr_array.c
222         $(CRULE1);