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)"
64 ifeq "(EnableWin32DLLs)" "YES"
69 $(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<
71 libgmp.a: mpn/libmpn.a mpz/libmpz.a $(OBJS)
77 ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
80 cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
81 if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
86 dllwrap -mno-cygwin --target=i386-unknown-mingw32 \
87 --export-all --dllname gmp.dll --output-lib=libgmp_imp.a \
90 libmp.a: mpn/libmpn.a mpbsd/libmpbsd.a $(OBJS)
96 ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
99 cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
100 if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
105 cd mpn; $(MAKE) $(FLAGS_TO_PASS) libmpn.a
107 cd mpz; $(MAKE) $(FLAGS_TO_PASS) libmpz.a
110 cd mpz/tests; $(MAKE) $(FLAGS_TO_PASS) check
112 doc: gmp.dvi gmp.info
114 info: $(srcdir)/gmp.info
115 $(srcdir)/gmp.info: $(srcdir)/gmp.texi
116 cd $(srcdir); $(MAKEINFO) gmp.texi
119 gmp.dvi: $(srcdir)/gmp.texi
121 $(LN) $(srcdir)/gmp.texi tmp.texi
122 TEXINPUTS=.:$(srcdir) $(TEXI2DVI) tmp.texi
129 dvips gmp.dvi -o gmp.ps
132 gmp_toc.html: $(srcdir)/gmp.texi
133 texi2html -acc -split_chapter $(srcdir)/gmp.texi
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
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; \
160 installdirs: $(srcdir)/mkinstalldirs
161 $(srcdir)/mkinstalldirs $(includedir) $(libdir) $(infodir)
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*
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
176 rm -f Makefile config.status
179 maintainer-clean: distclean
180 rm -f $(srcdir)/gmp.info*
183 cd $(srcdir); etags *.[ch] mp*/*.c mpn/generic/*.c >TAGS
186 @echo "sorry, not supported target"
189 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
190 $(SHELL) ./config.status
192 H = $(srcdir)/gmp.h $(srcdir)/gmp-impl.h mpn/gmp-mparam.h
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
204 .PNONY: check install install-bsdmp install-info-files install-strip uninstall
205 .PHONY: doc clean distclean maintainer-clean force info dvi