1 # Top Makefile for GNU MP
2 # Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
4 # This file is part of the GNU MP Library.
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.
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.
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,
25 exec_prefix = $(prefix)
26 libdir = $(exec_prefix)/lib
27 infodir = $(prefix)/info
28 includedir = $(prefix)/include
36 RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
39 INSTALL = $(srcdir)/install.sh -c
40 INSTALL_PROGRAM = $(INSTALL)
41 INSTALL_DATA = $(INSTALL)
47 #### host and target specific makefile fragments come in here.
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)
59 INCLUDES = -I. -Impn -I$(srcdir)
60 FLAGS_TO_PASS = "CC=$(CC)" "CFLAGS=$(CFLAGS)" "XCFLAGS=$(XCFLAGS)"
65 $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
67 libgmp.a: mpn/libmpn.a mpz/libmpz.a mpf/libmpf.a mpq/libmpq.a $(OBJS)
70 for i in mpn mpz mpf mpq; \
73 ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
76 cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
77 if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
81 libmp.a: mpn/libmpn.a mpbsd/libmpbsd.a $(OBJS)
87 ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
90 cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
91 if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
96 cd mpn; $(MAKE) $(FLAGS_TO_PASS) libmpn.a
98 cd mpz; $(MAKE) $(FLAGS_TO_PASS) libmpz.a
100 cd mpf; $(MAKE) $(FLAGS_TO_PASS) libmpf.a
102 cd mpq; $(MAKE) $(FLAGS_TO_PASS) libmpq.a
103 mpbsd/libmpbsd.a: force
104 cd mpbsd; $(MAKE) $(FLAGS_TO_PASS) libmpbsd.a
107 cd mpz/tests; $(MAKE) $(FLAGS_TO_PASS) check
108 cd mpq/tests; $(MAKE) $(FLAGS_TO_PASS) check
109 cd mpf/tests; $(MAKE) $(FLAGS_TO_PASS) check
111 doc: gmp.dvi gmp.info
113 info: $(srcdir)/gmp.info
114 $(srcdir)/gmp.info: $(srcdir)/gmp.texi
115 cd $(srcdir); $(MAKEINFO) gmp.texi
118 gmp.dvi: $(srcdir)/gmp.texi
120 $(LN) $(srcdir)/gmp.texi tmp.texi
121 TEXINPUTS=.:$(srcdir) $(TEXI2DVI) tmp.texi
128 dvips gmp.dvi -o gmp.ps
131 gmp_toc.html: $(srcdir)/gmp.texi
132 texi2html -acc -split_chapter $(srcdir)/gmp.texi
134 # The semicolon is to prevent the install.sh -> install default rule
135 # from doing anything. Having it run true helps avoid problems and
136 # noise from versions of make which don't like to have null commands.
137 install: install-normal ; @true
139 install-strip: install-normal
140 install-normal: installdirs libgmp.a gmp.info install-info-files
141 $(INSTALL_DATA) libgmp.a $(libdir)/libgmp.a
142 -chmod a-x $(libdir)/libgmp.a
143 $(INSTALL_DATA) $(srcdir)/gmp.h $(includedir)/gmp.h
144 -chmod a-x $(includedir)/gmp.h
145 install-bsdmp: installdirs libmp.a gmp.info install-info-files
146 $(INSTALL_DATA) libmp.a $(libdir)/libmp.a
147 -chmod a-x $(libdir)/libmp.a
148 $(INSTALL_DATA) $(srcdir)/mp.h $(includedir)/mp.h
149 -chmod a-x $(includedir)/mp.h
150 install-info-files: installdirs $(srcdir)/gmp.info
151 cd $(srcdir); for f in gmp.info*; \
152 do $(INSTALL_DATA) $$f $(infodir)/$$f; done
153 -chmod a-x $(infodir)/gmp.info*
154 # Attempt to edit the info directory node
155 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
156 install-info --dir-file=$(infodir)/dir $(infodir)/gmp.info; \
159 installdirs: $(srcdir)/mkinstalldirs
160 $(srcdir)/mkinstalldirs $(includedir) $(libdir) $(infodir)
163 rm -f $(libdir)/libgmp.a
164 rm -f $(includedir)/gmp.h
165 rm -f $(libdir)/libmp.a
166 rm -f $(includedir)/mp.h
167 rm -f $(infodir)/gmp.info*
170 rm -f *.o libgmp.a libmp.a gmp.dvi gmp.ps tmp.* tmp-*
171 rm -f gmp.?? gmp.??s gmp.log gmp.toc gmp.*aux gmp*.html
176 -cd mpbsd; $(MAKE) $@
178 rm -f Makefile config.status
183 -cd mpbsd; $(MAKE) $@
184 maintainer-clean: distclean
185 rm -f $(srcdir)/gmp.info*
188 cd $(srcdir); etags *.[ch] mp*/*.c mpn/generic/*.c >TAGS
191 @echo "sorry, not supported target"
194 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
195 $(SHELL) ./config.status
197 H = $(srcdir)/gmp.h $(srcdir)/gmp-impl.h mpn/gmp-mparam.h
199 extract-double.o: $(srcdir)/extract-double.c $(H)
200 insert-double.o: $(srcdir)/insert-double.c $(H)
201 memory.o: $(srcdir)/memory.c $(H)
202 mp_bpl.o: $(srcdir)/mp_bpl.c
203 mp_clz_tab.o: $(srcdir)/mp_clz_tab.c
204 mp_set_fns.o: $(srcdir)/mp_set_fns.c $(H)
205 stack-alloc.o: $(srcdir)/stack-alloc.c $(srcdir)/stack-alloc.h
206 version.o: $(srcdir)/version.c
209 .PNONY: check install install-bsdmp install-info-files install-strip uninstall
210 .PHONY: doc clean distclean maintainer-clean force info dvi