1# 2# Copyright (c) 2017-2020, Intel Corporation 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are met: 6# 7# * Redistributions of source code must retain the above copyright notice, 8# this list of conditions and the following disclaimer. 9# * Redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution. 12# * Neither the name of Intel Corporation nor the names of its contributors 13# may be used to endorse or promote products derived from this software 14# without specific prior written permission. 15# 16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27 28TEST_APP = ipsec_MB_testapp 29XVALID_APP = ipsec_xvalid_test 30INSTNAME = intel-ipsec-mb 31 32!if !defined(PREFIX) 33PREFIX = C:\Program Files 34!endif 35 36!if exist("$(PREFIX)\$(INSTNAME)\libIPSec_MB.lib") 37IPSECLIB = "$(PREFIX)\$(INSTNAME)\libIPSec_MB.lib" 38INCDIR = -I"$(PREFIX)\$(INSTNAME)" 39!else 40!if !defined(LIB_DIR) 41LIB_DIR = ..\lib 42!endif 43IPSECLIB = "$(LIB_DIR)\libIPSec_MB.lib" 44INCDIR = -I$(LIB_DIR) -I.\ 45!endif 46 47!if !defined(DEBUG_OPT) 48DEBUG_OPT = /Od 49!endif 50 51!ifdef DEBUG 52DCFLAGS = $(DEBUG_OPT) /DDEBUG /Z7 53DLFLAGS = /debug 54!else 55DCFLAGS = /O2 /Oi 56DLFLAGS = 57!endif 58 59# compiler 60CC = cl 61# _CRT_SECURE_NO_WARNINGS disables warning C4996 about unsecure snprintf() being used 62CFLAGS = /nologo /DNO_COMPAT_IMB_API_053 /D_CRT_SECURE_NO_WARNINGS $(DCFLAGS) /Y- /W3 /WX- /Gm- /fp:precise /EHsc $(EXTRA_CFLAGS) $(INCDIR) 63 64#linker 65LNK = link 66TEST_LFLAGS = /out:$(TEST_APP).exe $(DLFLAGS) 67XVALID_LFLAGS = /out:$(XVALID_APP).exe $(DLFLAGS) 68 69AS = nasm 70AFLAGS = -fwin64 -Xvc -DWIN_ABI 71 72# dependency 73!ifndef DEPTOOL 74DEPTOOL = ..\mkdep.bat 75!endif 76DEPFLAGS = $(INCDIR) 77 78TEST_OBJS = main.obj gcm_test.obj ctr_test.obj customop_test.obj des_test.obj ccm_test.obj cmac_test.obj hmac_sha1_test.obj hmac_sha256_sha512_test.obj utils.obj hmac_md5_test.obj aes_test.obj sha_test.obj chained_test.obj api_test.obj pon_test.obj ecb_test.obj zuc_test.obj kasumi_test.obj snow3g_test.obj direct_api_test.obj clear_mem_test.obj hec_test.obj xcbc_test.obj aes_cbcs_test.obj crc_test.obj chacha_test.obj poly1305_test.obj chacha20_poly1305_test.obj null_test.obj 79 80XVALID_OBJS = ipsec_xvalid.obj misc.obj utils.obj 81 82all: $(TEST_APP).exe $(XVALID_APP).exe tests.dep 83 84$(TEST_APP).exe: $(TEST_OBJS) $(IPSECLIB) 85 $(LNK) $(TEST_LFLAGS) $(TEST_OBJS) $(IPSECLIB) 86 87$(XVALID_APP).exe: $(XVALID_OBJS) $(IPSECLIB) 88 $(LNK) $(XVALID_LFLAGS) $(XVALID_OBJS) $(IPSECLIB) 89 90tests.dep: $(TEST_OBJS) $(XVALID_OBJS) 91 @type *.obj.dep > $@ 2> nul 92 93.c.obj: 94 $(CC) /c $(CFLAGS) $< 95 $(DEPTOOL) $< $@ "$(DEPFLAGS)" > $@.dep 96 97.asm.obj: 98 $(AS) -MD $@.dep -o $@ $(AFLAGS) $< 99 100clean: 101 del /q $(TEST_OBJS) tests.dep *.obj.dep $(TEST_APP).* $(XVALID_OBJS) $(XVALID_APP).* 102 103!if exist(tests.dep) 104!include tests.dep 105!endif 106