1## 2## Name: Makefile.msvc 3## Purpose: Makefile for IMath library and associated tools 4## for Microsoft Visual Studio 2005 5## Author: Matus Horvath <matus.horvath@nextra.sk> 6## 7## Copyright (C) 2006 Matus Horvath. Permission has been granted to use, 8## modify, and redistribute this file according to the terms of the IMath 9## license. 10## 11## Usage: nmake /f Makefile.msvc 12## 13 14# --- begin configuration section --- 15 16## Settings for Microsoft Windows systems using nmake. 17## To build with debugging, add DEBUG=Y on the "nmake" command line. 18CC=cl.exe 19LD=link.exe 20CFLAGS=$(CFLAGS) -nologo -I. -D_CRT_SECURE_NO_DEPRECATE $(DCFLAGS) 21LDFLAGS=$(LDFLAGS) -nologo $(DLDFLAGS) 22LIBS=$(DLIBS) 23 24!if "$(DEBUG)" == "Y" 25DCFLAGS=-ZI -Od -DDEBUG=1 -DTRACEABLE_FREE=1 26DLDFLAGS=-DEBUG 27#DLIBS=-lefence 28!else 29DCFLAGS=-O2 -Ob2 30DLDFLAGS= 31#DLIBS= 32!endif 33 34## Visual Studio C/C++ 2005 compiler supports "long long" 64-bit type. 35CFLAGS=$(CFLAGS) -DUSE_LONG_LONG 36 37# --- end of configuration section --- 38TARGETS=imtest.exe pi.exe bintest.exe findprime.exe 39HDRS=imath.h imrat.h iprime.h imdrover.h rsamath.h 40SRCS=$(HDRS:.h=.c) $(TARGETS:.exe=.c) 41OBJS=$(SRCS:.c=.obj) 42EXAMPLES=input.exe basecvt.exe rounding.exe 43 44.c.obj: 45 $(CC) $(CFLAGS) -c $< 46 47all: objs examples test 48 49objs: $(OBJS) 50 51# Because Visual Studio does not permit Unix shell syntax, you will 52# have to run the tests manually once the "test" target is built. 53test: imtest.exe pi.exe 54# @ echo "" 55# @ echo "Running tests, you should not see any 'FAILED' lines here." 56# @ echo "If you do, please see doc.txt for how to report a bug." 57# @ echo "" 58# (cd tests && ./test.sh) 59 60$(EXAMPLES): imath.obj imrat.obj iprime.obj examples/$*.obj 61 @move $*.obj examples/$*.obj 62 $(LD) $(LDFLAGS) -out:$@ $** $(LIBS) 63 64examples: $(EXAMPLES) 65 66imtest.exe: imtest.obj imath.obj imrat.obj imdrover.obj 67 $(LD) $(LDFLAGS) -out:$@ $** $(LIBS) 68 69pi.exe: pi.obj imath.obj 70 $(LD) $(LDFLAGS) -out:$@ $** $(LIBS) 71 72findprime.exe: findprime.obj imath.obj iprime.obj 73 $(LD) $(LDFLAGS) -out:$@ $** $(LIBS) 74 75rtest.exe: rtest.obj imath.obj rsamath.obj 76 $(LD) $(LDFLAGS) -out:$@ $** $(LIBS) 77 78bintest.exe: imath.obj bintest.obj 79 $(LD) $(LDFLAGS) -out:$@ $** $(LIBS) 80 81clean: 82 del /q /f *.exe *.obj examples\*.obj 83 84# End of Makefile.msvc 85