linux-kernel-extra-definitions-for-sp-versus-mp-20010422
[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_array.o
29
30 AFS_OS_NFSOBJS =
31
32 AFS_OS_NONFSOBJS =
33
34
35 # System specific build commands and flags
36 CC = gcc
37 LD = ld
38 # -Wall
39 <i386_linux22 i386_linux24>
40 CCFLAGS =   -O2 -fomit-frame-pointer \
41         -fno-strength-reduce -pipe -march=i486 -malign-loops=2 -malign-jumps=2 \
42         -malign-functions=2
43 DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
44 <alpha_linux_22 alpha_linux_24>
45 CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -mno-fp-regs -ffixed-8
46 DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
47 <s390_linux22 s390_linux24>
48 CCFLAGS =   -O -fomit-frame-pointer -fno-strength-reduce \
49         -fno-strict-aliasing -fsigned-char 
50 DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
51 <sparc_linux22 sparc_linux24>
52 LD = ld -m elf32_sparc
53 CCFLAGS =   -O2 -fomit-frame-pointer \
54         -fno-strength-reduce -pipe -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7
55 DEFINES = -D__KERNEL__  -DCPU=sparc -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
56 <sparc64_linux22 sparc64_linux24>
57 CC = sparc64-linux-gcc
58 LD = ld -m elf64_sparc
59 CCFLAGS =   -O2 -fomit-frame-pointer \
60         -fno-strength-reduce -pipe -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare
61 DEFINES = -D__KERNEL__  -DCPU=sparc64 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
62 <ppc_linux22 ppc_linux24>
63 CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
64         -fno-strict-aliasing -fsigned-char -msoft-float -pipe \
65         -fno-builtin -ffixed-r2
66 DEFINES = -D__KERNEL__  -D__powerpc__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
67 <all>
68 INCLUDES = -I. -I../
69
70 CFLAGS = $(CCFLAGS) $(DEFINES) $(INCLUDES)
71
72 # Name of directory to hold object files and libraries.
73 KOBJ = MODLOAD
74 MPS = MP SP
75
76 # COMPDIRS is called in Makefile.common to do the actual builds.
77 COMPDIRS=linux_compdirs
78
79
80 include Makefile.common
81
82 setup:
83         -rm -f h net netinet sys rpc
84         -ln -s rx rpc
85         for v in ${LINUX_VERS} ; do \
86                 for m in ${MPS} ; do \
87                         KDIR=$(KOBJ)-$$v-$$m; \
88                         mkdir -p $${KDIR}; \
89                         ln -fs ../Makefile $${KDIR}/Makefile ; \
90                         ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
91                 done \
92         done
93         
94 # Compile SP and MP clients as requested
95
96 LINUX_INCDIR=include/linux
97
98 ${COMPDIRS}:
99         for v in ${LINUX_VERS} ; do \
100                 IDIR=${LINUX_SRCDIR}$$v/${LINUX_INCDIR}; \
101                 rm -f h; \
102                 ln -s $${IDIR} h; \
103                 rm -f linux; \
104                 ln -s $${IDIR} linux; \
105                 rm -f net; \
106                 ln -s $${IDIR} net; \
107                 rm -f netinet; \
108                 ln -s $${IDIR} netinet; \
109                 rm -f sys; \
110                 ln -s $${IDIR} sys; \
111                 rm -f asm-generic; \
112                 ln -s ${LINUX_SRCDIR}$$v/include/asm-generic asm-generic; \
113                 rm -f asm; \
114 <alpha_linux_22 alpha_linux_24>
115                 ln -s ${LINUX_SRCDIR}$$v/include/asm-alpha asm ; \
116 <i386_linux22 i386_linux24>
117                 ln -s ${LINUX_SRCDIR}$$v/include/asm-i386 asm ; \
118 <s390_linux22 s390_linux24>
119                 ln -s ${LINUX_SRCDIR}$$v/include/asm-s390 asm ; \
120 <ppc_linux22 ppc_linux24>
121                 ln -s ${LINUX_SRCDIR}$$v/include/asm-ppc asm ; \
122 <sparc_linux22 sparc_linux24>
123                 ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc asm ; \
124 <sparc64_linux22 sparc64_linux24>
125                 ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc64 asm ; \
126 <all>
127                 for m in ${MPS} ; do \
128                         KDIR=${KOBJ}-$$v-$$m ; \
129                         echo Building in directory: $${KDIR} ; \
130                         if [ "$$m" = "MP" ] ; then \
131                                 SMP_DEF="-DAFS_SMP -D__BOOT_KERNEL_SMP=1 -D__BOOT_KERNEL_UP=0 -D__SMP__" ; \
132                                 TARG="libafs.mp" ; \
133                         else  \
134                                 SMP_DEF="-D__BOOT_KERNEL_SMP=0 -D__BOOT_KERNEL_UP=1 -U__SMP__" ; \
135                                 TARG=libafs ; \
136                         fi ; \
137                         cd $${KDIR} ; \
138                         $(MAKE) DESTDIR=${DESTDIR} SMP_DEF="$${SMP_DEF}" $${TARG} CLIENT=$$v || exit $$?; \
139                         cd ../ ; \
140                 done \
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);