darwin-x86-and-leopard-20060309
[openafs.git] / src / libafs / MakefileProto.DARWIN.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 # $Header$
8
9 # MakefileProto for Digital Unix systems
10 #
11 srcdir=@srcdir@
12 include @TOP_OBJDIR@/src/config/Makefile.config
13
14
15 # OS specific object files:
16 AFS_OS_OBJS = \
17         osi_misc.o \
18         osi_file.o \
19         osi_inode.o \
20         osi_groups.o \
21         osi_sleep.o \
22         osi_vm.o \
23         osi_vnodeops.o \
24         osi_module.o
25
26
27 #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
28
29 AFS_OS_NONFSOBJS = osi_vfsops.o
30
31
32 # System specific build commands and flags
33 KDEFS=
34 DBUG = 
35 DEFINES= -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDIAGNOSTIC -DUSE_SELECT -DMACH_USER_API -DMACH_KERNEL
36 <ppc_darwin_80 x86_darwin_80 ppc_darwin_90 x86_darwin_90>
37 KOPTS_ppc=-static -g -nostdinc -nostdlib -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED -mcpu=750 -mmultiple -fschedule-insns
38 KOPTS_x86=-static -g -nostdinc -nostdlib -fno-builtin -finline -fno-keep-inline-functions -msoft-float -mlong-branch -fsigned-bitfields -arch i386 -Di386 -DI386 -D__I386__ -DPAGE_SIZE_FIXED -march=i686 -mpreferred-stack-boundary=2 -falign-functions=4
39 ARCH_ppc=$(shell echo "${ARCHFLAGS}" | grep -q -w ppc && echo yes)
40 ARCH_x86=$(shell echo "${ARCHFLAGS}" | grep -q -w i386 && echo yes)
41 ifeq ($(ARCH_ppc),yes)
42 ifeq ($(ARCH_x86),yes)
43 MODLD=$(CC) -static -g -nostdlib -arch ppc -arch i386
44 CFLAGS_ppc=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_ppc)
45 CFLAGS_x86=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS_x86)
46 else
47 MODLD=$(CC) -static -g -nostdlib -arch ppc
48 KOPTS=$(KOPTS_ppc)
49 CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
50 endif
51 else
52 ifeq ($(ARCH_x86),yes)
53 MODLD=$(CC) -static -g -nostdlib -arch i386
54 KOPTS=$(KOPTS_x86)
55 else
56 _ARCH=$(shell arch)
57 MODLD=$(CC) -static -g -nostdlib -arch $(_ARCH)
58 KOPTS=$(KOPTS_$(shell echo $(_ARCH) | sed 's/i386/x86/'))
59 endif
60 CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
61 endif
62 <all -ppc_darwin_80 -x86_darwin_80 -ppc_darwin_90 -x86_darwin_90>
63 MODLD=$(LD)
64 CFLAGS=${KINCLUDES} -I. -I.. -I${TOP_OBJDIR}/src/config $(DEFINES) $(KDEFS) $(KOPTS)
65 <ppc_darwin_70>
66 KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
67 <ppc_darwin_60>
68 KOPTS=-no-cpp-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
69 <ppc_darwin_14 ppc_darwin_13 ppc_darwin_12>
70 KOPTS=-no-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch 
71 <all>
72 KINCLUDES=-I${KROOT}/System/Library/Frameworks/Kernel.framework/Headers
73
74
75 # Name of directory to hold object files and libraries.
76 KOBJ = MODLOAD
77
78 # This tells Makefile.common to use it's single directory build target.
79 COMPDIRS = single_compdir
80 INSTDIRS = single_instdir
81 DESTDIRS = single_destdir
82
83 include Makefile.common
84
85 <ppc_darwin_80 x86_darwin_80 ppc_darwin_90 x86_darwin_90>
86 ifeq ($(ARCH_ppc),yes)
87 ifeq ($(ARCH_x86),yes)
88 # override suffix rule; unfortunately, this causes a warning message
89 .c.o:
90         $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.ppc.o,$@) -c $<
91         $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.x86.o,$@) -c $<
92         lipo -create $(patsubst %.o,%.ppc.o,$@) $(patsubst %.o,%.x86.o,$@) -output $@
93 CRULE_NOOPT= \
94         $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.ppc.o,$@) -c $? && \
95         $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.x86.o,$@) -c $? && \
96         lipo -create $(patsubst %.o,%.ppc.o,$@) $(patsubst %.o,%.x86.o,$@) -output $@
97 CRULE_OPT= \
98         $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_ppc) $(CFLAGS-$@) -o $(patsubst %.o,%.ppc.o,$@) -c $? && \
99         $(CC) $(COMMON_INCLUDE) $(KERN_DBG) $(KERN_OPTMZ) $(CFLAGS_x86) $(CFLAGS-$@) -o $(patsubst %.o,%.x86.o,$@) -c $? && \
100         lipo -create $(patsubst %.o,%.ppc.o,$@) $(patsubst %.o,%.x86.o,$@) -output $@
101 endif
102 endif
103 <all>
104
105 setup:
106         -mkdir $(KOBJ)
107         -$(RM) $(KOBJ)/Makefile $(KOBJ)/Makefile.common $(KOBJ)/config
108         ln -fs ../Makefile $(KOBJ)/Makefile
109         ln -fs ../Makefile.common $(KOBJ)/Makefile.common
110         ln -fs ../config $(KOBJ)/config
111         -$(RM) -f  h rpc
112         -ln -fs $(KROOT)/System/Library/Frameworks/Kernel.framework/Headers/sys h
113         -ln -fs /usr/include/rpc rpc
114
115
116 # Below this line are targets when in the COMMON directory:
117 LIBAFS = libafs.o
118 LIBAFSNONFS = libafs.nonfs.o
119
120 INST_LIBAFS = ${DESTDIR}${afskerneldir}/afs-nfs.kext
121 INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/afs.kext
122 DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/afs-nfs.kext
123 DEST_LIBAFSNONFS = ${DEST}/root.client/usr/vice/etc/afs.kext
124
125
126 libafs: $(LIBAFSNONFS) ;
127 install_libafs: $(LIBAFSNONFS) ;
128         -mkdir -p ${INST_LIBAFSNONFS}
129         -mkdir -p ${INST_LIBAFSNONFS}/Contents
130         $(INSTALL) -f ../${DARWIN_INFOFILE} ${INST_LIBAFSNONFS}/Contents/Info.plist
131         -mkdir -p ${INST_LIBAFSNONFS}/Contents/MacOS
132         $(INSTALL) -f ${LIBAFSNONFS} ${INST_LIBAFSNONFS}/Contents/MacOS/afs
133
134 dest_libafs: $(LIBAFSNONFS) ;
135         -mkdir -p ${DEST_LIBAFSNONFS}
136         -mkdir -p ${DEST_LIBAFSNONFS}/Contents
137         $(INSTALL) -f ../${DARWIN_INFOFILE} ${DEST_LIBAFSNONFS}/Contents/Info.plist
138         -mkdir -p ${DEST_LIBAFSNONFS}/Contents/MacOS
139         $(INSTALL) -f ${LIBAFSNONFS} ${DEST_LIBAFSNONFS}/Contents/MacOS/afs
140
141
142 ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
143         $(MODLD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} -lcc_kext
144
145 ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
146         $(MODLD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext