9ea5f7719899ba1d47f1befede878318f27284ea
[openafs.git] / src / lwp / Makefile.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 # Portions Copyright (c) 2003 Apple Computer, Inc.
9
10 srcdir=@srcdir@
11 include @TOP_OBJDIR@/src/config/Makefile.config
12 include @TOP_OBJDIR@/src/config/Makefile.lwp
13 include @TOP_OBJDIR@/src/config/Makefile.lwptool
14
15 DBG=${LWP_DBG}
16 OPTMZ=${LWP_OPTMZ}
17
18 LIBOBJS=lwp.o process.o iomgr.o timer.o preempt.o \
19         threadname.o AFS_component_version_number.o
20
21 LT_objs = waitkey.lo fasttime.lo lock.lo
22 LT_deps = $(top_builddir)/src/opr/liboafs_opr.la
23 LT_libs = $(MT_LIBS)
24
25 all: liboafs_lwpcompat.la libafsrpc_lwpcompat.la \
26         ${TOP_LIBDIR}/liblwp.a depinstall
27
28 depinstall: ${TOP_INCDIR}/lock.h ${TOP_INCDIR}/lwp.h ${TOP_INCDIR}/preempt.h ${TOP_INCDIR}/timer.h
29
30 ${TOP_LIBDIR}/liblwp.a: liblwp.a
31         ${INSTALL_DATA} $? $@
32
33 ${TOP_INCDIR}/lock.h: lock.h
34         ${INSTALL_DATA} $? $@
35
36 ${TOP_INCDIR}/lwp.h: lwp.h
37         ${INSTALL_DATA} $? $@
38
39 ${TOP_INCDIR}/preempt.h: preempt.h
40         ${INSTALL_DATA} $? $@
41
42 ${TOP_INCDIR}/timer.h: timer.h
43         ${INSTALL_DATA} $? $@
44
45 #
46 # Build rules
47 #
48 liblwp.a: ${LIBOBJS} $(LT_objs)
49         -$(RM) -f $@
50         $(AR) crv $@ ${LIBOBJS} .lwp/waitkey.o .lwp/fasttime.o .lwp/lock.o
51         $(RANLIB) $@
52
53 liboafs_lwpcompat.la: liboafs_lwpcompat.la.sym $(LT_objs) $(LT_deps)
54         $(LT_LDLIB_shlib) $(LT_objs) $(LT_deps) $(LT_libs)
55
56 libafsrpc_lwpcompat.la: $(LT_objs)
57         $(LT_LDLIB_pic) $(LT_objs)
58
59 # This is required so sgi_64+ does not try to build this file.
60 process.s:
61         @echo Nothing to be done for process.s
62
63 # Making process.o for $(SYS_NAME)
64 process.o       : process.s process.i386.s process.amd64.s process.c lwp.o
65         @set -x; case "$(SYS_NAME)" in \
66         sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53  | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5* | arm_linux* ) \
67                 $(PATH_CPP) -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
68                 ${AS} process.ss -o process.o; \
69                         $(RM) process.ss ;; \
70         sgi_5* ) \
71                 $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -c -I${TOP_INCDIR} -KPIC -G0  ${srcdir}/process.s;; \
72         sgi_61 | sgi_62 | sgi_63 ) \
73                 $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -c ${XCFLAGS} ${ARCHFLAGS} -I${TOP_INCDIR} -KPIC -G0  ${srcdir}/process.s;; \
74         s390_*) \
75                 $(PATH_CPP) -P -I${TOP_INCDIR} ${srcdir}/process.s390.s >process.ss; \
76                 ${AS} -ahlns process.ss -o process.o >process.lst; \
77                 $(RM) process.ss ;; \
78         s390x_*) \
79                 $(PATH_CPP) -P -I${TOP_INCDIR} ${srcdir}/process.s390x.s >process.ss; \
80                 ${AS} -ahlns process.ss -o process.o >process.lst; \
81                 $(RM) process.ss ;; \
82         *_darwin* ) \
83                 $(RM) -f process.o ; \
84                 CURRENTBUILDARCH="${ARCHFLAGS}"; \
85                 if [ -z "$${CURRENTBUILDARCH}" ] ; then \
86                     CURRENTBUILDARCH=`$(CC) -dM -E -xc /dev/null | grep 'ppc\|i386\|x86_64\|arm'`; \
87                 fi; \
88                 ppc=`echo $${CURRENTBUILDARCH} | grep -q ppc && echo process.ppc.o` ; \
89                 i386=`echo $${CURRENTBUILDARCH} | grep -q i386 && echo process.i386.o` ; \
90                 amd64=`echo $${CURRENTBUILDARCH} | grep -q x86_64 && echo process.amd64.o` ; \
91                 armv6=`echo $${CURRENTBUILDARCH} | grep -q armv6 && echo process.armv6.o` ; \
92                 armv7=`echo $${CURRENTBUILDARCH} | grep -q armv7 && echo process.armv7.o` ; \
93                 if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
94                         if [ `arch` = ppc ] ; then \
95                                 ppc=yes ; \
96                         else \
97                                 i386=yes ; \
98                         fi ; \
99                 fi ; \
100                 if [ -n "$${armv6}" ] ; then \
101                         $(CC) -x assembler-with-cpp -c -arch armv6 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.s -o "$${armv6}" ; \
102                         if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" -a -z "$${armv7}" ] ; then \
103                                 ${MV} "$${armv6}" process.o ; \
104                         fi ; \
105                 fi ; \
106                 if [ -n "$${armv7}" ] ; then \
107                         $(CC) -x assembler-with-cpp -c -arch armv7 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.s -o "$${armv7}" ; \
108                         if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" -a -z "$${armv6}" ] ; then \
109                                 ${MV} "$${armv7}" process.o ; \
110                         fi ; \
111                 fi ; \
112                 if [ -n "$${ppc}" ] ; then \
113                         $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch ppc -I${TOP_INCDIR} ${srcdir}/process.s -o "$${ppc}" ; \
114                         if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
115                                 ${MV} "$${ppc}" process.o ; \
116                         fi ; \
117                 fi ; \
118                 if [ -n "$${i386}" ] ; then \
119                         $(CC) -x assembler-with-cpp -c -arch i386 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s -o "$${i386}" ; \
120                         if [ -z "$${ppc}" -a -z "$${amd64}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
121                                 ${MV} "$${i386}" process.o ; \
122                         fi ; \
123                 fi ; \
124                 if [ -n "$${amd64}" ] ; then \
125                         $(CC) -x assembler-with-cpp -c -arch x86_64 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.amd64.s -o "$${amd64}" ; \
126                         if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${armv6}" -a -z "$${armv7}" ] ; then \
127                                 ${MV} "$${amd64}" process.o ; \
128                         fi ; \
129                 fi ; \
130                 if [ ! -f process.o ] ; then \
131                         lipo -create $${amd64} $${i386} $${ppc} $${armv6} $${armv7} -output process.o ;\
132                 fi ;; \
133         i386_*bsd*) \
134                 cp ${srcdir}/process.i386.s process.S ; \
135                 ${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \
136                 ${AS} process.ss -o process.o ;  \
137                 $(RM) -f process.S ;;\
138         amd64_*bsd*) \
139                 cp ${srcdir}/process.amd64.s process.S ; \
140                 ${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \
141                 ${AS} process.ss -o process.o ;  \
142                 $(RM) -f process.S ;;\
143         ncrx86_* | sunx86_58 | sunx86_59 ) \
144                 $(PATH_CPP) -P -D__sun -D__i386 -DIGNORE_STDS_H -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s > process.ss; \
145                 ${AS} -o process.o process.ss; \
146                 $(RM) process.ss ;; \
147         sunx86_510 | sunx86_511) \
148                 if [ "${ASFLAGS}" = "-m64" ] ; then \
149                         CURRENTBUILDARCH=amd64 ; \
150                 else \
151                         XCPPFLAGS="-D__i386" ; \
152                         CURRENTBUILDARCH=i386 ; \
153                 fi ; \
154                 $(PATH_CPP) $${XCPPFLAGS} -P -D__sun -DIGNORE_STDS_H -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.$${CURRENTBUILDARCH}.s > process.ss ; \
155                 ${AS} ${ASFLAGS} -o process.o process.ss ; \
156                 $(RM) process.ss ;; \
157         alpha_nbsd* ) \
158                 $(PATH_CPP) -DASSEMBLER -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
159                 ${AS} -o process.o process.ss; \
160                 $(RM) process.ss ;; \
161         hp* | *_linux* | *_umlinux* | sgi_64 | sgi_65 ) \
162                 $(AFS_CCRULE_NOQ) -c ${srcdir}/process.c;; \
163         alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
164                 ${AS} -v  -P -DOSF -I${TOP_INCDIR} -DASSEMBLER ${srcdir}/process.s; \
165                 ${AS} -v process.i -o process.o;; \
166         ia64_hpux11* | hp_ux11* ) \
167                 $(AFS_CCRULE_NOQ) -c ${srcdir}/process.c;; \
168         i386_*) \
169                 $(PATH_CPP) -P -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s > process.ss; \
170                 ${AS} process.ss -o process.o; \
171                 $(RM) process.ss ;; \
172         *) \
173                 $(PATH_CPP) -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
174                 ${AS} process.ss -o process.o; \
175                 $(RM) process.ss ;; \
176         esac
177
178 iomgr.o         : iomgr.c lwp.h timer.h
179 preempt.o       : preempt.c lwp.h preempt.h
180 lwp.o           : lwp.c lwp.h
181         case "$(SYS_NAME)" in \
182                 rs_aix*) \
183                         $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -I${srcdir} -I. -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -c ${srcdir}/lwp.c;; \
184                 *)  \
185                         $(AFS_CCRULE_NOQ) ${srcdir}/lwp.c;; \
186                 esac
187 lock.lo         : lock.c lock.h lwp.h
188 timer.o         : timer.c
189 fasttime.lo     : fasttime.c
190 threadname.o    : threadname.c
191
192 exc_handling.o  : exc_handling.c
193
194 #
195 # tests
196 #
197 rw: rw.o liblwp.a $(TOP_LIBDIR)/util.a
198         $(AFS_LDRULE) rw.o liblwp.a $(TOP_LIBDIR)/util.a
199
200 #
201 # Install targets
202 #
203 install: liblwp.a lock.h lwp.h preempt.h timer.h
204         ${INSTALL} -d ${DESTDIR}${libdir}
205         ${INSTALL} -d ${DESTDIR}${includedir}
206         ${INSTALL_DATA} liblwp.a ${DESTDIR}${libdir}/liblwp.a
207         ${INSTALL_DATA} ${srcdir}/lock.h ${DESTDIR}${includedir}/lock.h
208         ${INSTALL_DATA} ${srcdir}/lwp.h ${DESTDIR}${includedir}/lwp.h
209         ${INSTALL_DATA} ${srcdir}/preempt.h ${DESTDIR}${includedir}/preempt.h
210         ${INSTALL_DATA} ${srcdir}/timer.h ${DESTDIR}${includedir}/timer.h
211
212 dest: liblwp.a lock.h lwp.h preempt.h timer.h
213         ${INSTALL} -d ${DEST}/lib
214         ${INSTALL} -d ${DEST}/include
215         ${INSTALL_DATA} liblwp.a ${DEST}/lib/liblwp.a
216         ${INSTALL_DATA} ${srcdir}/lock.h ${DEST}/include/lock.h
217         ${INSTALL_DATA} ${srcdir}/lwp.h ${DEST}/include/lwp.h
218         ${INSTALL_DATA} ${srcdir}/preempt.h ${DEST}/include/preempt.h
219         ${INSTALL_DATA} ${srcdir}/timer.h ${DEST}/include/timer.h
220
221 #
222 # Misc. targets
223 #
224 clean:
225         $(LT_CLEAN)
226         $(RM) -f *.o *.a core AFS_component_version_number.c
227
228 include ../config/Makefile.version