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