Initial import from FreeBSD RELENG_4:
[games.git] / contrib / libstdc++ / Makefile.in
1 # Copyright (C) 1994, 1995 Free Software Foundation
2
3 # This file is part of the GNU ANSI C++ Library.  This library is free
4 # software; you can redistribute it and/or modify it under the terms of
5 # the GNU General Public License as published by the Free Software
6 # Foundation; either version 2, or (at your option) any later version.
7
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this library; see the file COPYING.  If not, write to the Free
15 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16
17 VERSION = 2.10.0
18 INTERFACE = 3
19
20 gxx_include_dir=${includedir}/g++
21
22 OBJS  = cstringi.o stdexcepti.o cstdlibi.o cmathi.o stlinst.o valarray.o
23 SUBLIBS = $(STAMP)-string $(STAMP)-complx
24
25 # C++ headers with no extension
26 HEADERS= cassert cctype cerrno cfloat ciso646 climits clocale cmath complex \
27          csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime \
28          cwchar cwctype string stdexcept \
29          algorithm deque functional hash_map hash_set iterator list map \
30          memory numeric pthread_alloc queue rope set slist stack utility \
31          vector fstream iomanip iostream strstream iosfwd bitset valarray \
32          sstream
33
34 ARLIB   = libstdc++.a.$(VERSION)
35 ARLINK  = libstdc++.a
36 MARLINK = libstdc++.a.`echo $(VERSION) | sed 's/\([0-9]*[.][0-9]*\).*/\1/'`
37 SHLIB   = libstdc++.so.$(VERSION)
38 SHARLIB = libstdc++-sh.a
39 SHLINK  = libstdc++.so
40 MSHLINK = libstdc++.so.`echo $(VERSION) | sed 's/\([0-9]*[.][0-9]*\).*/\1/'`
41 SHFLAGS =
42 SHDEPS  =
43
44 STAMP   = bigstmp
45
46 LIBS    = $(ARLIB) $(ARLINK)
47
48 #### package, host, target, and site dependent Makefile fragments come in here.
49 ##
50
51 IO_DIR    = ../libio
52 LIBIBERTY_DIR = ../libiberty
53
54 LIBIBERTY_OBJS = `cat $(LIBIBERTY_DIR)/needed-list` strerror.o
55
56 tooldir = $(exec_prefix)/$(target)
57 # This is where the libraries will be installed; note, it will be set
58 # at make runtime now. See below at target install.
59 INSTALLDIR = $(libdir)
60
61 MOSTLYCLEAN_JUNK = *stmp-* tlib*.a *.s *.ii stdlist piclist
62 CLEAN_JUNK = $(LIBS)
63
64 .PHONY: libs
65 libs: $(LIBS)
66
67 stdlist: $(IO_DIR)/iostream.list $(OBJS) $(SUBLIBS) $(LIBIBERTY_DIR)/libiberty.a
68         -rm -f tlist
69         touch tlist
70         echo *.o >> tlist
71         for f in `cat $(IO_DIR)/iostream.list` ; do \
72           echo "$(IO_DIR)/$$f" >> tlist ; \
73         done
74         for f in $(LIBIBERTY_OBJS) ; do \
75           echo "$(LIBIBERTY_DIR)/$$f" >> tlist ; \
76         done
77         mv tlist stdlist
78
79 piclist: stdlist
80         -rm -f tlist
81         cp stdlist tlist
82         if [ x"$(enable_shared)" = xyes ]; then \
83           sed 's,\([A-Za-z_]*\.o\),pic/\1,g' tlist > tlist2 ; \
84           mv tlist2 tlist ; \
85         else true ; fi
86         mv tlist piclist
87
88 $(ARLIB): stdlist
89         -rm -f t$(ARLIB)
90         $(AR) $(AR_FLAGS) t$(ARLIB) `cat stdlist`
91         mv t$(ARLIB) $(ARLIB)
92         $(RANLIB) $(ARLIB)
93
94 $(ARLINK):
95         -rm -f $(ARLINK)
96         $(LN_S) $(ARLIB) $(ARLINK) || cp $(ARLIB) $(ARLINK)
97
98 marlink:
99         @$(MAKE) $(MARLINK) "ARLINK=$(MARLINK)"
100
101 $(SHLIB): piclist
102         $(CC) $(LIBCXXFLAGS) $(SHFLAGS) -shared -o $(SHLIB) `cat piclist` $(SHDEPS)
103
104 $(SHARLIB): $(SHLIB)
105         -rm -f t$(SHARLIB)
106         $(AR) $(AR_FLAGS) t$(SHARLIB) $(SHLIB)
107         mv t$(SHARLIB) $(SHARLIB)
108         $(RANLIB) $(SHARLIB)
109
110 $(SHLINK):
111         -rm -f $(SHLINK)
112         $(LN_S) $(SHLIB) $(SHLINK) || cp $(ARLIB) $(ARLINK)
113
114 mshlink:
115         @$(MAKE) $(MSHLINK) "SHLINK=$(MSHLINK)"
116
117 $(IO_DIR)/iostream.list: force
118         cd $(IO_DIR) ; $(MAKE) $(FLAGS_TO_PASS) iostream.list
119
120 $(LIBIBERTY_DIR)/libiberty.a:
121         cd $(LIBIBERTY_DIR) ; $(MAKE) $(FLAGS_TO_PASS)
122
123 STRFUNCS = REP MAIN TRAITS ADDSS ADDPS ADDCS ADDSP ADDSC \
124            EQSS EQPS EQSP NESS NEPS NESP LTSS LTPS LTSP GTSS GTPS GTSP \
125            LESS LEPS LESP GESS GEPS GESP
126 STRIO    = EXTRACT INSERT GETLINE
127
128 # These are here for SunOS VPATH.
129 cstringi.o: cstringi.cc
130 cstdlibi.o: cstdlibi.cc
131 cmathi.o: cmathi.cc
132 stdexcepti.o: stdexcepti.cc
133 stlinst.o: stlinst.cc
134 valarray.o: valarray.cc
135
136 # Later do wide strings, too.
137 stmp-string: ${srcdir}/sinst.cc ${srcdir}/std/bastring.h \
138              ${srcdir}/std/bastring.cc ${srcdir}/std/straits.h
139         for name in $(STRFUNCS) $(STRIO); do \
140           echo c$${name}; \
141           if [ x"$(enable_shared)" = xyes ]; then \
142             $(COMPILE.cc) $(PICFLAG) -DC -D$${name} ${srcdir}/sinst.cc \
143               -o pic/c$${name}.o; \
144           else true ; fi; \
145           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
146           $(COMPILE.cc) -DC -D$${name} ${srcdir}/sinst.cc -o c$${name}.o; \
147           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
148         done
149         touch stmp-string
150
151 bigstmp-string: ${srcdir}/sinst.cc ${srcdir}/std/bastring.h \
152                 ${srcdir}/std/bastring.cc ${srcdir}/std/straits.h
153         echo cstring
154         if [ x"$(enable_shared)" = xyes ]; then \
155           $(COMPILE.cc) $(PICFLAG) -DC \
156             `for N in $(STRFUNCS); do echo " -D$${N}"; done` \
157             $(srcdir)/sinst.cc -o pic/cstrmain.o; \
158         else true ; fi
159         $(COMPILE.cc) -DC `for N in $(STRFUNCS); do echo " -D$${N}"; done` \
160           $(srcdir)/sinst.cc -o cstrmain.o
161         echo cstrio
162         if [ x"$(enable_shared)" = xyes ]; then \
163           $(COMPILE.cc) $(PICFLAG) -DC \
164             `for N in $(STRIO); do echo " -D$${N}"; done` \
165             $(srcdir)/sinst.cc -o pic/cstrio.o; \
166         else true ; fi
167         $(COMPILE.cc) -DC `for N in $(STRIO); do echo " -D$${N}"; done` \
168           $(srcdir)/sinst.cc -o cstrio.o
169         touch bigstmp-string
170
171 COMFUNCS = MAIN ADDCC ADDCF ADDFC SUBCC SUBCF SUBFC MULCC MULCF MULFC DIVCC \
172            DIVCF DIVFC PLUS MINUS EQCC EQCF EQFC NECC NECF NEFC ABS ARG POLAR \
173            CONJ NORM COS COSH EXP LOG POWCC POWCF POWCI POWFC SIN SINH SQRT
174 COMIO    = EXTRACT INSERT
175
176 stmp-complx: ${srcdir}/cinst.cc ${srcdir}/std/complext.h \
177               ${srcdir}/std/complext.cc ${srcdir}/std/dcomplex.h \
178               ${srcdir}/std/ldcomplex.h
179         for N in $(COMFUNCS) $(COMIO); do \
180           echo f$${N}; \
181           if [ x"$(enable_shared)" = xyes ]; then \
182             $(COMPILE.cc) $(PICFLAG) -DF -D$${N} $(srcdir)/cinst.cc \
183               -o pic/f$${N}.o; \
184           else true ; fi; \
185           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
186           $(COMPILE.cc) -DF -D$${N} ${srcdir}/cinst.cc -o f$${N}.o; \
187           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
188           echo d$${N}; \
189           if [ x"$(enable_shared)" = xyes ]; then \
190             $(COMPILE.cc) $(PICFLAG) -DD -D$${N} $(srcdir)/cinst.cc \
191               -o pic/d$${N}.o; \
192           else true ; fi; \
193           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
194           $(COMPILE.cc) -DD -D$${N} ${srcdir}/cinst.cc -o d$${N}.o; \
195           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
196           echo ld$${N}; \
197           if [ x"$(enable_shared)" = xyes ]; then \
198             $(COMPILE.cc) $(PICFLAG) -DLD -D$${N} $(srcdir)/cinst.cc \
199               -o pic/ld$${N}.o; \
200           else true ; fi; \
201           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
202           $(COMPILE.cc) -DLD -D$${N} ${srcdir}/cinst.cc -o ld$${N}.o; \
203           if [ $$? -eq 0 ]; then true; else exit 1; fi; \
204         done
205         touch stmp-complx
206
207 bigstmp-complx: ${srcdir}/cinst.cc ${srcdir}/std/complext.h \
208                  ${srcdir}/std/complext.cc ${srcdir}/std/dcomplex.h \
209                  ${srcdir}/std/ldcomplex.h
210         echo fcomplex
211         if [ x"$(enable_shared)" = xyes ]; then \
212           $(COMPILE.cc) $(PICFLAG) -DF \
213             `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
214             $(srcdir)/cinst.cc -o pic/fcomplex.o; \
215         else true ; fi
216         $(COMPILE.cc) -DF `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
217           $(srcdir)/cinst.cc -o fcomplex.o
218         echo fcomio
219         if [ x"$(enable_shared)" = xyes ]; then \
220           $(COMPILE.cc) $(PICFLAG) -DF \
221             `for N in $(COMIO); do echo " -D$${N}"; done` \
222             $(srcdir)/cinst.cc -o pic/fcomio.o; \
223         else true ; fi
224         $(COMPILE.cc) -DF `for N in $(COMIO); do echo " -D$${N}"; done` \
225           $(srcdir)/cinst.cc -o fcomio.o
226         echo dcomplex
227         if [ x"$(enable_shared)" = xyes ]; then \
228           $(COMPILE.cc) $(PICFLAG) -DD \
229             `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
230             $(srcdir)/cinst.cc -o pic/dcomplex.o; \
231         else true ; fi
232         $(COMPILE.cc) -DD `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
233           $(srcdir)/cinst.cc -o dcomplex.o
234         echo dcomio
235         if [ x"$(enable_shared)" = xyes ]; then \
236           $(COMPILE.cc) $(PICFLAG) -DD \
237             `for N in $(COMIO); do echo " -D$${N}"; done` \
238             $(srcdir)/cinst.cc -o pic/dcomio.o; \
239         else true ; fi
240         $(COMPILE.cc) -DD `for N in $(COMIO); do echo " -D$${N}"; done` \
241           $(srcdir)/cinst.cc -o dcomio.o
242         echo ldcomplex
243         if [ x"$(enable_shared)" = xyes ]; then \
244           $(COMPILE.cc) $(PICFLAG) -DLD \
245             `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
246             $(srcdir)/cinst.cc -o pic/ldcomplex.o; \
247         else true ; fi
248         $(COMPILE.cc) -DLD `for N in $(COMFUNCS); do echo " -D$${N}"; done` \
249           $(srcdir)/cinst.cc -o ldcomplex.o
250         echo ldcomio
251         if [ x"$(enable_shared)" = xyes ]; then \
252           $(COMPILE.cc) $(PICFLAG) -DLD \
253             `for N in $(COMIO); do echo " -D$${N}"; done` \
254             $(srcdir)/cinst.cc -o pic/ldcomio.o; \
255         else true ; fi
256         $(COMPILE.cc) -DLD `for N in $(COMIO); do echo " -D$${N}"; done` \
257           $(srcdir)/cinst.cc -o ldcomio.o
258         touch bigstmp-complx
259
260 .PHONY: install
261 install:
262         rootme=`pwd`/ ; export rootme ; \
263         if [ -z "$(MULTISUBDIR)" ]; then \
264           cd $(srcdir); \
265           for FILE in $(HEADERS); do \
266             rm -f $(gxx_include_dir)/$$FILE ; \
267             if [ -f stl/$$FILE ]; then \
268               $(INSTALL_DATA) stl/$$FILE $(gxx_include_dir)/$$FILE ; \
269             else \
270               $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
271             fi ; \
272             chmod a-x $(gxx_include_dir)/$$FILE ; \
273           done ; \
274           for FILE in *.h std/*.h std/*.cc std/*.tcc; do \
275             rm -f $(gxx_include_dir)/$$FILE ; \
276             $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
277             chmod a-x $(gxx_include_dir)/$$FILE ; \
278           done ; \
279           cd stl; \
280           for FILE in *.h; do \
281             rm -f $(gxx_include_dir)/$$FILE ; \
282             $(INSTALL_DATA) $$FILE $(gxx_include_dir)/$$FILE ; \
283             chmod a-x $(gxx_include_dir)/$$FILE ; \
284           done ; \
285         else true ; \
286         fi
287         rootme=`pwd`/ ; export rootme ; \
288         if [ x$(enable_version_specific_runtime_libs) != xyes ]; then \
289           INSTALLDIR=$(libdir); \
290         else \
291           INSTALLDIR=$(libsubdir); \
292         fi; \
293         INSTALLLINKDIR=$(libsubdir); \
294         if [ $${INSTALLLINKDIR}$(MULTISUBDIR) = $${INSTALLDIR}$(MULTISUBDIR) ]; then \
295           RELINSTALLDIR=; \
296         elif [ x$(MULTISUBDIR) = x ]; then \
297           if [ $(build_alias) = $(target_alias) ]; then \
298             RELINSTALLDIR=../../../; \
299           else \
300             RELINSTALLDIR=../../../../$(target_alias)/lib/; \
301           fi; \
302         else \
303           if [ $(build_alias) = $(target_alias) ]; then \
304             RELINSTALLDIR=../../..`echo $(MULTISUBDIR) | sed -e 's,/[^/]*,/..,g'`$(MULTISUBDIR)/; \
305           else \
306             RELINSTALLDIR=../../../..`echo $(MULTISUBDIR) | sed -e 's,/[^/]*,/..,g'`/$(target_alias)/lib$(MULTISUBDIR)/; \
307           fi; \
308         fi; \
309         if [ $(build_alias) != $(target_alias) ]; then \
310           case $$RELINSTALLDIR in \
311           ../../../|../../../../) \
312             RELINSTALLDIR=../$${RELINSTALLDIR}$(target_alias)/lib/;; \
313           esac; \
314         fi; \
315         rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$(SHLINK) ; \
316         rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$(ARLINK) ; \
317         for FILE in $(LIBS) ; do \
318           rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
319           if [ $$FILE = $(SHLINK) ] ; then \
320             if [ -f $${INSTALLDIR}/$(MSHLINK) ]; then \
321               rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
322               $(LN_S) $${RELINSTALLDIR}$(MSHLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
323                 || cp $${RELINSTALLDIR}$(MSHLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
324             else \
325               rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
326               $(LN_S) $${RELINSTALLDIR}$(SHLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
327                 || cp $${RELINSTALLDIR}$(SHLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
328             fi; \
329           elif [ $$FILE = $(ARLINK) ] ; then \
330             if [ -f $${INSTALLDIR}/$(MARLINK) ]; then \
331               rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
332               $(LN_S) $${RELINSTALLDIR}$(MARLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
333                 || cp $${RELINSTALLDIR}$(MARLINK) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
334             else \
335               rm -f $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
336               $(LN_S) $${RELINSTALLDIR}$(ARLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE \
337                 || cp $${RELINSTALLDIR}$(ARLIB) $${INSTALLLINKDIR}$(MULTISUBDIR)/$$FILE ; \
338             fi; \
339           elif [ $$FILE = mshlink ]; then \
340             for FILE in $(MSHLINK) ; do \
341               rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
342               $(LN_S) $(SHLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE \
343                 || cp $(SHLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
344             done; \
345           elif [ $$FILE = marlink ]; then \
346             for FILE in $(MARLINK) ; do \
347               rm -f $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
348               $(LN_S) $(ARLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE \
349                 || cp $(ARLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
350             done; \
351           elif [ $$FILE = $(SHLIB) ]; then \
352             $(INSTALL_PROGRAM) $$FILE $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
353             : On the HP, shared libraries must be mode 555. ;\
354             chmod 555 $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
355           else \
356             $(INSTALL_DATA) $$FILE $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
357             $(RANLIB) $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
358             chmod a-x $${INSTALLDIR}$(MULTISUBDIR)/$$FILE ; \
359           fi ; \
360         done
361         @rootme=`pwd`/ ; export rootme ; \
362         $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
363
364 .PHONY: force
365 force:
366
367 MYCXXFLAGS = -g -O2 -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Winline -Wwrite-strings -pedantic -Wno-long-long
368 MYCFLAGS = -g -O2 -Wpointer-arith -Wnested-externs
369
370 .PHONY: stuff
371 stuff:
372         $(MAKE) stuff1
373         $(MAKE) stuff2
374
375 stuff1:
376         $(MAKE) clean
377         $(MAKE) -C ../libio c++clean
378         touch ../../gcc/libgcc2.ready
379
380 stuff2:
381         $(MAKE) -C ../../gcc/ libgcc.a
382         $(MAKE) CXXFLAGS="$(MYCXXFLAGS)" CFLAGS="$(MYCFLAGS)"
383         -$(MAKE) check
384         -$(MAKE) -C ../libio check
385         -$(MAKE) -C ../../gcc check-g++