ae406bdc28041b696706b1919ad40f1f2aa5d079
[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 -m486 -malign-loops=2 -malign-jumps=2 \
42         -malign-functions=2
43 DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
44 <ppc_linux22 ppc_linux24>
45 CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
46         -fno-strict-aliasing -fsigned-char -msoft-float -pipe \
47         -fno-builtin -ffixed-r2
48 DEFINES = -D__KERNEL__  -D__powerpc__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
49 <all>
50 INCLUDES = -I. -I../
51
52 CFLAGS = $(CCFLAGS) $(DEFINES) $(INCLUDES)
53
54 # Name of directory to hold object files and libraries.
55 KOBJ = MODLOAD
56 MPS = MP SP
57
58 # COMPDIRS is called in Makefile.common to do the actual builds.
59 COMPDIRS=linux_compdirs
60
61
62 include Makefile.common
63
64 setup:
65         -rm -f h net netinet sys rpc
66         -ln -s rx rpc
67         for v in ${LINUX_VERS} ; do \
68                 for m in ${MPS} ; do \
69                         KDIR=$(KOBJ)-$$v-$$m; \
70                         mkdir -p $${KDIR}; \
71                         ln -fs ../Makefile $${KDIR}/Makefile ; \
72                         ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
73                 done \
74         done
75         
76 # Compile SP and MP clients as requested
77
78 LINUX_INCDIR=include/linux
79
80 ${COMPDIRS}:
81         for v in ${LINUX_VERS} ; do \
82                 IDIR=${LINUX_SRCDIR}$$v/${LINUX_INCDIR}; \
83                 rm -f h; \
84                 ln -s $${IDIR} h; \
85                 rm -f linux; \
86                 ln -s $${IDIR} linux; \
87                 rm -f net; \
88                 ln -s $${IDIR} net; \
89                 rm -f netinet; \
90                 ln -s $${IDIR} netinet; \
91                 rm -f sys; \
92                 ln -s $${IDIR} sys; \
93                 rm -f asm; \
94 <i386_linux22 i386_linux24>
95                 ln -s ${LINUX_SRCDIR}$$v/include/asm-i386 asm ; \
96 <ppc_linux22 ppc_linux24>
97                 ln -s ${LINUX_SRCDIR}$$v/include/asm-ppc asm ; \
98 <all>
99                 for m in ${MPS} ; do \
100                         KDIR=${KOBJ}-$$v-$$m ; \
101                         echo Building in directory: $${KDIR} ; \
102                         if [ "$$m" = "MP" ] ; then \
103                                 SMP_DEF="-DAFS_SMP" ; \
104                                 TARG="libafs.mp" ; \
105                         else  \
106                                 SMP_DEF="" ; \
107                                 TARG=libafs ; \
108                         fi ; \
109                         cd $${KDIR} ; \
110                         $(MAKE) DESTDIR=${DESTDIR} SMP_DEF=$${SMP_DEF} $${TARG} CLIENT=$$v || exit $$?; \
111                         cd ../ ; \
112                 done \
113         done
114
115
116 # Below this line are targets when in the COMMON directory:
117 # For Linux there is no kernel NFS server.
118 LIBAFS = libafs-${CLIENT}.o
119 LIBAFS_MP = libafs-${CLIENT}.mp.o
120
121 DEST_LIBAFS = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS}
122 DEST_LIBAFS_MP = ${DESTDIR}/root.client/usr/vice/etc/modload/${LIBAFS_MP}
123
124
125 libafs: $(DEST_LIBAFS) 
126         echo SP Build Complete
127
128 libafs.mp: $(DEST_LIBAFS_MP)
129         echo MP Build Complete
130
131 $(DEST_LIBAFS): $(LIBAFS)
132         ${INSTALL} -f $? $@
133
134 $(DEST_LIBAFS_MP): $(LIBAFS_MP)
135         ${INSTALL} -f $? $@
136
137 ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
138         $(RM) -f $@
139         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
140
141 ${LIBAFS_MP}: $(AFSAOBJS) $(AFSNONFSOBJS)
142         $(RM) -f $@
143         $(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
144
145
146 # Linux specific objects
147 osi_alloc.o: $(AFS)/osi_alloc.c
148         $(CRULE1);
149 osi_cred.o: $(AFS)/osi_cred.c
150         $(CRULE1);
151 osi_groups.o: $(AFS)/osi_groups.c
152         $(CRULE1);
153 osi_file.o: $(AFS)/osi_file.c
154         $(CRULE1);
155 osi_inode.o: $(AFS)/osi_inode.c
156         $(CRULE1);
157 osi_misc.o: $(AFS)/osi_misc.c
158         $(CRULE1);
159 osi_module.o: $(AFS)/osi_module.c
160         $(CRULE1);
161 osi_sleep.o: $(AFS)/osi_sleep.c
162         $(CRULE1);
163 osi_vfsops.o: $(AFS)/osi_vfsops.c
164         $(CRULE1);
165 osi_vm.o: $(AFS)/osi_vm.c
166         $(CRULE1);
167 osi_vnodeops.o: $(AFS)/osi_vnodeops.c
168         $(CRULE1);
169 xdr.o: $(RX)/xdr.c
170         $(CRULE1);
171 xdr_array.o: $(RX)/xdr_array.c
172         $(CRULE1);