eaf052cbccf9928275f8210206d4ae75b2a208d1
[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
33 AFS_OS_NFSOBJS =
34
35 AFS_OS_NONFSOBJS =
36
37
38 # System specific build commands and flags
39 CC = gcc
40 LD = ld
41 # -Wall
42 <i386_linux22 i386_linux24>
43 CCFLAGS =   -O2 -fomit-frame-pointer \
44         -fno-strength-reduce -pipe -march=i486 -malign-loops=2 -malign-jumps=2 \
45         -malign-functions=2
46 DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ${KDEFINES}
47 <alpha_linux_22 alpha_linux_24>
48 CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -mno-fp-regs -ffixed-8
49 DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
50 <s390_linux22 s390_linux24>
51 CCFLAGS =   -O -fomit-frame-pointer -fno-strength-reduce \
52         -fno-strict-aliasing -fsigned-char 
53 DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
54 <sparc_linux22 sparc_linux24>
55 LD = ld -m elf32_sparc
56 CCFLAGS =   -O2 -fomit-frame-pointer \
57         -fno-strength-reduce -pipe -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7
58 DEFINES = -D__KERNEL__  -DCPU=sparc -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
59 <sparc64_linux22 sparc64_linux24>
60 CC = sparc64-linux-gcc
61 LD = ld -m elf64_sparc
62 CCFLAGS =   -O2 -fomit-frame-pointer \
63         -fno-strength-reduce -pipe -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare
64 DEFINES = -D__KERNEL__  -DCPU=sparc64 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
65 <ppc_linux22 ppc_linux24>
66 CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
67         -fno-strict-aliasing -fsigned-char -msoft-float -pipe \
68         -fno-builtin -ffixed-r2
69 DEFINES = -D__KERNEL__  -D__powerpc__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
70 <all>
71 INCLUDES = -I. -I../ -I${TOP_SRCDIR}/config
72
73 CFLAGS = $(CCFLAGS) $(DEFINES) $(INCLUDES)
74
75 # Name of directory to hold object files and libraries.
76 KOBJ = MODLOAD
77 MPS = @MPS@
78
79 # COMPDIRS is called in Makefile.common to do the actual builds.
80 COMPDIRS=linux_compdirs
81
82 include Makefile.common
83
84 LINUX_VERS=@LINUX_VERSION@
85 LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
86 LINUX_MODULE_NAME=
87 LOCAL_SMP_DEF=
88
89 setup:
90         -rm -f h net netinet sys rpc
91         -ln -s rx rpc
92         for m in ${MPS} ; do \
93                 KDIR=$(KOBJ)-${LINUX_VERS}${LINUX_MODULE_NAME}-$$m; \
94                 mkdir -p $${KDIR}; \
95                 ln -fs ../Makefile $${KDIR}/Makefile ; \
96                 ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
97         done 
98         
99 # Compile SP and MP clients as requested
100
101 ${COMPDIRS}:
102         rm -f h 
103         ln -s ${LINUX_KERNEL_PATH}/include/linux h 
104         rm -f linux 
105         ln -s ${LINUX_KERNEL_PATH}/include/linux linux 
106         rm -f net 
107         ln -s ${LINUX_KERNEL_PATH}/include/linux net 
108         rm -f netinet 
109         ln -s ${LINUX_KERNEL_PATH}/include/linux netinet 
110         rm -f sys
111         ln -s ${LINUX_KERNEL_PATH}/include/linux sys
112         rm -f asm-generic
113         ln -s ${LINUX_KERNEL_PATH}/include/asm-generic asm-generic
114         rm -f asm
115 <alpha_linux_22 alpha_linux_24>
116         ln -s ${LINUX_KERNEL_PATH}/include/asm-alpha asm
117 <i386_linux22 i386_linux24>
118         ln -s ${LINUX_KERNEL_PATH}/include/asm-i386 asm
119 <s390_linux22 s390_linux24>
120         ln -s ${LINUX_KERNEL_PATH}/include/asm-s390 asm
121 <ppc_linux22 ppc_linux24>
122         ln -s ${LINUX_KERNEL_PATH}/include/asm-ppc asm 
123 <sparc_linux22 sparc_linux24>
124         ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc asm
125 <sparc64_linux22 sparc64_linux24>
126         ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm
127 <all>
128         for m in ${MPS} ; do \
129                 KDIR=${KOBJ}-${LINUX_VERS}${LINUX_MODULE_NAME}-$$m ; \
130                 echo Building in directory: $${KDIR} ; \
131                 if [ "$$m" = "MP" ] ; then \
132                         SMP_DEF="-DAFS_SMP @RHCONFIG_MP@ ${LOCAL_SMP_DEF}" ; \
133                         TARG="libafs.mp" ; \
134                 else  \
135                         SMP_DEF="@RHCONFIG_SP@ ${LOCAL_SMP_DEF}" ; \
136                         TARG=libafs ; \
137                 fi ; \
138                 cd $${KDIR} ; \
139                 $(MAKE) SMP_DEF="$${SMP_DEF}" $${TARG} CLIENT=${LINUX_VERS}${LINUX_MODULE_NAME} || exit $$?; \
140                 cd ../ ; \
141         done
142
143
144 # Below this line are targets when in the COMMON directory:
145 # For Linux there is no kernel NFS server.
146 LIBAFS = libafs-${CLIENT}.o
147 LIBAFS_MP = libafs-${CLIENT}.mp.o
148
149 DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS}
150 DEST_LIBAFS_MP = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS_MP}
151
152
153 libafs: $(DEST_LIBAFS) 
154         echo SP Build Complete
155
156 libafs.mp: $(DEST_LIBAFS_MP)
157         echo MP Build Complete
158
159 $(DEST_LIBAFS): $(LIBAFS)
160         ${INSTALL} -f $? $@
161
162 $(DEST_LIBAFS_MP): $(LIBAFS_MP)
163         ${INSTALL} -f $? $@
164
165 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
166         $(RM) -f $@
167         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
168
169 ${LIBAFS_MP}: $(AFSAOBJS) $(AFSNONFSOBJS)
170         $(RM) -f $@
171         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
172
173
174 # Linux specific objects
175 osi_alloc.o: $(AFS)/osi_alloc.c
176         $(CRULE1);
177 osi_cred.o: $(AFS)/osi_cred.c
178         $(CRULE1);
179 osi_groups.o: $(AFS)/osi_groups.c
180         $(CRULE1);
181 osi_file.o: $(AFS)/osi_file.c
182         $(CRULE1);
183 osi_inode.o: $(AFS)/osi_inode.c
184         $(CRULE1);
185 osi_misc.o: $(AFS)/osi_misc.c
186         $(CRULE1);
187 osi_module.o: $(AFS)/osi_module.c
188         $(CRULE1);
189 osi_sleep.o: $(AFS)/osi_sleep.c
190         $(CRULE1);
191 osi_vfsops.o: $(AFS)/osi_vfsops.c
192         $(CRULE1);
193 osi_vm.o: $(AFS)/osi_vm.c
194         $(CRULE1);
195 osi_vnodeops.o: $(AFS)/osi_vnodeops.c
196         $(CRULE1);
197 xdr.o: $(RX)/xdr.c
198         $(CRULE1);
199 xdr_int64.o: $(RX)/xdr_int64.c
200         $(CRULE1);
201 xdr_array.o: $(RX)/xdr_array.c
202         $(CRULE1);