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