--- /dev/null
+CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE) -DUSE_KADM5_API_VERSION=1
+
+all:: init-test destroy-test client-handle-test client-iter-test
+all:: randkey-test server-handle-test lock-test server-iter-test sizes-test
+
+#
+# The client-side test programs.
+#
+
+init-test: init-test.o client_init.o $(CLNTDEPLIPS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o init-test init-test.o client_init.o \
+ $(CLNTLIBS)
+
+client_init.o: $(SRCTOP)/lib/kadm5/clnt/client_init.c
+ $(CC) $(CFLAGS) -DUSE_KADM5_API_VERSION=2 -DINIT_TEST -c -I$(SRCTOP)/lib/kadm5 $<
+
+destroy-test: destroy-test.o $(CLNTDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o destroy-test destroy-test.o $(CLNTLIBS)
+
+client-handle-test: handle-test.o $(CLNTDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o client-handle-test handle-test.o \
+ $(CLNTLIBS)
+
+client-iter-test: iter-test.o $(CLNTDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o client-iter-test iter-test.o \
+ $(CLNTLIBS)
+
+#
+# The server-side test programs.
+#
+
+randkey-test: randkey-test.o $(SRVDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o randkey-test randkey-test.o $(SRVLIBS)
+
+server-handle-test: handle-test.o $(SRVDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o server-handle-test handle-test.o \
+ $(SRVLIBS)
+
+lock-test: lock-test.o $(SRVDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o lock-test lock-test.o $(SRVLIBS)
+
+server-iter-test: iter-test.o $(SRVDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o server-iter-test iter-test.o $(SRVLIBS)
+
+sizes-test: sizes-test.o $(SRVDEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o sizes-test sizes-test.o $(SRVLIBS)
+
+#
+# The unit-test targets
+#
+
+check unit-test:: unit-test-client unit-test-server
+
+unit-test-client: unit-test-client-setup unit-test-client-body \
+ unit-test-client-cleanup
+
+unit-test-server: unit-test-server-setup unit-test-server-body \
+ unit-test-server-cleanup
+
+test-randkey:: randkey-test
+ $(ENV_SETUP) ./randkey-test
+
+test-handle-server:: server-handle-test
+ $(ENV_SETUP) ./server-handle-test
+
+test-handle-client:: client-handle-test
+ $(ENV_SETUP) ./client-handle-test
+
+test-noauth: init-test
+ $(ENV_SETUP) ./init-test
+
+test-destroy: destroy-test
+ $(ENV_SETUP) ./destroy-test
+
+test-sizes: sizes-test
+ $(ENV_SETUP) ./sizes-test
+
+unit-test-client-setup::
+ $(ENV_SETUP) $(START_SERVERS)
+
+unit-test-client-cleanup::
+ $(ENV_SETUP) $(STOP_SERVERS)
+
+unit-test-server-setup::
+ $(ENV_SETUP) $(START_SERVERS_LOCAL)
+
+unit-test-server-cleanup::
+ $(ENV_SETUP) $(STOP_SERVERS_LOCAL)
+
+capi.0: api.0
+ -rm -f capi.0
+ ln -s api.0 capi.0
+
+capi.2: api.2
+ -rm -f capi.2
+ ln -s api.2 capi.2
+
+unit-test-client-body: capi.0 capi.2 site.exp test-noauth test-destroy test-handle-client test-sizes
+ $(ENV_SETUP) $(RUNTEST) --tool capi API=$(CLNTTCL) KINIT=$(BUILDTOP)/clients/kinit/kinit KDESTROY=$(BUILDTOP)/clients/kdestroy/kdestroy KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local RPC=1
+
+sapi.0: api.0
+ -rm -f sapi.0
+ ln -s api.0 sapi.0
+
+sapi.1: api.1
+ -rm -f sapi.1
+ ln -s api.1 sapi.1
+
+sapi.2: api.2
+ -rm -f sapi.2
+ ln -s api.2 sapi.2
+
+unit-test-server-body: sapi.0 sapi.1 sapi.2 site.exp randkey-test test-handle-server lock-test test-sizes
+ $(ENV_SETUP) $(RUNTEST) --tool sapi API=$(SRVTCL) LOCKTEST=./lock-test KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local RPC=0
+
+clean::
+ $(RM) init-test client_init.o init-test.o
+ $(RM) destroy-test destroy-test.o
+ $(RM) client-handle-test handle-test.o
+ $(RM) client-iter-test iter-test.o
+ $(RM) randkey-test randkey-test.o
+ $(RM) server-handle-test handle-test.o
+ $(RM) lock-test lock-test.o
+ $(RM) server-iter-test iter-test.o
+ $(RM) sizes-test sizes-test.o
+ $(RM) *.log *.plog *.sum *.psum unit-test-log.*