aboutsummaryrefslogtreecommitdiff
path: root/contrib/libgmp/Makefile.in
blob: 6d7ff619fa410c9bd98cf42612efe0dd76ab1faf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Top Makefile for GNU MP
# Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.

# This file is part of the GNU MP Library.

# The GNU MP Library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.

# The GNU MP Library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
# License for more details.

# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.

srcdir = .

prefix = /usr/local

exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib
infodir = $(prefix)/info
includedir = $(prefix)/include

CC = gcc
LOCAL_CC = $(CC)
CFLAGS = -g -O
XCFLAGS = 
AR = ar
AR_FLAGS = rc
RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
RANLIB = ranlib
SHELL = /bin/sh
INSTALL = $(srcdir)/install.sh -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)
MAKEINFO = makeinfo
MAKEINFOFLAGS =
TEXI2DVI = texi2dvi
LN = ln -s

#### host and target specific makefile fragments come in here.
###

SRCS = memory.c mp_set_fns.c mp_clz_tab.c version.c stack-alloc.c mp_bpl.c \
  extract-double.c insert-double.c
OBJS = memory.o mp_set_fns.o mp_clz_tab.o version.o stack-alloc.o mp_bpl.o \
  extract-double.o insert-double.o
FILES = gmp.h mp.h gmp-impl.h longlong.h urandom.h move-if-change \
 mkinstalldirs INSTALL COPYING.LIB ChangeLog Makefile.in \
 NEWS README SPEED TODO config.guess config.sub configure configure.in \
 gmp.info* gmp.texi texinfo.tex $(SRCS)

INCLUDES = -I. -Impn -I$(srcdir)
FLAGS_TO_PASS = "CC=$(CC)" "CFLAGS=$(CFLAGS)" "XCFLAGS=$(XCFLAGS)"

all: libgmp.a

.c.o:
	$(CC) -c $(INCLUDES) $(CFLAGS) $(XCFLAGS) $<

libgmp.a: mpn/libmpn.a mpz/libmpz.a mpf/libmpf.a mpq/libmpq.a $(OBJS)
	rm -rf tmpdir
	mkdir tmpdir
	for i in mpn mpz mpf mpq; \
	  do \
	    mkdir tmpdir/$$i; \
	    ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
	  done
	cp $(OBJS) tmpdir
	cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
	if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
	mv tmpdir/$@ .
	rm -rf tmpdir

