Build system: Move install definitions to include
[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                 arm=`echo $${CURRENTBUILDARCH} | grep -q arm && echo process.arm.o` ; \
81                 if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${amd64}" -a -z "$${arm}" ] ; then \
82                         if [ `arch` = ppc ] ; then \
83                                 ppc=yes ; \
84                         else \
85                                 i386=yes ; \
86                         fi ; \
87                 fi ; \
88                 if [ -n "$${arm}" ] ; then \
89                         $(CC) -x assembler-with-cpp -c -arch armv6 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.s -o "$${arm}" ; \
90                         if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${ppc}" ] ; then \
91                                 ${MV} "$${arm}" process.o ; \
92                         fi ; \
93                 fi ; \
94                 if [ -n "$${ppc}" ] ; then \
95                         $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c -arch ppc -I${TOP_INCDIR} ${srcdir}/process.s -o "$${ppc}" ; \
96                         if [ -z "$${i386}" -a -z "$${amd64}" -a -z "$${arm}" ] ; then \
97                                 ${MV} "$${ppc}" process.o ; \
98                         fi ; \
99                 fi ; \
100                 if [ -n "$${i386}" ] ; then \
101                         $(CC) -x assembler-with-cpp -c -arch i386 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s -o "$${i386}" ; \
102                         if [ -z "$${ppc}" -a -z "$${amd64}" -a -z "$${arm}" ] ; then \
103                                 ${MV} "$${i386}" process.o ; \
104                         fi ; \
105                 fi ; \
106                 if [ -n "$${amd64}" ] ; then \
107                         $(CC) -x assembler-with-cpp -c -arch x86_64 -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.amd64.s -o "$${amd64}" ; \
108                         if [ -z "$${ppc}" -a -z "$${i386}" -a -z "$${arm}" ] ; then \
109                                 ${MV} "$${amd64}" process.o ; \
110                         fi ; \
111                 fi ; \
112                 if [ ! -f process.o ] ; then \
113                         lipo -create $${amd64} $${i386} $${ppc} $${arm} -output process.o ;\
114                 fi ;; \
115         i386_*bsd*) \
116                 cp ${srcdir}/process.i386.s process.S ; \
117                 ${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \
118                 ${AS} process.ss -o process.o ;  \
119                 $(RM) -f process.S ;;\
120         amd64_*bsd*) \
121                 cp ${srcdir}/process.amd64.s process.S ; \
122                 ${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \
123                 ${AS} process.ss -o process.o ;  \
124                 $(RM) -f process.S ;;\
125         ncrx86_* | sunx86_*) \
126                 $(PATH_CPP) -P -D__sun -D__i386 -DIGNORE_STDS_H -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s > process.ss; \
127                 ${AS} -o process.o process.ss; \
128                 $(RM) process.ss ;; \
129         alpha_nbsd* ) \
130                 $(PATH_CPP) -DASSEMBLER -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
131                 ${AS} -o process.o process.ss; \
132                 $(RM) process.ss ;; \
133         hp* | *_linux* | *_umlinux* | sgi_64 | sgi_65 ) \
134                 $(AFS_CCRULE) -c ${srcdir}/process.c;; \
135         alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
136                 ${AS} -v  -P -DOSF -I${TOP_INCDIR} -DASSEMBLER ${srcdir}/process.s; \
137                 ${AS} -v process.i -o process.o;; \
138         ia64_hpux11* | hp_ux11* ) \
139                 $(AFS_CCRULE) -c ${srcdir}/process.c;; \
140         i386_*) \
141                 $(PATH_CPP) -P -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s > process.ss; \
142                 ${AS} process.ss -o process.o; \
143                 $(RM) process.ss ;; \
144         *) \
145                 $(PATH_CPP) -P -I${TOP_INCDIR} ${srcdir}/process.s > process.ss; \
146                 ${AS} process.ss -o process.o; \
147                 $(RM) process.ss ;; \
148         esac
149
150 iomgr.o         : iomgr.c lwp.h timer.h
151 preempt.o       : preempt.c lwp.h preempt.h
152 lwp.o           : lwp.c lwp.h
153         case "$(SYS_NAME)" in \
154                 rs_aix*) \
155                         $(CCOBJ) ${LWP_DBG} ${LWP_OPTMZ} -I${srcdir} -I. -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} -c ${srcdir}/lwp.c;; \
156                 *)  \
157                         $(AFS_CCRULE) ${srcdir}/lwp.c;; \
158                 esac
159 lock.o          : lock.c lock.h lwp.h
160 timer.o         : timer.c
161 fasttime.o      : fasttime.c
162 threadname.o    : threadname.c
163
164 exc_handling.o  : exc_handling.c
165
166 #
167 # tests
168 #
169 rw: rw.o liblwp.a $(TOP_LIBDIR)/util.a
170         $(AFS_LDRULE) rw.o liblwp.a $(TOP_LIBDIR)/util.a
171
172 #
173 # Install targets
174 #
175 install: liblwp.a lock.h lwp.h preempt.h timer.h
176         ${INSTALL} -d ${DESTDIR}${libdir}
177         ${INSTALL} -d ${DESTDIR}${includedir}
178         ${INSTALL_DATA} liblwp.a ${DESTDIR}${libdir}/liblwp.a
179         ${INSTALL_DATA} ${srcdir}/lock.h ${DESTDIR}${includedir}/lock.h
180         ${INSTALL_DATA} ${srcdir}/lwp.h ${DESTDIR}${includedir}/lwp.h
181         ${INSTALL_DATA} ${srcdir}/preempt.h ${DESTDIR}${includedir}/preempt.h
182         ${INSTALL_DATA} ${srcdir}/timer.h ${DESTDIR}${includedir}/timer.h
183
184 dest: liblwp.a lock.h lwp.h preempt.h timer.h
185         ${INSTALL} -d ${DEST}/lib
186         ${INSTALL} -d ${DEST}/include
187         ${INSTALL_DATA} liblwp.a ${DEST}/lib/liblwp.a
188         ${INSTALL_DATA} ${srcdir}/lock.h ${DEST}/include/lock.h
189         ${INSTALL_DATA} ${srcdir}/lwp.h ${DEST}/include/lwp.h
190         ${INSTALL_DATA} ${srcdir}/preempt.h ${DEST}/include/preempt.h
191         ${INSTALL_DATA} ${srcdir}/timer.h ${DEST}/include/timer.h
192
193 #
194 # Misc. targets
195 #
196 clean:
197         $(RM) -f *.o *.a core AFS_component_version_number.c
198
199 include ../config/Makefile.version