1 # Makefile for the MPC library (Windows version).
3 # Copyright (C) INRIA - CNRS, 2002, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
5 # This file is part of the MPC Library.
7 # The MPC Library is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser General Public License as published by
9 # the Free Software Foundation; either version 2.1 of the License, or (at your
10 # option) any later version.
12 # The MPC Library is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 # License for more details.
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with the MPC Library; see the file COPYING.LIB. If not, write to
19 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24 # nmake /f Makefile.vc clean
25 # clean the temporaries objects
27 # nmake /f Makefile.vc STATIC=0|1 GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory
30 # nmake /f Makefile.vc STATIC=0|1 install GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory DESTDIR=installdirectory
31 # install MPC to installdirectory
33 # nmake /f Makefile.vc STATIC=0|1 check GMPDIR=gmpdirectory MPFRDIR=mpfrdirectory
34 # perform tests on MPC
36 # GMPDIR : specify the location where GMP is installed
37 # MPFRDIR : specify the location where MPFR is installed
38 # DESTDIR : specify the location where MPC will be installed
39 # STATIC : specify if a static or dynamic library of MPC will be created
40 # STATIC=1 : build a static library
41 # STATIC=0 : build a dynamic library (DLL)
42 # A dynamic library is created by default if STATIC is omitted (STATIC=0)
43 # ENABLELOGGING : specify if MPC functions calls are logged
44 # ENABLELOGGING=1 : MPC functions calls are logged
45 # ENABLELOGGING=0 : MPC functions calls are not logged (default)
46 # Functions calls are not logged by default if ENABLELOGGING is omitted (ENABLELOGGING=0)
51 CDEFAULTFLAGS=/O2 /GR- /MD /nologo /EHs
55 ######################## do not edit below this line ##########################
60 !if "$(STATIC)" == "0"
62 LINKER = link.exe /DLL
63 GMPMUSTBEDLL=/D__GMP_LIBGMP_DLL
70 #check for logging. if yes then add logging.c to the library
71 !if "$(ENABLELOGGING)" == "1"
72 CPPOBJECTS_LOGGING = $(DIRMPC)\logging.obj
73 CPPLINKOBJECTS_LOGGING = logging.obj
74 LIBS_LOGGING = kernel32.lib
77 CPPLINKOBJECTS_LOGGING =
82 INCLUDES = /I$(DIRMPC) /I$(GMPDIR)\include /I$(MPFR)\include
83 CKERNELFLAGS = $(CDEFAULTFLAGS) $(GMPMUSTBEDLL) $(INCLUDES)
84 CFLAGS = $(CKERNELFLAGS) /D__MPC_WITHIN_MPC /D_GMP_IEEE_FLOATS /DHAVE_CONFIG_H
86 TESTCOMPILE=$(CC) $(CKERNELFLAGS) $(DIRMPCTESTS)\tgeneric.c $(DIRMPCTESTS)\comparisons.c $(DIRMPCTESTS)\read_data.c $(DIRMPCTESTS)\random.c $(DIRMPCTESTS)
87 MIDTESTCOMPILE=/link /out:$(DIRMPCTESTS)
88 ENDTESTCOMPILE=/LIBPATH:"$(GMPDIR)\lib" libmpc.lib libmpfr.lib libgmp.lib $(LIBS_LOGGING)
91 #generate the CPPOBJECTS : goto src and execute
92 # ls *.c | sed "s/\.c/\.obj/" | awk ' { printf("$(DIRMPC)\\%s \\\n",$1); } '
93 #generate the CPPLINKOBJECTS : goto src and execute
94 # ls *.c | sed "s/\.c/\.obj/" | awk ' { printf("%s \\\n",$1); } '
95 #generate the list for tests : goto tests and execute
96 # 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); } '
98 LIBRARYLIB = libmpc.lib
100 CPPOBJECTS =$(DIRMPC)\abs.obj \
102 $(DIRMPC)\acosh.obj \
104 $(DIRMPC)\add_fr.obj \
105 $(DIRMPC)\add_si.obj \
106 $(DIRMPC)\add_ui.obj \
109 $(DIRMPC)\asinh.obj \
111 $(DIRMPC)\atanh.obj \
112 $(DIRMPC)\clear.obj \
114 $(DIRMPC)\cmp_si_si.obj \
119 $(DIRMPC)\div_2ui.obj \
120 $(DIRMPC)\div_fr.obj \
121 $(DIRMPC)\div_ui.obj \
124 $(DIRMPC)\fr_div.obj \
125 $(DIRMPC)\fr_sub.obj \
126 $(DIRMPC)\get_prec.obj \
127 $(DIRMPC)\get_prec2.obj \
128 $(DIRMPC)\get_version.obj \
129 $(DIRMPC)\get_x.obj \
131 $(DIRMPC)\init2.obj \
132 $(DIRMPC)\init3.obj \
133 $(DIRMPC)\inp_str.obj \
135 $(DIRMPC)\log10.obj \
138 $(DIRMPC)\mul_2ui.obj \
139 $(DIRMPC)\mul_fr.obj \
140 $(DIRMPC)\mul_i.obj \
141 $(DIRMPC)\mul_si.obj \
142 $(DIRMPC)\mul_ui.obj \
145 $(DIRMPC)\out_str.obj \
147 $(DIRMPC)\pow_d.obj \
148 $(DIRMPC)\pow_fr.obj \
149 $(DIRMPC)\pow_ld.obj \
150 $(DIRMPC)\pow_si.obj \
151 $(DIRMPC)\pow_ui.obj \
152 $(DIRMPC)\pow_z.obj \
156 $(DIRMPC)\set_prec.obj \
157 $(DIRMPC)\set_str.obj \
158 $(DIRMPC)\set_x.obj \
159 $(DIRMPC)\set_x_x.obj \
161 $(DIRMPC)\sin_cos.obj \
165 $(DIRMPC)\strtoc.obj \
167 $(DIRMPC)\sub_fr.obj \
168 $(DIRMPC)\sub_ui.obj \
172 $(DIRMPC)\uceil_log2.obj \
173 $(DIRMPC)\ui_div.obj \
174 $(DIRMPC)\ui_ui_sub.obj $(CPPOBJECTS_LOGGING) \
175 $(DIRMPC)\urandom.obj
177 CPPLINKOBJECTS = abs.obj \
251 ui_ui_sub.obj $(CPPLINKOBJECTS_LOGGING) \
255 # Link target: automatically builds its object dependencies before
256 # executing its link command.
259 $(LIBRARY): $(DIRMPC)config.h $(CPPOBJECTS)
260 $(LINKER) /out:$@ $(CPPLINKOBJECTS) /LIBPATH:"$(GMPDIR)\lib" libmpfr.lib libgmp.lib $(LIBS_LOGGING)
263 echo #define PACKAGE_STRING "mpc" >$(DIRMPC)\config.h
264 echo #define PACKAGE_VERSION "$(VERSION)" >>$(DIRMPC)\config.h
265 echo #define STDC_HEADERS 1 >>$(DIRMPC)\config.h
266 echo #define dlsym(handle, name) GetProcAddress(GetModuleHandle(handle), name) >>$(DIRMPC)\config.h
267 echo #include "windows.h" >>$(DIRMPC)\config.h
271 # Clean target: "nmake /f Makefile.vc clean" to remove unwanted
272 # objects and executables.
276 del *.obj $(CPPLINKOBJECTS) $(LIBRARY) *.tlh $(DIRMPC)config.h *.dll *.lib *.exe
281 # install target: "nmake /f Makefile.vc install DESTDIR=xxx" to perform the installation.
286 -mkdir $(DESTDIR)\include
287 copy $(DIRMPC)\mpc.h $(DESTDIR)\include
288 -mkdir $(DESTDIR)\lib
289 copy $(LIBRARY) $(DESTDIR)\lib
290 copy $(LIBRARYLIB) $(DESTDIR)\lib
293 # check target: "nmake /f Makefile.vc check GMPDIR=xxx MPFRDIR=xxx" to perform the installation.
297 -copy $(GMPDIR)\lib\*gmp*.dll $(DIRMPCTESTS)
298 -copy $(MPFRDIR)\lib\*mpfr*.dll $(DIRMPCTESTS)
299 copy $(LIBRARY) $(DIRMPCTESTS)
300 $(TESTCOMPILE)tabs.c $(MIDTESTCOMPILE)tabs.exe $(ENDTESTCOMPILE)
301 cd $(DIRMPCTESTS) && tabs.exe && cd ..
302 $(TESTCOMPILE)tacos.c $(MIDTESTCOMPILE)tacos.exe $(ENDTESTCOMPILE)
303 cd $(DIRMPCTESTS) && tacos.exe && cd ..
304 $(TESTCOMPILE)tacosh.c $(MIDTESTCOMPILE)tacosh.exe $(ENDTESTCOMPILE)
305 cd $(DIRMPCTESTS) && tacosh.exe && cd ..
306 $(TESTCOMPILE)tadd.c $(MIDTESTCOMPILE)tadd.exe $(ENDTESTCOMPILE)
307 cd $(DIRMPCTESTS) && tadd.exe && cd ..
308 $(TESTCOMPILE)tadd_fr.c $(MIDTESTCOMPILE)tadd_fr.exe $(ENDTESTCOMPILE)
309 cd $(DIRMPCTESTS) && tadd_fr.exe && cd ..
310 $(TESTCOMPILE)tadd_si.c $(MIDTESTCOMPILE)tadd_si.exe $(ENDTESTCOMPILE)
311 cd $(DIRMPCTESTS) && tadd_si.exe && cd ..
312 $(TESTCOMPILE)tadd_ui.c $(MIDTESTCOMPILE)tadd_ui.exe $(ENDTESTCOMPILE)
313 cd $(DIRMPCTESTS) && tadd_ui.exe && cd ..
314 $(TESTCOMPILE)targ.c $(MIDTESTCOMPILE)targ.exe $(ENDTESTCOMPILE)
315 cd $(DIRMPCTESTS) && targ.exe && cd ..
316 $(TESTCOMPILE)tasin.c $(MIDTESTCOMPILE)tasin.exe $(ENDTESTCOMPILE)
317 cd $(DIRMPCTESTS) && tasin.exe && cd ..
318 $(TESTCOMPILE)tasinh.c $(MIDTESTCOMPILE)tasinh.exe $(ENDTESTCOMPILE)
319 cd $(DIRMPCTESTS) && tasinh.exe && cd ..
320 $(TESTCOMPILE)tatan.c $(MIDTESTCOMPILE)tatan.exe $(ENDTESTCOMPILE)
321 cd $(DIRMPCTESTS) && tatan.exe && cd ..
322 $(TESTCOMPILE)tatanh.c $(MIDTESTCOMPILE)tatanh.exe $(ENDTESTCOMPILE)
323 cd $(DIRMPCTESTS) && tatanh.exe && cd ..
324 $(TESTCOMPILE)tconj.c $(MIDTESTCOMPILE)tconj.exe $(ENDTESTCOMPILE)
325 cd $(DIRMPCTESTS) && tconj.exe && cd ..
326 $(TESTCOMPILE)tcos.c $(MIDTESTCOMPILE)tcos.exe $(ENDTESTCOMPILE)
327 cd $(DIRMPCTESTS) && tcos.exe && cd ..
328 $(TESTCOMPILE)tcosh.c $(MIDTESTCOMPILE)tcosh.exe $(ENDTESTCOMPILE)
329 cd $(DIRMPCTESTS) && tcosh.exe && cd ..
330 $(TESTCOMPILE)tdiv.c $(MIDTESTCOMPILE)tdiv.exe $(ENDTESTCOMPILE)
331 cd $(DIRMPCTESTS) && tdiv.exe && cd ..
332 $(TESTCOMPILE)tdiv_2ui.c $(MIDTESTCOMPILE)tdiv_2ui.exe $(ENDTESTCOMPILE)
333 cd $(DIRMPCTESTS) && tdiv_2ui.exe && cd ..
334 $(TESTCOMPILE)tdiv_fr.c $(MIDTESTCOMPILE)tdiv_fr.exe $(ENDTESTCOMPILE)
335 cd $(DIRMPCTESTS) && tdiv_fr.exe && cd ..
336 $(TESTCOMPILE)tdiv_ui.c $(MIDTESTCOMPILE)tdiv_ui.exe $(ENDTESTCOMPILE)
337 cd $(DIRMPCTESTS) && tdiv_ui.exe && cd ..
338 $(TESTCOMPILE)texp.c $(MIDTESTCOMPILE)texp.exe $(ENDTESTCOMPILE)
339 cd $(DIRMPCTESTS) && texp.exe && cd ..
340 $(TESTCOMPILE)tfma.c $(MIDTESTCOMPILE)tfma.exe $(ENDTESTCOMPILE)
341 cd $(DIRMPCTESTS) && tfma.exe && cd ..
342 $(TESTCOMPILE)tfr_div.c $(MIDTESTCOMPILE)tfr_div.exe $(ENDTESTCOMPILE)
343 cd $(DIRMPCTESTS) && tfr_div.exe && cd ..
344 $(TESTCOMPILE)tfr_sub.c $(MIDTESTCOMPILE)tfr_sub.exe $(ENDTESTCOMPILE)
345 cd $(DIRMPCTESTS) && tfr_sub.exe && cd ..
346 $(TESTCOMPILE)tget_version.c $(MIDTESTCOMPILE)tget_version.exe $(ENDTESTCOMPILE)
347 cd $(DIRMPCTESTS) && tget_version.exe && cd ..
348 $(TESTCOMPILE)timag.c $(MIDTESTCOMPILE)timag.exe $(ENDTESTCOMPILE)
349 cd $(DIRMPCTESTS) && timag.exe && cd ..
350 $(TESTCOMPILE)tio_str.c $(MIDTESTCOMPILE)tio_str.exe $(ENDTESTCOMPILE)
351 cd $(DIRMPCTESTS) && tio_str.exe && cd ..
352 $(TESTCOMPILE)tlog.c $(MIDTESTCOMPILE)tlog.exe $(ENDTESTCOMPILE)
353 cd $(DIRMPCTESTS) && tlog.exe && cd ..
354 $(TESTCOMPILE)tlog10.c $(MIDTESTCOMPILE)tlog10.exe $(ENDTESTCOMPILE)
355 cd $(DIRMPCTESTS) && tlog10.exe && cd ..
356 $(TESTCOMPILE)tmul.c $(MIDTESTCOMPILE)tmul.exe $(ENDTESTCOMPILE)
357 cd $(DIRMPCTESTS) && tmul.exe && cd ..
358 $(TESTCOMPILE)tmul_2ui.c $(MIDTESTCOMPILE)tmul_2ui.exe $(ENDTESTCOMPILE)
359 cd $(DIRMPCTESTS) && tmul_2ui.exe && cd ..
360 $(TESTCOMPILE)tmul_fr.c $(MIDTESTCOMPILE)tmul_fr.exe $(ENDTESTCOMPILE)
361 cd $(DIRMPCTESTS) && tmul_fr.exe && cd ..
362 $(TESTCOMPILE)tmul_i.c $(MIDTESTCOMPILE)tmul_i.exe $(ENDTESTCOMPILE)
363 cd $(DIRMPCTESTS) && tmul_i.exe && cd ..
364 $(TESTCOMPILE)tmul_si.c $(MIDTESTCOMPILE)tmul_si.exe $(ENDTESTCOMPILE)
365 cd $(DIRMPCTESTS) && tmul_si.exe && cd ..
366 $(TESTCOMPILE)tmul_ui.c $(MIDTESTCOMPILE)tmul_ui.exe $(ENDTESTCOMPILE)
367 cd $(DIRMPCTESTS) && tmul_ui.exe && cd ..
368 $(TESTCOMPILE)tneg.c $(MIDTESTCOMPILE)tneg.exe $(ENDTESTCOMPILE)
369 cd $(DIRMPCTESTS) && tneg.exe && cd ..
370 $(TESTCOMPILE)tnorm.c $(MIDTESTCOMPILE)tnorm.exe $(ENDTESTCOMPILE)
371 cd $(DIRMPCTESTS) && tnorm.exe && cd ..
372 $(TESTCOMPILE)tpow.c $(MIDTESTCOMPILE)tpow.exe $(ENDTESTCOMPILE)
373 cd $(DIRMPCTESTS) && tpow.exe && cd ..
374 $(TESTCOMPILE)tpow_d.c $(MIDTESTCOMPILE)tpow_d.exe $(ENDTESTCOMPILE)
375 cd $(DIRMPCTESTS) && tpow_d.exe && cd ..
376 $(TESTCOMPILE)tpow_fr.c $(MIDTESTCOMPILE)tpow_fr.exe $(ENDTESTCOMPILE)
377 cd $(DIRMPCTESTS) && tpow_fr.exe && cd ..
378 $(TESTCOMPILE)tpow_ld.c $(MIDTESTCOMPILE)tpow_ld.exe $(ENDTESTCOMPILE)
379 cd $(DIRMPCTESTS) && tpow_ld.exe && cd ..
380 $(TESTCOMPILE)tpow_si.c $(MIDTESTCOMPILE)tpow_si.exe $(ENDTESTCOMPILE)
381 cd $(DIRMPCTESTS) && tpow_si.exe && cd ..
382 $(TESTCOMPILE)tpow_ui.c $(MIDTESTCOMPILE)tpow_ui.exe $(ENDTESTCOMPILE)
383 cd $(DIRMPCTESTS) && tpow_ui.exe && cd ..
384 $(TESTCOMPILE)tpow_z.c $(MIDTESTCOMPILE)tpow_z.exe $(ENDTESTCOMPILE)
385 cd $(DIRMPCTESTS) && tpow_z.exe && cd ..
386 $(TESTCOMPILE)tprec.c $(MIDTESTCOMPILE)tprec.exe $(ENDTESTCOMPILE)
387 cd $(DIRMPCTESTS) && tprec.exe && cd ..
388 $(TESTCOMPILE)tproj.c $(MIDTESTCOMPILE)tproj.exe $(ENDTESTCOMPILE)
389 cd $(DIRMPCTESTS) && tproj.exe && cd ..
390 $(TESTCOMPILE)treal.c $(MIDTESTCOMPILE)treal.exe $(ENDTESTCOMPILE)
391 cd $(DIRMPCTESTS) && treal.exe && cd ..
392 $(TESTCOMPILE)treimref.c $(MIDTESTCOMPILE)treimref.exe $(ENDTESTCOMPILE)
393 cd $(DIRMPCTESTS) && treimref.exe && cd ..
394 $(TESTCOMPILE)tset.c $(MIDTESTCOMPILE)tset.exe $(ENDTESTCOMPILE)
395 cd $(DIRMPCTESTS) && tset.exe && cd ..
396 $(TESTCOMPILE)tsin.c $(MIDTESTCOMPILE)tsin.exe $(ENDTESTCOMPILE)
397 cd $(DIRMPCTESTS) && tsin.exe && cd ..
398 $(TESTCOMPILE)tsin_cos.c $(MIDTESTCOMPILE)tsin_cos.exe $(ENDTESTCOMPILE)
399 cd $(DIRMPCTESTS) && tsin_cos.exe && cd ..
400 $(TESTCOMPILE)tsinh.c $(MIDTESTCOMPILE)tsinh.exe $(ENDTESTCOMPILE)
401 cd $(DIRMPCTESTS) && tsinh.exe && cd ..
402 $(TESTCOMPILE)tsqr.c $(MIDTESTCOMPILE)tsqr.exe $(ENDTESTCOMPILE)
403 cd $(DIRMPCTESTS) && tsqr.exe && cd ..
404 $(TESTCOMPILE)tsqrt.c $(MIDTESTCOMPILE)tsqrt.exe $(ENDTESTCOMPILE)
405 cd $(DIRMPCTESTS) && tsqrt.exe && cd ..
406 $(TESTCOMPILE)tstrtoc.c $(MIDTESTCOMPILE)tstrtoc.exe $(ENDTESTCOMPILE)
407 cd $(DIRMPCTESTS) && tstrtoc.exe && cd ..
408 $(TESTCOMPILE)tsub.c $(MIDTESTCOMPILE)tsub.exe $(ENDTESTCOMPILE)
409 cd $(DIRMPCTESTS) && tsub.exe && cd ..
410 $(TESTCOMPILE)tsub_fr.c $(MIDTESTCOMPILE)tsub_fr.exe $(ENDTESTCOMPILE)
411 cd $(DIRMPCTESTS) && tsub_fr.exe && cd ..
412 $(TESTCOMPILE)tsub_ui.c $(MIDTESTCOMPILE)tsub_ui.exe $(ENDTESTCOMPILE)
413 cd $(DIRMPCTESTS) && tsub_ui.exe && cd ..
414 $(TESTCOMPILE)tswap.c $(MIDTESTCOMPILE)tswap.exe $(ENDTESTCOMPILE)
415 cd $(DIRMPCTESTS) && tswap.exe && cd ..
416 $(TESTCOMPILE)ttan.c $(MIDTESTCOMPILE)ttan.exe $(ENDTESTCOMPILE)
417 cd $(DIRMPCTESTS) && ttan.exe && cd ..
418 $(TESTCOMPILE)ttanh.c $(MIDTESTCOMPILE)ttanh.exe $(ENDTESTCOMPILE)
419 cd $(DIRMPCTESTS) && ttanh.exe && cd ..
420 $(TESTCOMPILE)tui_div.c $(MIDTESTCOMPILE)tui_div.exe $(ENDTESTCOMPILE)
421 cd $(DIRMPCTESTS) && tui_div.exe && cd ..
422 $(TESTCOMPILE)tui_ui_sub.c $(MIDTESTCOMPILE)tui_ui_sub.exe $(ENDTESTCOMPILE)
423 cd $(DIRMPCTESTS) && tui_ui_sub.exe && cd ..
424 @echo --------------------------------------------------
425 @echo All tests passed
426 @echo --------------------------------------------------