initial-freebsd-port-work-20010414
[openafs.git] / src / lwp / Makefile
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 SHELL = /bin/sh
9 COMPONENT=lwp
10 include ../config/Makefile.${SYS_NAME}
11
12 # this is important code, so let's optimize it.  The optimizer aggravates any
13 # subtle bugs that may have been introduced in process.s, be warned!
14 OPTIMIZE=${LWP_OPTMZ}
15
16 CFLAGS=${OPTIMIZE} -I${SRCDIR}include ${XCFLAGS}
17
18 include ../config/Makefile.version
19
20 LIBOBJS=lwp.o process.o lock.o iomgr.o timer.o fasttime.o preempt.o \
21         waitkey.o threadname.o AFS_component_version_number.o
22 LIBTOBJS=tlwp.o process.o lock.o tiomgr.o timer.o fasttime.o preempt.o AFS_component_version_number.o pthread.o threadname.o
23
24 noversion: install
25
26 #
27 #       The lwp library
28 #
29 liblwp.a        : ${LIBOBJS}
30                 -rm -f liblwp.a
31                 ar rv liblwp.a ${LIBOBJS}
32                 $(RANLIB) liblwp.a
33
34 libtlwp.a       : ${LIBTOBJS}
35                 -rm -f libtlwp.a
36                 ar rv libtlwp.a ${LIBTOBJS}
37                 $(RANLIB) libtlwp.a
38
39 tlwp.o: lwp.c lwp.h
40         ${CC} ${CFLAGS} -DUSE_SOLARIS_THREADSX -c lwp.c
41         mv lwp.o tlwp.o
42
43 tiomgr.o: iomgr.c lwp.h
44         ${CC} ${CFLAGS} -DUSE_SOLARIS_THREADSX -c iomgr.c
45         mv iomgr.o tiomgr.o
46
47 pthread.o       : pthread.c
48         ${CC} ${CFLAGS} -DUSE_SOLARIS_THREADSX -c pthread.c
49
50 process.s:
51         # This is required so sgi_64+ does not try to build this file.
52         echo Nothing to be done for process.s
53
54 process.o       : process.s process.c
55                         case "$(SYS_NAME)" in \
56                                 pmax_he1) \
57                                         $(CC) -c -I${SRCDIR}include process.s;; \
58                                 sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53  | sun4_53 | sun4_52 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5? | sunx86_54) \
59                                         /usr/ccs/lib/cpp -P -I${SRCDIR}include process.s process.ss; \
60                                         ${AS} process.ss -o process.o; \
61                                         rm process.ss ;; \
62                                 sgi_5* ) \
63                                         $(CC) -c -I${SRCDIR}include -KPIC -G0  process.s;; \
64                                 sgi_61 | sgi_62 | sgi_63 ) \
65                                         $(CC) -c ${XCFLAGS} -I${SRCDIR}include -KPIC -G0  process.s;; \
66                                 s390*) \
67                                         /lib/cpp -P -I${SRCDIR}include process.s >process.ss; \
68                                         ${AS} -ahlns process.ss -o process.o >process.lst; \
69                                         rm process.ss ;; \
70                                 ppc_darwin* ) \
71                                         $(CC) -c ${XCFLAGS} -I${SRCDIR}include process.s;; \
72                                 i386_fbsd* ) \
73                                         /usr/bin/cpp -P process.fbsd.s > process.ss; \
74                                         ${AS} -o process.o process.ss; \
75                                         rm process.ss ;; \
76                                 hp* | *_linux* | sgi_64 | sgi_65 ) \
77                                         ${CC} ${CFLAGS} -c process.c;; \
78                                 ncrx86_*) \
79                                         /usr/ccs/lib/cpp -P -I${SRCDIR}include process.s process.ss; \
80                                         ${AS} -o process.o process.ss; \
81                                         rm process.ss ;; \
82                                 alpha_osf1 | alpha_osf20 |  alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \
83                                         ${AS} -v  -P -DOSF -I${SRCDIR}include -DASSEMBLER process.s; \
84                                         ${AS} -v process.i -o process.o;; \
85                                 hp_ux110 ) \
86                                         ${CC} ${CFLAGS} -c process.c;; \
87                                 *) \
88                                         /lib/cpp -P -I${SRCDIR}include process.s process.ss; \
89                                         ${AS} process.ss -o process.o; \
90                                         rm process.ss ;; \
91                         esac
92
93 iomgr.o         : iomgr.c lwp.h timer.h
94                 ${CC} -c ${CFLAGS}  iomgr.c
95
96 preempt.o       : preempt.c lwp.h preempt.h
97 lwp.o           : lwp.c lwp.h
98                         case "$(SYS_NAME)" in \
99                                 rs_aix*) \
100                                         $(CC) -I${SRCDIR}include -c lwp.c;; \
101                                 *)  \
102                                         $(CC) ${CFLAGS} -c lwp.c;; \
103                         esac
104 lock.o          : lock.c lock.h lwp.h
105 timer.o         : timer.c
106 fasttime.o      : fasttime.c
107 threadname.o    : threadname.c
108
109 exc_handling.o  : exc_handling.c
110
111 #
112 # tests
113 #
114 rw: rw.o liblwp.a DEST/lib/afs/util.a
115         ${CC} ${CFLAGS} -o rw rw.o liblwp.a DEST/lib/afs/util.a
116
117 rw.o: rw.c
118         ${CC} ${CFLAGS} -c rw.c
119
120
121 #
122 #       Installation
123 #
124 system: install
125
126 kinstall ukinstall webinstall:
127         @echo No kernel source here.
128
129 install: liblwp.a #libtlwp.a
130                 ${INSTALL} liblwp.a ${DESTDIR}lib
131                 ${INSTALL} *.h ${DESTDIR}include
132                 case ${SYS_NAME} in \
133                     sun4_52 | sun4_53 | sun4c_52 | sun4c_53 | sun4m_52 | sun4m_53 | sun4_54 | sun4c_54 | sun4m_54 | sun4x_5?) \
134                         echo "Don't install libtrx.a for ${SYS_NAME}" ;; \
135                      * ) \
136                         echo "Don't install libtrx.a for ${SYS_NAME}" ;; \
137                 esac
138 clean:
139         rm -f *.o *.a core AFS_component_version_number.c
140
141 beancount:
142         wc -l *.[ch]