1thisconfigdir=..$(S).. 2myfulldir=ccapi$(S)test 3mydir=ccapi$(S)test 4BUILDTOP=..$(S).. 5CCAPI=$(BUILDTOP)$(S)CCAPI 6 7!if defined(KRB5_KFW_COMPILE) 8KFWINC= /I$(BUILDTOP)\..\..\krbcc\include 9!endif 10 11# Because all the sources are in ., 12# the only includes we need are to directories outside of ccapi. 13LOCALINCLUDES = /I$(BUILDTOP) /I$(BUILDTOP)$(S)include /I$(BUILDTOP)$(S)include$(S)krb5 $(KFWINC) \ 14 -I$(BUILDTOP)$(S)util$(S)et /I. -I$(CCAPI)$(S)COMMON -I$(CCAPI)$(S)LIB 15 16# run with "make all" to create CCAPI tests in "/tmp/ccapi_test" 17# run resulting tests with "sh test_ccapi.sh" 18 19##DOS##CPPFLAGS = $(CPPFLAGS) /EHsc -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 \ 20##DOS## -D_WIN32_WINNT=0x0501 -D_CRT_SECURE_NO_WARNINGS 21 22##DOS##WINH = cci_debugging.h \ 23##DOS## ccs_reply.h \ 24##DOS## ccs_request.h \ 25##DOS## ccs_request_c.c \ 26##DOS## cci_stream.h \ 27##DOS## cci_types.h \ 28##DOS## win-utils.h 29 30##DOS##LIBSRC=ccapi_ccache.c \ 31##DOS## ccapi_ccache_iterator.c \ 32##DOS## ccapi_context.c \ 33##DOS## ccapi_context_change_time.c \ 34##DOS## ccapi_ipc.c \ 35##DOS## ccapi_credentials.c \ 36##DOS## ccapi_credentials_iterator.c \ 37##DOS## ccapi_string.c \ 38##DOS## ccapi_v2.c 39 40##DOS##COMSRC=cci_cred_union.c \ 41##DOS## cci_identifier.c \ 42##DOS## cci_message.c \ 43##DOS## cci_stream.c 44 45##DOS##COWSRC=cci_os_identifier.c 46 47SRCDIR = . 48DSTROOT = $(SRCDIR) 49OBJDIR = $(DSTROOT)$(S)ccapi_intermediates 50DSTDIR = $(DSTROOT)$(S)ccapi_test 51TESTDIR = $(DSTDIR)$(S)tests 52SRCTMP = $(SRCDIR)\srctmp 53 54SCRIPT_NAME = test_ccapi.sh 55 56OBJECTS = $(OUTPRE)test_ccapi_ccache.$(OBJEXT) \ 57 $(OUTPRE)test_ccapi_check.$(OBJEXT) \ 58 $(OUTPRE)test_ccapi_constants.$(OBJEXT) \ 59 $(OUTPRE)test_ccapi_context.$(OBJEXT) \ 60 $(OUTPRE)test_ccapi_v2.$(OBJEXT) \ 61 $(OUTPRE)test_ccapi_globals.$(OBJEXT) \ 62 $(OUTPRE)test_ccapi_iterators.$(OBJEXT) \ 63 $(OUTPRE)test_ccapi_log.$(OBJEXT) \ 64 $(OUTPRE)test_ccapi_util.$(OBJEXT) 65 66PINGOBJS = $(OUTPRE)ccapi_ccache.$(OBJEXT) \ 67 $(OUTPRE)ccapi_ccache_iterator.$(OBJEXT) \ 68 $(OUTPRE)ccapi_context.$(OBJEXT) \ 69 $(OUTPRE)ccapi_context_change_time.$(OBJEXT) \ 70 $(OUTPRE)ccapi_ipc.$(OBJEXT) \ 71 $(OUTPRE)ccapi_credentials.$(OBJEXT) \ 72 $(OUTPRE)ccapi_credentials_iterator.$(OBJEXT) \ 73 $(OUTPRE)ccapi_string.$(OBJEXT) \ 74 $(OUTPRE)ccapi_v2.$(OBJEXT) \ 75 $(OUTPRE)cci_cred_union.$(OBJEXT) \ 76 $(OUTPRE)cci_identifier.$(OBJEXT) \ 77 $(OUTPRE)cci_os_identifier.$(OBJEXT) \ 78 $(OUTPRE)cci_message.$(OBJEXT) \ 79 $(OUTPRE)cci_stream.$(OBJEXT) \ 80 $(OUTPRE)ccs_request_c.$(OBJEXT) \ 81 $(OUTPRE)pingtest.$(OBJEXT) \ 82 $(OBJECTS) 83 84TESTALLOBJS=$(OUTPRE)main.$(OBJEXT) \ 85 $(OBJECTS) 86 87TEST_NAMES = test_cc_ccache_iterator_next \ 88 test_constants \ 89 test_cc_initialize \ 90 test_cc_credentials_iterator_next 91 92MORE_TESTS = test_cc_context_release \ 93 test_cc_context_get_change_time \ 94 test_cc_context_get_default_ccache_name \ 95 test_cc_context_open_ccache \ 96 test_cc_context_open_default_ccache \ 97 test_cc_context_create_ccache \ 98 test_cc_context_create_default_ccache \ 99 test_cc_context_create_new_ccache \ 100 test_cc_context_new_ccache_iterator \ 101 test_cc_context_compare \ 102 test_cc_ccache_release \ 103 test_cc_ccache_destroy \ 104 test_cc_ccache_set_default \ 105 test_cc_ccache_get_credentials_version \ 106 test_cc_ccache_get_name \ 107 test_cc_ccache_get_principal \ 108 test_cc_ccache_set_principal \ 109 test_cc_ccache_store_credentials \ 110 test_cc_ccache_remove_credentials \ 111 test_cc_ccache_new_credentials_iterator \ 112 test_cc_ccache_get_change_time \ 113 test_cc_ccache_get_last_default_time \ 114 test_cc_ccache_move \ 115 test_cc_ccache_compare \ 116 test_cc_ccache_get_kdc_time_offset \ 117 test_cc_ccache_set_kdc_time_offset \ 118 test_cc_ccache_clear_kdc_time_offset \ 119 test_cc_shutdown \ 120 test_cc_get_change_time \ 121 test_cc_open \ 122 test_cc_create \ 123 test_cc_close \ 124 test_cc_destroy \ 125 test_cc_get_cred_version \ 126 test_cc_get_name \ 127 test_cc_get_principal \ 128 test_cc_set_principal \ 129 test_cc_store \ 130 test_cc_remove_cred \ 131 test_cc_seq_fetch_NCs_begin \ 132 test_cc_seq_fetch_NCs_next \ 133 test_cc_seq_fetch_creds_begin \ 134 test_cc_seq_fetch_creds_next \ 135 test_cc_get_NC_info 136 137 138##### Linker 139LINK = link 140LIBS = -lkrb5 141##DOS##LIBS = advapi32.lib rpcrt4.lib user32.lib ws2_32.lib ccapi.lib 142LFLAGS = /nologo $(LOPTS) 143 144all-mac:: setup-test-dir pingtest simple_lock_test build-base build-tests link-tests copy-script success-message 145all-windows:: setup-windows build-base $(OUTPRE)pingtest.exe build-tests build-testall copy-script success-message 146 147# compile base files used by all tests 148build-base: $(PINGOBJS) 149 150##++ These two rules build each element of the list: 151# compile each test 152build-tests: $(TEST_NAMES) 153 @echo build-tests complete. 154 155$(TEST_NAMES): 156 @echo DBG: $@ 157 $(CC) $(ALL_CFLAGS) -Fe$(TESTDIR)$(S)$@.exe -Fd$(OBJDIR)$(S)$@.obj $@.c $(OBJECTS) $(LIBS) 158# Clean .obj from .: 159 $(RM) $@.$(OBJEXT) 160##-- These two rules build each element of the list. 161 162# Make a build directory 163setup-test-dir: 164 @echo "Removing old destination directory... $(DSTDIR)" 165 if [ -d "$(DSTDIR)" ]; then chmod -R u+w "$(DSTDIR)" && rm -rf "$(DSTDIR)"; fi 166 mkdir -p "$(TESTDIR)" 167 if [ -d "$(OBJDIR)" ]; then chmod -R u+w "$(OBJDIR)" && rm -rf "$(OBJDIR)"; fi 168 mkdir -p "$(OBJDIR)" 169 170## The same trick as used in TEST_NAMES to run an action on each element ofthe list WINH: 171setup-windows: $(WINH) $(LIBSRC) $(COMSRC) $(COWSRC) 172 if NOT exist $(TESTDIR) mkdir $(TESTDIR) 173 if NOT exist $(OBJDIR) mkdir $(OBJDIR) 174 set LINK = link 175 176# This rule assumes that nmake in ..\lib\win has already run. 177# That is how ..\Makefile.in is set up. 178$(WINH): 179 copy ..\lib\win\srctmp\$@ . 180 181$(LIBSRC): 182 copy ..\lib\$@ . 183 184$(COMSRC): 185 copy ..\common\$@ . 186 187$(COWSRC): 188 copy ..\common\win\$@ . 189 190# This rule assumes that nmake in ..\lib\win\ has already run. 191$(OUTPRE)pingtest.exe: $(OBJECTS) $(PINGOBJS) 192# There doesn't appear to be any way to examine a variable and return a value 193# indicating whether a string is present in it. We use a perl script to 194# check the LIB variable. If the path to ccapi.lib isn't present, the script 195# deletes a.tmp and the following nmake actions correct LIB. 196 echo %%PATH%% > a.tmp 197 perl setlib.pl 198 if not exist a.tmp ( 199 @echo Adding ..\lib\win\srctmp to LIB 200 set LIB=%%LIB%%;..\lib\win\srctmp 201 ) 202 $(LINK) $(linkdebug) /map:$(@B)1.map -out:$(*B)1.exe $(conflags) $(PINGOBJS) $(LIBS) 203 $(LINK) $(LFLAGS) /map:$(@B)2.map /out:$(*B)2.exe $(conflags) $(PINGOBJS) $(LIBS) $(conlibsdll) 204 205link-tests: $(TEST_NAMES) 206 207build-testall: $(TEST_NAMES) $(OBJECTS) $(TESTALLOBJS) testall.exe 208 209testall.exe: 210 $(LINK) $(linkdebug) /map:$(@B)1.map -out:$(*B)1.exe $(conflags) $(TESTALLOBJS) $(LIBS) $(conslibdll) 211 212 213simple_lock_test: 214 $(CC) -o $(TESTDIR)/simple_lock_test simple_lock_test.c $(LIBS) 215 216copy-script: 217 echo Copy script ... 218 cd 219 dir ccapi_test 220 cp $(SCRIPT_NAME) $(DSTDIR)$(S)$(SCRIPT_NAME) 221 222success-message: 223 @echo 224 @echo "CCAPI tests created in $(DSTDIR)" 225 226.PHONY: clean 227 228clean:: 229 -rm -rf "$(OBJDIR)" 230