libmp.a: mpn/libmpn.a mpbsd/libmpbsd.a $(OBJS)
	rm -rf tmpdir
	mkdir tmpdir
	for i in mpn mpbsd; \
	  do \
	    mkdir tmpdir/$$i; \
	    ( cd tmpdir/$$i; $(AR) x ../../$$i/lib$$i.a ); \
	  done
	cp $(OBJS) tmpdir
	cd tmpdir; $(AR) $(AR_FLAGS) $@ *.o */*.o
	if $(RANLIB_TEST) ; then $(RANLIB) tmpdir/$@; else true; fi
	mv tmpdir/$@ .
	rm -rf tmpdir

mpn/libmpn.a: force
	cd mpn; $(MAKE) $(FLAGS_TO_PASS) libmpn.a
mpz/libmpz.a: force
	cd mpz; $(MAKE) $(FLAGS_TO_PASS) libmpz.a
mpf/libmpf.a: force
	cd mpf; $(MAKE) $(FLAGS_TO_PASS) libmpf.a
mpq/libmpq.a: force
	cd mpq; $(MAKE) $(FLAGS_TO_PASS) libmpq.a
mpbsd/libmpbsd.a: force
	cd mpbsd; $(MAKE) $(FLAGS_TO_PASS) libmpbsd.a

check: libgmp.a
	cd mpz/tests; $(MAKE) $(FLAGS_TO_PASS) check
	cd mpq/tests; $(MAKE) $(FLAGS_TO_PASS) check
	cd mpf/tests; $(MAKE) $(FLAGS_TO_PASS) check

doc: gmp.dvi gmp.info

info: $(srcdir)/gmp.info
$(srcdir)/gmp.info: $(srcdir)/gmp.texi
	cd $(srcdir); $(MAKEINFO) gmp.texi

dvi: gmp.dvi
gmp.dvi: $(srcdir)/gmp.texi
	rm -f tmp.texi
	$(LN) $(srcdir)/gmp.texi tmp.texi
	TEXINPUTS=.:$(srcdir) $(TEXI2DVI) tmp.texi
	rm -f tmp.texi
	mv tmp.dvi gmp.dvi
	rm -f tmp.*

ps: gmp.ps
gmp.ps: gmp.dvi
	dvips gmp.dvi -o gmp.ps

html: gmp_toc.html
gmp_toc.html: $(srcdir)/gmp.texi
	texi2html -acc -split_chapter $(srcdir)/gmp.texi

# The semicolon is to prevent the install.sh -> install default rule
# from doing anything.  Having it run true helps avoid problems and
# noise from versions of make which don't like to have null commands.
install: install-normal ; @true

install-strip: install-normal
install-normal: installdirs libgmp.a gmp.info install-info-files
	$(INSTALL_DATA) libgmp.a $(libdir)/libgmp.a
	-chmod a-x $(libdir)/libgmp.a
	$(INSTALL_DATA) $(srcdir)/gmp.h $(includedir)/gmp.h
	-chmod a-x $(includedir)/gmp.h
install-bsdmp: installdirs libmp.a gmp.info install-info-files
	$(INSTALL_DATA) libmp.a $(libdir)/libmp.a
	-chmod a-x $(libdir)/libmp.a
	$(INSTALL_DATA) $(srcdir)/mp.h $(includedir)/mp.h
	-chmod a-x $(includedir)/mp.h
install-info-files: installdirs $(srcdir)/gmp.info
	cd $(srcdir); for f in gmp.info*; \
	do $(INSTALL_DATA) $$f $(infodir)/$$f; done
	-chmod a-x $(infodir)/gmp.info*
	# Attempt to edit the info directory node
	if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
	  install-info --dir-file=$(infodir)/dir $(infodir)/gmp.info; \
	  else true; fi

installdirs: $(srcdir)/mkinstalldirs
	$(srcdir)/mkinstalldirs $(includedir) $(libdir) $(infodir)

uninstall:
	rm -f $(libdir)/libgmp.a
	rm -f $(includedir)/gmp.h
	rm -f $(libdir)/libmp.a
	rm -f $(includedir)/mp.h
	rm -f $(infodir)/gmp.info*

clean mostlyclean:
	rm -f *.o libgmp.a libmp.a gmp.dvi gmp.ps tmp.* tmp-*
	rm -f gmp.?? gmp.??s gmp.log gmp.toc gmp.*aux gmp*.html
	-cd mpn; $(MAKE) $@
	-cd mpz; $(MAKE) $@
	-cd mpf; $(MAKE) $@
	-cd mpq; $(MAKE) $@
	-cd mpbsd; $(MAKE) $@
distclean: clean
	rm -f Makefile config.status
	-cd mpn; $(MAKE) $@
	-cd mpz; $(MAKE) $@
	-cd mpf; $(MAKE) $@
	-cd mpq; $(MAKE) $@
	-cd mpbsd; $(MAKE) $@
maintainer-clean: distclean
	rm -f $(srcdir)/gmp.info*

TAGS: force
	cd $(srcdir); etags *.[ch] mp*/*.c mpn/generic/*.c >TAGS

dist:
	@echo "sorry, not supported target"
	@exit 1

Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
	$(SHELL) ./config.status

H = $(srcdir)/gmp.h $(srcdir)/gmp-impl.h mpn/gmp-mparam.h

extract-double.o: $(srcdir)/extract-double.c $(H)
insert-double.o: $(srcdir)/insert-double.c $(H)
memory.o: $(srcdir)/memory.c $(H)
mp_bpl.o: $(srcdir)/mp_bpl.c
mp_clz_tab.o: $(srcdir)/mp_clz_tab.c
mp_set_fns.o: $(srcdir)/mp_set_fns.c $(H)
stack-alloc.o: $(srcdir)/stack-alloc.c $(srcdir)/stack-alloc.h
version.o: $(srcdir)/version.c

force:
.PNONY: check install install-bsdmp install-info-files install-strip uninstall
.PHONY: doc clean distclean maintainer-clean force info dvi