[project @ 2000-08-04 23:28:04 by lewie]
[ghc.git] / ghc / rts / gmp / Makefile.in
1 # Top Makefile for GNU MP
2 # Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
3
4 # This file is part of the GNU MP Library.
5
6 # The GNU MP Library is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Library General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or (at your
9 # option) any later version.
10
11 # The GNU MP Library is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 # License for more details.
15
16 # You should have received a copy of the GNU Library General Public License
17 # along with the GNU MP Library; see the file COPYING.LIB. If not, write to
18 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19 # MA 02111-1307, USA.
20
21 srcdir = .
22
23 prefix = /usr/local
24
25 exec_prefix = $(prefix)
26 libdir = $(exec_prefix)/lib
27 infodir = $(prefix)/info
28 includedir = $(prefix)/include
29
30 CC = gcc
31 LOCAL_CC = $(CC)
32 CFLAGS = @CFLAGS@
33 XCFLAGS =
34 AR = ar
35 AR_FLAGS = rc
36 RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
37 RANLIB = ranlib
38 SHELL = /bin/sh
39 INSTALL = $(srcdir)/install.sh -c
40 INSTALL_PROGRAM = $(INSTALL)
41 INSTALL_DATA = $(INSTALL)
42 MAKEINFO = makeinfo
43 MAKEINFOFLAGS =
44 TEXI2DVI = texi2dvi
45 LN = ln -s
46
47 #### host and target specific makefile fragments come in here.
48 ###
49
50 SRCS = memory.c mp_set_fns.c mp_clz_tab.c version.c stack-alloc.c mp_bpl.c \
51 extract-double.c insert-double.c
52 OBJS = memory.o mp_set_fns.o mp_clz_tab.o version.o stack-alloc.o mp_bpl.o \
53 extract-double.o insert-double.o
54 FILES = gmp.h mp.h gmp-impl.h longlong.h urandom.h move-if-change \
55 mkinstalldirs INSTALL COPYING.LIB ChangeLog Makefile.in \
56 NEWS README SPEED TODO config.guess config.sub configure configure.in \
57 gmp.info* gmp.texi texinfo.tex $(SRCS)
58
59 INCLUDES = -I. -Impn -I$(srcdir)
60 FLAGS_TO_PASS = "CC=$(CC)" "CFLAGS=$(CFLAGS)" "XCFLAGS=$(XCFLAGS)"
61
62 all: libgmp.a
63
64 ifeq "(EnableWin32DLLs)" "YES"
65 all: gmp.dll
66 endif
67
68 %.o : %.c
69 $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
70
71 libgmp.a: mpn/libmpn.a mpz/libmpz.a $(OBJS)
72 rm -rf tmpdir
73 mkdir tmpdir
74 for i in mpn mpz; \
75 do \
76 mkdir tmpdir/$$i; \
77 ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
78 done
79 cp $(OBJS) tmpdir
80 cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
81 if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
82 mv tmpdir/$@ .
83 rm -rf tmpdir
84
85 gmp.dll: libgmp.a
86 dllwrap -mno-cygwin --target=i386-unknown-mingw32 \
87 --export-all --dllname gmp.dll --output-lib=libgmp_imp.a \
88 -o gmp.dll libgmp.a
89
90 libmp.a: mpn/libmpn.a mpbsd/libmpbsd.a $(OBJS)
91 rm -rf tmpdir
92 mkdir tmpdir
93 for i in mpn mpbsd; \
94 do \
95 mkdir tmpdir/$$i; \
96 ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
97 done
98 cp $(OBJS) tmpdir
99 cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
100 if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
101 mv tmpdir/$@ .
102 rm -rf tmpdir
103
104 mpn/libmpn.a: force
105 cd mpn; $(MAKE) $(FLAGS_TO_PASS) libmpn.a
106 mpz/libmpz.a: force
107 cd mpz; $(MAKE) $(FLAGS_TO_PASS) libmpz.a
108
109 check: libgmp.a
110 cd mpz/tests; $(MAKE) $(FLAGS_TO_PASS) check
111
112 doc: gmp.dvi gmp.info
113
114 info: $(srcdir)/gmp.info
115 $(srcdir)/gmp.info: $(srcdir)/gmp.texi
116 cd $(srcdir); $(MAKEINFO) gmp.texi
117
118 dvi: gmp.dvi
119 gmp.dvi: $(srcdir)/gmp.texi
120 rm -f tmp.texi
121 $(LN) $(srcdir)/gmp.texi tmp.texi
122 TEXINPUTS=.:$(srcdir) $(TEXI2DVI) tmp.texi
123 rm -f tmp.texi
124 mv tmp.dvi gmp.dvi
125 rm -f tmp.*
126
127 ps: gmp.ps
128 gmp.ps: gmp.dvi
129 dvips gmp.dvi -o gmp.ps
130
131 html: gmp_toc.html
132 gmp_toc.html: $(srcdir)/gmp.texi
133 texi2html -acc -split_chapter $(srcdir)/gmp.texi
134
135 # The semicolon is to prevent the install.sh -> install default rule
136 # from doing anything. Having it run true helps avoid problems and
137 # noise from versions of make which don't like to have null commands.
138 install: install-normal ; @true
139
140 install-strip: install-normal
141 install-normal: installdirs libgmp.a
142 $(INSTALL_DATA) libgmp.a $(libdir)/libgmp.a
143 -chmod a-x $(libdir)/libgmp.a
144 # $(INSTALL_DATA) $(srcdir)/gmp.h $(includedir)/gmp.h
145 # -chmod a-x $(includedir)/gmp.h
146 install-bsdmp: installdirs libmp.a gmp.info install-info-files
147 $(INSTALL_DATA) libmp.a $(libdir)/libmp.a
148 -chmod a-x $(libdir)/libmp.a
149 $(INSTALL_DATA) $(srcdir)/mp.h $(includedir)/mp.h
150 -chmod a-x $(includedir)/mp.h
151 install-info-files: installdirs $(srcdir)/gmp.info
152 cd $(srcdir); for f in gmp.info*; \
153 do $(INSTALL_DATA) $$f $(infodir)/$$f; done
154 -chmod a-x $(infodir)/gmp.info*
155 # Attempt to edit the info directory node
156 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
157 install-info --dir-file=$(infodir)/dir $(infodir)/gmp.info; \
158 else true; fi
159
160 installdirs: $(srcdir)/mkinstalldirs
161 $(srcdir)/mkinstalldirs $(includedir) $(libdir) $(infodir)
162
163 uninstall:
164 rm -f $(libdir)/libgmp.a
165 rm -f $(includedir)/gmp.h
166 rm -f $(libdir)/libmp.a
167 rm -f $(includedir)/mp.h
168 rm -f $(infodir)/gmp.info*
169
170 clean mostlyclean:
171 rm -f *.o libgmp.a libmp.a gmp.dvi gmp.ps tmp.* tmp-*
172 rm -f gmp.?? gmp.??s gmp.log gmp.toc gmp.*aux gmp*.html
173 -cd mpn; $(MAKE) $@
174 -cd mpz; $(MAKE) $@
175 distclean: clean
176 rm -f Makefile config.status
177 -cd mpn; $(MAKE) $@
178 -cd mpz; $(MAKE) $@
179 maintainer-clean: distclean
180 rm -f $(srcdir)/gmp.info*
181
182 TAGS: force
183 cd $(srcdir); etags *.[ch] mp*/*.c mpn/generic/*.c >TAGS
184
185 dist:
186 @echo "sorry, not supported target"
187 @exit 1
188
189 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
190 $(SHELL) ./config.status
191
192 H = $(srcdir)/gmp.h $(srcdir)/gmp-impl.h mpn/gmp-mparam.h
193
194 extract-double.o: $(srcdir)/extract-double.c $(H)
195 insert-double.o: $(srcdir)/insert-double.c $(H)
196 memory.o: $(srcdir)/memory.c $(H)
197 mp_bpl.o: $(srcdir)/mp_bpl.c
198 mp_clz_tab.o: $(srcdir)/mp_clz_tab.c
199 mp_set_fns.o: $(srcdir)/mp_set_fns.c $(H)
200 stack-alloc.o: $(srcdir)/stack-alloc.c $(srcdir)/stack-alloc.h
201 version.o: $(srcdir)/version.c
202
203 force:
204 .PNONY: check install install-bsdmp install-info-files install-strip uninstall
205 .PHONY: doc clean distclean maintainer-clean force info dvi