35c1281ff51ae3ef82d1c987ee67836fa51d9fb0
[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.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_*) \
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         alpha_nbsd* ) \
137                 $(PATH_CPP) -DASSEMBLER -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
138                 ${AS} -o process.o process.ss; \
139                 $(RM) process.ss ;; \
140         hp* | *_linux* | *_umlinux* | sgi_64 | sgi_65 ) \
141                 $(AFS_CCRULE) -c ${srcdir}/process.c;; \
142         alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
143                 ${AS} -v  -P -DOSF -I${TOP_INCDIR} -DASSEMBLER ${srcdir}/process.s; \
144                 ${AS} -v process.i -o process.o;; \
145         ia64_hpux11* | hp_ux11* ) \
146                 $(AFS_CCRULE) -c ${srcdir}/process.c;; \
147         i386_*) \
148                 $(PATH_CPP) -P -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s > process.ss; \
149                 ${AS} process.ss -o process.o; \
150                 $(RM) process.ss ;; \
151         *) \
152                 $(PATH_CPP) -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
153                 ${AS} process.ss -o process.o; \
154                 $(RM) process.ss ;; \
155         esac
156
157 iomgr.o         : iomgr.c lwp.h timer.h
158 preempt.o       : preempt.c lwp.h preempt.h
159 lwp.o           : lwp.c lwp.h
160         case "$(SYS_NAME)" in \
161                 rs_aix*) \
162                         $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -I${srcdir} -I. -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -c ${srcdir}/lwp.c;; \
163                 *)  \
164                         $(AFS_CCRULE) ${srcdir}/lwp.c;; \
165                 esac
166 lock.o          : lock.c lock.h lwp.h
167 timer.o         : timer.c
168 fasttime.o      : fasttime.c
169 threadname.o    : threadname.c
170
171 exc_handling.o  : exc_handling.c
172
173 #
174 # tests
175 #
176 rw: rw.o liblwp.a $(TOP_LIBDIR)/util.a
177         $(AFS_LDRULE) rw.o liblwp.a $(TOP_LIBDIR)/util.a
178
179 #
180 # Install targets
181 #
182 install: liblwp.a lock.h lwp.h preempt.h timer.h
183         ${INSTALL} -d ${DESTDIR}${libdir}
184         ${INSTALL} -d ${DESTDIR}${includedir}
185         ${INSTALL_DATA} liblwp.a ${DESTDIR}${libdir}/liblwp.a
186         ${INSTALL_DATA} ${srcdir}/lock.h ${DESTDIR}${includedir}/lock.h
187         ${INSTALL_DATA} ${srcdir}/lwp.h ${DESTDIR}${includedir}/lwp.h
188         ${INSTALL_DATA} ${srcdir}/preempt.h ${DESTDIR}${includedir}/preempt.h
189         ${INSTALL_DATA} ${srcdir}/timer.h ${DESTDIR}${includedir}/timer.h
190
191 dest: liblwp.a lock.h lwp.h preempt.h timer.h
192         ${INSTALL} -d ${DEST}/lib
193         ${INSTALL} -d ${DEST}/include
194         ${INSTALL_DATA} liblwp.a ${DEST}/lib/liblwp.a
195         ${INSTALL_DATA} ${srcdir}/lock.h ${DEST}/include/lock.h
196         ${INSTALL_DATA} ${srcdir}/lwp.h ${DEST}/include/lwp.h
197         ${INSTALL_DATA} ${srcdir}/preempt.h ${DEST}/include/preempt.h
198         ${INSTALL_DATA} ${srcdir}/timer.h ${DEST}/include/timer.h
199
200 #
201 # Misc. targets
202 #
203 clean:
204         $(RM) -f *.o *.a core AFS_component_version_number.c
205
206 include ../config/Makefile.version