update makefile.msvc

This commit is contained in:
Karel Miko 2018-12-02 15:11:10 +01:00
parent 2c07579f7d
commit fc4b7f8008
1 changed files with 54 additions and 9 deletions

View File

@ -1,12 +1,26 @@
#MSVC Makefile
# MAKEFILE for MS Windows (nmake + Windows SDK)
#
#Tom St Denis
# BEWARE: variable OBJECTS is updated via ./updatemakes.sh
LTM_CFLAGS = /Ox /nologo /I. /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /W3 $(CFLAGS)
### USAGE:
# Open a command prompt with WinSDK variables set and start:
#
# nmake -f makefile.msvc all
# test.exe
# nmake -f makefile.msvc PREFIX=c:\devel\libtom install
default: library
#The following can be overridden from command line e.g. make -f makefile.msvc CC=gcc ARFLAGS=rcs
PREFIX = c:\devel
CFLAGS = /Ox
#START_INS
#Compilation flags
LTM_CFLAGS = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /W3 $(CFLAGS)
LTM_LDFLAGS = advapi32.lib
#Libraries to be created (this makefile builds only static libraries)
LIBMAIN_S =tommath.lib
#List of objects to compile (all goes to tommath.lib)
OBJECTS=bn_error.obj bn_fast_mp_invmod.obj bn_fast_mp_montgomery_reduce.obj bn_fast_s_mp_mul_digs.obj \
bn_fast_s_mp_mul_high_digs.obj bn_fast_s_mp_sqr.obj bn_mp_2expt.obj bn_mp_abs.obj bn_mp_add.obj bn_mp_add_d.obj \
bn_mp_addmod.obj bn_mp_and.obj bn_mp_clamp.obj bn_mp_clear.obj bn_mp_clear_multi.obj bn_mp_cmp.obj bn_mp_cmp_d.obj \
@ -33,12 +47,43 @@ bn_mp_to_unsigned_bin_n.obj bn_mp_toom_mul.obj bn_mp_toom_sqr.obj bn_mp_toradix.
bn_mp_unsigned_bin_size.obj bn_mp_xor.obj bn_mp_zero.obj bn_prime_tab.obj bn_reverse.obj bn_s_mp_add.obj \
bn_s_mp_exptmod.obj bn_s_mp_mul_digs.obj bn_s_mp_mul_high_digs.obj bn_s_mp_sqr.obj bn_s_mp_sub.obj bncore.obj
#END_INS
HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h
HEADERS=tommath.h tommath_class.h tommath_private.h tommath_superclass.h
HEADERS=tommath_private.h $(HEADERS_PUB)
library: $(OBJECTS)
lib /out:tommath.lib $(OBJECTS)
#The default rule for make builds the tommath.lib library (static)
default: $(LIBMAIN_S)
#Dependencies on *.h
$(OBJECTS): $(HEADERS)
.c.obj:
$(CC) $(LTM_CFLAGS) /c $< /Fo$@
#Create tomcrypt.lib
$(LIBMAIN_S): $(OBJECTS)
lib /out:$(LIBMAIN_S) $(OBJECTS)
#Build test suite
test.exe: $(LIBMAIN_S) demo/demo.c
cl $(LTM_CFLAGS) $(TOBJECTS) $(LIBMAIN_S) $(LTM_LDFLAGS) demo/demo.c /DLTM_DEMO_TEST_VS_MTEST=0 /Fe$@
@echo NOTICE: start the tests by launching test.exe
all: $(LIBMAIN_S) test.exe
test: test.exe
clean:
@-cmd /c del /Q /S *.OBJ *.LIB *.EXE *.DLL 2>nul
#Install the library + headers
install: $(LIBMAIN_S)
cmd /c if not exist "$(PREFIX)\bin" mkdir "$(PREFIX)\bin"
cmd /c if not exist "$(PREFIX)\lib" mkdir "$(PREFIX)\lib"
cmd /c if not exist "$(PREFIX)\include" mkdir "$(PREFIX)\include"
copy /Y $(LIBMAIN_S) "$(PREFIX)\lib"
copy /Y tommath*.h "$(PREFIX)\include"
# ref: $Format:%D$
# git commit: $Format:%H$
# commit time: $Format:%ai$