Import Upstream version 0.8.2
[platform/upstream/mpc.git] / Makefile.vc
1
2 # Makefile for the MPC library (Windows version).
3 #
4 # Copyright (C) 2002, 2004, 2005, 2007, 2008, 2009, 2010 Andreas Enge, Mickael Gastineau, Paul Zimmermann
5 #
6 # This file is part of the MPC Library.
7 #
8 # The MPC Library is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation; either version 2.1 of the License, or (at your
11 # option) any later version.
12 #
13 # The MPC Library is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 # License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with the MPC Library; see the file COPYING.LIB.  If not, write to
20 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 # MA 02111-1307, USA.
22 #
23
24 # usage:
25 #  nmake /f Makefile.vc clean
26 #       clean the temporaries objects
27 #
28 #  nmake /f Makefile.vc  STATIC=0|1 GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory
29 #      compile MPC
30 #
31 #  nmake /f Makefile.vc  STATIC=0|1 install GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory  DESTDIR=installdirectory
32 #      install MPC to installdirectory
33 #
34 #  nmake /f Makefile.vc  STATIC=0|1 check GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory
35 #      perform tests on MPC
36 #
37 #  GMPDIR : specify the location where GMP is installed
38 #  MPFRDIR : specify the location where MPFR is installed
39 #  DESTDIR : specify the location where MPC will be installed
40 #  STATIC  : specify if a static or dynamic library of MPC will be created
41 #            STATIC=1  : build a static library
42 #            STATIC=0  : build a dynamic library (DLL)
43 #            A dynamic library is created by default if STATIC is omitted (STATIC=0)
44
45
46 CPP = cl.exe
47 CC = cl.exe
48 CDEFAULTFLAGS=/O2 /GR- /MD /nologo /EHs
49
50 VERSION=0.8.2
51
52 ######################## do not edit below this line ##########################
53
54 DIRMPC=.\src
55 DIRMPCTESTS=.\tests\\
56
57 !if "$(STATIC)" == "0"
58 LIBRARY = libmpc.dll
59 LINKER = link.exe /DLL
60 GMPMUSTBEDLL=/D__GMP_LIBGMP_DLL
61 !else
62 LIBRARY = libmpc.lib
63 LINKER = lib.exe
64 GMPMUSTBEDLL=
65 !endif
66
67 INCLUDES = /I$(DIRMPC) /I$(GMPDIR)\include  /I$(MPFR)\include
68 CKERNELFLAGS = $(CDEFAULTFLAGS) $(GMPMUSTBEDLL)   $(INCLUDES)
69 CFLAGS = $(CKERNELFLAGS)  /D__MPC_WITHIN_MPC /D_GMP_IEEE_FLOATS /DHAVE_CONFIG_H
70
71 TESTCOMPILE=$(CC) $(CKERNELFLAGS) $(DIRMPCTESTS)\tgeneric.c $(DIRMPCTESTS)\comparisons.c $(DIRMPCTESTS)\memory.c $(DIRMPCTESTS)\read_data.c $(DIRMPCTESTS)\random.c $(DIRMPCTESTS)
72 MIDTESTCOMPILE=/link  /out:$(DIRMPCTESTS)
73 ENDTESTCOMPILE=/LIBPATH:"$(GMPDIR)\lib" libmpc.lib libmpfr.lib libgmp.lib
74
75
76 #generate the CPPOBJECTS : goto src and execute
77 # ls *.c | sed "s/\.c/\.obj/" | awk ' { printf("$(DIRMPC)\\%s \\\n",$1); } '
78 #generate the CPPLINKOBJECTS : goto src and execute
79 # ls *.c | sed "s/\.c/\.obj/" | awk ' { printf("%s \\\n",$1); } '
80 #generate the list for tests : goto tests and execute
81 # ls t*.c | sed "s/\.c//" | grep -v tgeneric| grep -v comparisons | grep -v read_data | grep -v random | awk ' { printf("\t$(TESTCOMPILE)%s.c  $(MIDTESTCOMPILE)%s.exe $(ENDTESTCOMPILE)\n\tcd $(DIRMPCTESTS) && %s.exe && cd ..\n",$1,$1,$1,$1); } '
82
83 LIBRARYLIB = libmpc.lib
84
85 CPPOBJECTS = $(DIRMPC)\abs.obj \
86 $(DIRMPC)\acos.obj \
87 $(DIRMPC)\acosh.obj \
88 $(DIRMPC)\add.obj \
89 $(DIRMPC)\add_fr.obj \
90 $(DIRMPC)\add_ui.obj \
91 $(DIRMPC)\arg.obj \
92 $(DIRMPC)\asin.obj \
93 $(DIRMPC)\asinh.obj \
94 $(DIRMPC)\atan.obj \
95 $(DIRMPC)\atanh.obj \
96 $(DIRMPC)\clear.obj \
97 $(DIRMPC)\cmp.obj \
98 $(DIRMPC)\cmp_si_si.obj \
99 $(DIRMPC)\conj.obj \
100 $(DIRMPC)\cos.obj \
101 $(DIRMPC)\cosh.obj \
102 $(DIRMPC)\div.obj \
103 $(DIRMPC)\div_2exp.obj \
104 $(DIRMPC)\div_fr.obj \
105 $(DIRMPC)\div_ui.obj \
106 $(DIRMPC)\exp.obj \
107 $(DIRMPC)\fr_div.obj \
108 $(DIRMPC)\fr_sub.obj \
109 $(DIRMPC)\get_prec.obj \
110 $(DIRMPC)\get_prec2.obj \
111 $(DIRMPC)\get_str.obj \
112 $(DIRMPC)\get_version.obj \
113 $(DIRMPC)\imag.obj \
114 $(DIRMPC)\init2.obj \
115 $(DIRMPC)\init3.obj \
116 $(DIRMPC)\inp_str.obj \
117 $(DIRMPC)\log.obj \
118 $(DIRMPC)\mem.obj \
119 $(DIRMPC)\mul.obj \
120 $(DIRMPC)\mul_2exp.obj \
121 $(DIRMPC)\mul_fr.obj \
122 $(DIRMPC)\mul_i.obj \
123 $(DIRMPC)\mul_si.obj \
124 $(DIRMPC)\mul_ui.obj \
125 $(DIRMPC)\neg.obj \
126 $(DIRMPC)\norm.obj \
127 $(DIRMPC)\out_str.obj \
128 $(DIRMPC)\pow.obj \
129 $(DIRMPC)\pow_d.obj \
130 $(DIRMPC)\pow_fr.obj \
131 $(DIRMPC)\pow_ld.obj \
132 $(DIRMPC)\pow_si.obj \
133 $(DIRMPC)\pow_ui.obj \
134 $(DIRMPC)\pow_z.obj \
135 $(DIRMPC)\proj.obj \
136 $(DIRMPC)\real.obj \
137 $(DIRMPC)\set.obj \
138 $(DIRMPC)\set_prec.obj \
139 $(DIRMPC)\set_str.obj \
140 $(DIRMPC)\set_x.obj \
141 $(DIRMPC)\set_x_x.obj \
142 $(DIRMPC)\sin.obj \
143 $(DIRMPC)\sinh.obj \
144 $(DIRMPC)\sqr.obj \
145 $(DIRMPC)\sqrt.obj \
146 $(DIRMPC)\strtoc.obj \
147 $(DIRMPC)\sub.obj \
148 $(DIRMPC)\sub_fr.obj \
149 $(DIRMPC)\sub_ui.obj \
150 $(DIRMPC)\swap.obj \
151 $(DIRMPC)\tan.obj \
152 $(DIRMPC)\tanh.obj \
153 $(DIRMPC)\uceil_log2.obj \
154 $(DIRMPC)\ui_div.obj \
155 $(DIRMPC)\ui_ui_sub.obj \
156 $(DIRMPC)\urandom.obj
157
158
159
160 CPPLINKOBJECTS = abs.obj \
161 acos.obj \
162 acosh.obj \
163 add.obj \
164 add_fr.obj \
165 add_ui.obj \
166 arg.obj \
167 asin.obj \
168 asinh.obj \
169 atan.obj \
170 atanh.obj \
171 clear.obj \
172 cmp.obj \
173 cmp_si_si.obj \
174 conj.obj \
175 cos.obj \
176 cosh.obj \
177 div.obj \
178 div_2exp.obj \
179 div_fr.obj \
180 div_ui.obj \
181 exp.obj \
182 fr_div.obj \
183 fr_sub.obj \
184 get_prec.obj \
185 get_prec2.obj \
186 get_str.obj \
187 get_version.obj \
188 imag.obj \
189 init2.obj \
190 init3.obj \
191 inp_str.obj \
192 log.obj \
193 mem.obj \
194 mul.obj \
195 mul_2exp.obj \
196 mul_fr.obj \
197 mul_i.obj \
198 mul_si.obj \
199 mul_ui.obj \
200 neg.obj \
201 norm.obj \
202 out_str.obj \
203 pow.obj \
204 pow_d.obj \
205 pow_fr.obj \
206 pow_ld.obj \
207 pow_si.obj \
208 pow_ui.obj \
209 pow_z.obj \
210 proj.obj \
211 real.obj \
212 set.obj \
213 set_prec.obj \
214 set_str.obj \
215 set_x.obj \
216 set_x_x.obj \
217 sin.obj \
218 sinh.obj \
219 sqr.obj \
220 sqrt.obj \
221 strtoc.obj \
222 sub.obj \
223 sub_fr.obj \
224 sub_ui.obj \
225 swap.obj \
226 tan.obj \
227 tanh.obj \
228 uceil_log2.obj \
229 ui_div.obj \
230 ui_ui_sub.obj \
231 urandom.obj
232
233 #
234 # Link target: automatically builds its object dependencies before
235 # executing its link command.
236 #
237
238 $(LIBRARY): $(DIRMPC)config.h $(CPPOBJECTS)
239         $(LINKER) /out:$@ $(CPPLINKOBJECTS) /LIBPATH:"$(GMPDIR)\lib" libmpfr.lib libgmp.lib
240
241 $(DIRMPC)config.h :
242         echo #define PACKAGE_STRING "mpc"           >$(DIRMPC)\config.h
243         echo #define PACKAGE_VERSION "$(VERSION)"   >>$(DIRMPC)\config.h
244         echo #define STDC_HEADERS 1                 >>$(DIRMPC)\config.h
245
246
247 #
248 # Clean target: "nmake /f Makefile.vc clean" to remove unwanted
249 #               objects and executables.
250 #
251
252 clean:
253         del *.obj $(CPPLINKOBJECTS) $(LIBRARY) *.tlh  $(DIRMPC)config.h *.dll *.lib *.exe
254
255
256
257 #
258 # install target: "nmake /f Makefile.vc install DESTDIR=xxx" to perform the installation.
259 #
260
261 install: $(LIBRARY)
262         -mkdir $(DESTDIR)
263         -mkdir $(DESTDIR)\include
264         copy $(DIRMPC)\mpc.h $(DESTDIR)\include
265         -mkdir $(DESTDIR)\lib
266         copy $(LIBRARY) $(DESTDIR)\lib
267         copy $(LIBRARYLIB) $(DESTDIR)\lib
268
269 #
270 # check target: "nmake /f Makefile.vc check GMPDIR=xxx MPFRDIR=xxx" to perform the installation.
271 #
272 check : test
273 test :
274         -copy $(GMPDIR)\lib\*gmp*.dll $(DIRMPCTESTS)
275         -copy $(MPFRDIR)\lib\*mpfr*.dll $(DIRMPCTESTS)
276         copy $(LIBRARY)  $(DIRMPCTESTS)
277         $(TESTCOMPILE)tabs.c  $(MIDTESTCOMPILE)tabs.exe $(ENDTESTCOMPILE)
278         cd $(DIRMPCTESTS) && tabs.exe && cd ..
279         $(TESTCOMPILE)tacos.c  $(MIDTESTCOMPILE)tacos.exe $(ENDTESTCOMPILE)
280         cd $(DIRMPCTESTS) && tacos.exe && cd ..
281         $(TESTCOMPILE)tacosh.c  $(MIDTESTCOMPILE)tacosh.exe $(ENDTESTCOMPILE)
282         cd $(DIRMPCTESTS) && tacosh.exe && cd ..
283         $(TESTCOMPILE)tadd.c  $(MIDTESTCOMPILE)tadd.exe $(ENDTESTCOMPILE)
284         cd $(DIRMPCTESTS) && tadd.exe && cd ..
285         $(TESTCOMPILE)tadd_fr.c  $(MIDTESTCOMPILE)tadd_fr.exe $(ENDTESTCOMPILE)
286         cd $(DIRMPCTESTS) && tadd_fr.exe && cd ..
287         $(TESTCOMPILE)tadd_ui.c  $(MIDTESTCOMPILE)tadd_ui.exe $(ENDTESTCOMPILE)
288         cd $(DIRMPCTESTS) && tadd_ui.exe && cd ..
289         $(TESTCOMPILE)targ.c  $(MIDTESTCOMPILE)targ.exe $(ENDTESTCOMPILE)
290         cd $(DIRMPCTESTS) && targ.exe && cd ..
291         $(TESTCOMPILE)tasin.c  $(MIDTESTCOMPILE)tasin.exe $(ENDTESTCOMPILE)
292         cd $(DIRMPCTESTS) && tasin.exe && cd ..
293         $(TESTCOMPILE)tasinh.c  $(MIDTESTCOMPILE)tasinh.exe $(ENDTESTCOMPILE)
294         cd $(DIRMPCTESTS) && tasinh.exe && cd ..
295         $(TESTCOMPILE)tatan.c  $(MIDTESTCOMPILE)tatan.exe $(ENDTESTCOMPILE)
296         cd $(DIRMPCTESTS) && tatan.exe && cd ..
297         $(TESTCOMPILE)tatanh.c  $(MIDTESTCOMPILE)tatanh.exe $(ENDTESTCOMPILE)
298         cd $(DIRMPCTESTS) && tatanh.exe && cd ..
299         $(TESTCOMPILE)tconj.c  $(MIDTESTCOMPILE)tconj.exe $(ENDTESTCOMPILE)
300         cd $(DIRMPCTESTS) && tconj.exe && cd ..
301         $(TESTCOMPILE)tcos.c  $(MIDTESTCOMPILE)tcos.exe $(ENDTESTCOMPILE)
302         cd $(DIRMPCTESTS) && tcos.exe && cd ..
303         $(TESTCOMPILE)tcosh.c  $(MIDTESTCOMPILE)tcosh.exe $(ENDTESTCOMPILE)
304         cd $(DIRMPCTESTS) && tcosh.exe && cd ..
305         $(TESTCOMPILE)tdiv.c  $(MIDTESTCOMPILE)tdiv.exe $(ENDTESTCOMPILE)
306         cd $(DIRMPCTESTS) && tdiv.exe && cd ..
307         $(TESTCOMPILE)tdiv_2exp.c  $(MIDTESTCOMPILE)tdiv_2exp.exe $(ENDTESTCOMPILE)
308         cd $(DIRMPCTESTS) && tdiv_2exp.exe && cd ..
309         $(TESTCOMPILE)tdiv_fr.c  $(MIDTESTCOMPILE)tdiv_fr.exe $(ENDTESTCOMPILE)
310         cd $(DIRMPCTESTS) && tdiv_fr.exe && cd ..
311         $(TESTCOMPILE)tdiv_ui.c  $(MIDTESTCOMPILE)tdiv_ui.exe $(ENDTESTCOMPILE)
312         cd $(DIRMPCTESTS) && tdiv_ui.exe && cd ..
313         $(TESTCOMPILE)texp.c  $(MIDTESTCOMPILE)texp.exe $(ENDTESTCOMPILE)
314         cd $(DIRMPCTESTS) && texp.exe && cd ..
315         $(TESTCOMPILE)tfr_div.c  $(MIDTESTCOMPILE)tfr_div.exe $(ENDTESTCOMPILE)
316         cd $(DIRMPCTESTS) && tfr_div.exe && cd ..
317         $(TESTCOMPILE)tfr_sub.c  $(MIDTESTCOMPILE)tfr_sub.exe $(ENDTESTCOMPILE)
318         cd $(DIRMPCTESTS) && tfr_sub.exe && cd ..
319         $(TESTCOMPILE)tget_version.c  $(MIDTESTCOMPILE)tget_version.exe $(ENDTESTCOMPILE)
320         cd $(DIRMPCTESTS) && tget_version.exe && cd ..
321         $(TESTCOMPILE)timag.c  $(MIDTESTCOMPILE)timag.exe $(ENDTESTCOMPILE)
322         cd $(DIRMPCTESTS) && timag.exe && cd ..
323         $(TESTCOMPILE)tio_str.c  $(MIDTESTCOMPILE)tio_str.exe $(ENDTESTCOMPILE)
324         cd $(DIRMPCTESTS) && tio_str.exe && cd ..
325         $(TESTCOMPILE)tlog.c  $(MIDTESTCOMPILE)tlog.exe $(ENDTESTCOMPILE)
326         cd $(DIRMPCTESTS) && tlog.exe && cd ..
327         $(TESTCOMPILE)tmul.c  $(MIDTESTCOMPILE)tmul.exe $(ENDTESTCOMPILE)
328         cd $(DIRMPCTESTS) && tmul.exe && cd ..
329         $(TESTCOMPILE)tmul_2exp.c  $(MIDTESTCOMPILE)tmul_2exp.exe $(ENDTESTCOMPILE)
330         cd $(DIRMPCTESTS) && tmul_2exp.exe && cd ..
331         $(TESTCOMPILE)tmul_fr.c  $(MIDTESTCOMPILE)tmul_fr.exe $(ENDTESTCOMPILE)
332         cd $(DIRMPCTESTS) && tmul_fr.exe && cd ..
333         $(TESTCOMPILE)tmul_i.c  $(MIDTESTCOMPILE)tmul_i.exe $(ENDTESTCOMPILE)
334         cd $(DIRMPCTESTS) && tmul_i.exe && cd ..
335         $(TESTCOMPILE)tmul_si.c  $(MIDTESTCOMPILE)tmul_si.exe $(ENDTESTCOMPILE)
336         cd $(DIRMPCTESTS) && tmul_si.exe && cd ..
337         $(TESTCOMPILE)tmul_ui.c  $(MIDTESTCOMPILE)tmul_ui.exe $(ENDTESTCOMPILE)
338         cd $(DIRMPCTESTS) && tmul_ui.exe && cd ..
339         $(TESTCOMPILE)tneg.c  $(MIDTESTCOMPILE)tneg.exe $(ENDTESTCOMPILE)
340         cd $(DIRMPCTESTS) && tneg.exe && cd ..
341         $(TESTCOMPILE)tnorm.c  $(MIDTESTCOMPILE)tnorm.exe $(ENDTESTCOMPILE)
342         cd $(DIRMPCTESTS) && tnorm.exe && cd ..
343         $(TESTCOMPILE)tpow.c  $(MIDTESTCOMPILE)tpow.exe $(ENDTESTCOMPILE)
344         cd $(DIRMPCTESTS) && tpow.exe && cd ..
345         $(TESTCOMPILE)tpow_d.c  $(MIDTESTCOMPILE)tpow_d.exe $(ENDTESTCOMPILE)
346         cd $(DIRMPCTESTS) && tpow_d.exe && cd ..
347         $(TESTCOMPILE)tpow_fr.c  $(MIDTESTCOMPILE)tpow_fr.exe $(ENDTESTCOMPILE)
348         cd $(DIRMPCTESTS) && tpow_fr.exe && cd ..
349         $(TESTCOMPILE)tpow_ld.c  $(MIDTESTCOMPILE)tpow_ld.exe $(ENDTESTCOMPILE)
350         cd $(DIRMPCTESTS) && tpow_ld.exe && cd ..
351         $(TESTCOMPILE)tpow_si.c  $(MIDTESTCOMPILE)tpow_si.exe $(ENDTESTCOMPILE)
352         cd $(DIRMPCTESTS) && tpow_si.exe && cd ..
353         $(TESTCOMPILE)tpow_ui.c  $(MIDTESTCOMPILE)tpow_ui.exe $(ENDTESTCOMPILE)
354         cd $(DIRMPCTESTS) && tpow_ui.exe && cd ..
355         $(TESTCOMPILE)tpow_z.c  $(MIDTESTCOMPILE)tpow_z.exe $(ENDTESTCOMPILE)
356         cd $(DIRMPCTESTS) && tpow_z.exe && cd ..
357         $(TESTCOMPILE)tprec.c  $(MIDTESTCOMPILE)tprec.exe $(ENDTESTCOMPILE)
358         cd $(DIRMPCTESTS) && tprec.exe && cd ..
359         $(TESTCOMPILE)tproj.c  $(MIDTESTCOMPILE)tproj.exe $(ENDTESTCOMPILE)
360         cd $(DIRMPCTESTS) && tproj.exe && cd ..
361         $(TESTCOMPILE)treal.c  $(MIDTESTCOMPILE)treal.exe $(ENDTESTCOMPILE)
362         cd $(DIRMPCTESTS) && treal.exe && cd ..
363         $(TESTCOMPILE)treimref.c  $(MIDTESTCOMPILE)treimref.exe $(ENDTESTCOMPILE)
364         cd $(DIRMPCTESTS) && treimref.exe && cd ..
365         $(TESTCOMPILE)tset.c  $(MIDTESTCOMPILE)tset.exe $(ENDTESTCOMPILE)
366         cd $(DIRMPCTESTS) && tset.exe && cd ..
367         $(TESTCOMPILE)tsin.c  $(MIDTESTCOMPILE)tsin.exe $(ENDTESTCOMPILE)
368         cd $(DIRMPCTESTS) && tsin.exe && cd ..
369         $(TESTCOMPILE)tsinh.c  $(MIDTESTCOMPILE)tsinh.exe $(ENDTESTCOMPILE)
370         cd $(DIRMPCTESTS) && tsinh.exe && cd ..
371         $(TESTCOMPILE)tsqr.c  $(MIDTESTCOMPILE)tsqr.exe $(ENDTESTCOMPILE)
372         cd $(DIRMPCTESTS) && tsqr.exe && cd ..
373         $(TESTCOMPILE)tsqrt.c  $(MIDTESTCOMPILE)tsqrt.exe $(ENDTESTCOMPILE)
374         cd $(DIRMPCTESTS) && tsqrt.exe && cd ..
375         $(TESTCOMPILE)tstrtoc.c  $(MIDTESTCOMPILE)tstrtoc.exe $(ENDTESTCOMPILE)
376         cd $(DIRMPCTESTS) && tstrtoc.exe && cd ..
377         $(TESTCOMPILE)tsub.c  $(MIDTESTCOMPILE)tsub.exe $(ENDTESTCOMPILE)
378         cd $(DIRMPCTESTS) && tsub.exe && cd ..
379         $(TESTCOMPILE)tsub_fr.c  $(MIDTESTCOMPILE)tsub_fr.exe $(ENDTESTCOMPILE)
380         cd $(DIRMPCTESTS) && tsub_fr.exe && cd ..
381         $(TESTCOMPILE)tsub_ui.c  $(MIDTESTCOMPILE)tsub_ui.exe $(ENDTESTCOMPILE)
382         cd $(DIRMPCTESTS) && tsub_ui.exe && cd ..
383         $(TESTCOMPILE)ttan.c  $(MIDTESTCOMPILE)ttan.exe $(ENDTESTCOMPILE)
384         cd $(DIRMPCTESTS) && ttan.exe && cd ..
385         $(TESTCOMPILE)ttanh.c  $(MIDTESTCOMPILE)ttanh.exe $(ENDTESTCOMPILE)
386         cd $(DIRMPCTESTS) && ttanh.exe && cd ..
387         $(TESTCOMPILE)tui_div.c  $(MIDTESTCOMPILE)tui_div.exe $(ENDTESTCOMPILE)
388         cd $(DIRMPCTESTS) && tui_div.exe && cd ..
389         $(TESTCOMPILE)tui_ui_sub.c  $(MIDTESTCOMPILE)tui_ui_sub.exe $(ENDTESTCOMPILE)
390         cd $(DIRMPCTESTS) && tui_ui_sub.exe && cd ..
391         @echo --------------------------------------------------
392         @echo All tests passed
393         @echo --------------------------------------------------