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