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