This patch adds uninstall-hook targets so that make uninstall removes the 
extra links and stuff that we add as part of install-data-hook.  Directories 
are left alone -- I'm not sure if we can remove directories correctly because 
of the order that these makefiles get executed in.  SUBDIRS in 
usr/lib/pkcs11/Makefile.am will make the build go into api/ first, which is 
correct if we're doing make all, but the order needs to be reversed for make 
uninstall to work.

  Also, I removed the code that adds PKCS11_TPM.so links.  The other tokens 
that have these links were legacy tokens, in that they existed before we 
updated opencryptoki to comply with the FHS.  After that update, we did need 
these links for backward compat, but only for the tokens that existed before 
this point.  The TPM token is new since this update, so it shouldn't need this 
backwards compat link.

Thanks,
Kent

Signed-off-by: Kent Yoder <[email protected]>

diff --git a/usr/lib/Makefile.am b/usr/lib/Makefile.am
index 754668d..a809b9c 100644
--- a/usr/lib/Makefile.am
+++ b/usr/lib/Makefile.am
@@ -8,3 +8,5 @@ install-data-hook:
                $(DESTDIR)/etc/ld.so.conf.d/opencryptoki-$(target_cpu).conf
        echo "**** Remember you must run ldconfig before using the above 
settings ****"
 
+uninstall-hook:
+       rm -f $(DESTDIR)/etc/ld.so.conf.d/opencryptoki-$(target_cpu).conf
diff --git a/usr/lib/pkcs11/aep_stdll/Makefile.am 
b/usr/lib/pkcs11/aep_stdll/Makefile.am
index 98b4a2f..a65fda9 100644
--- a/usr/lib/pkcs11/aep_stdll/Makefile.am
+++ b/usr/lib/pkcs11/aep_stdll/Makefile.am
@@ -28,3 +28,8 @@ INCLUDES = -I/usr/include -I. -I../../../include/pkcs11/stdll 
\
 install-data-hook:
        cd $(DESTDIR)/$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_aep.so PKCS11_AEP.so
+
+uninstall-hook:
+       if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)/$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_AEP.so; fi
diff --git a/usr/lib/pkcs11/api/Makefile.am b/usr/lib/pkcs11/api/Makefile.am
index 0bb0e51..e428269 100644
--- a/usr/lib/pkcs11/api/Makefile.am
+++ b/usr/lib/pkcs11/api/Makefile.am
@@ -29,3 +29,15 @@ install-data-hook:
        $(MKDIR_P) $(DESTDIR)$(libdir)/opencryptoki/stdll
        cd $(DESTDIR)$(libdir)/pkcs11 && \
                ln -sf ../opencryptoki/stdll/ stdll
+
+uninstall-hook:
+       if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)$(libdir)/opencryptoki && \
+               rm -f PKCS11_API.so && \
+               rm -f methods; fi
+       if test -d $(DESTDIR)$(libdir)/pkcs11; then \
+               cd $(DESTDIR)$(libdir)/pkcs11 && \
+               rm -f methods && \
+               rm -f PKCS11_API.so && \
+               rm -f libopencryptoki.so && \
+               rm -f stdll; fi
diff --git a/usr/lib/pkcs11/bcom_stdll/Makefile.am 
b/usr/lib/pkcs11/bcom_stdll/Makefile.am
index 48295be..fe368ce 100644
--- a/usr/lib/pkcs11/bcom_stdll/Makefile.am
+++ b/usr/lib/pkcs11/bcom_stdll/Makefile.am
@@ -32,3 +32,8 @@ INCLUDES = $(BC_INC_DIRS) -I/usr/include                      
\
 install-data-hook:
        cd $(DESTDIR)/$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_bc.so PKCS11_BC.so
+
+uninstall-hook:
+       if test -d $(DESTDIR)/$(libdir)/opencryptoki/stdll; then
+               cd $(DESTDIR)/$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_BC.so; fi
diff --git a/usr/lib/pkcs11/cca_stdll/Makefile.am 
b/usr/lib/pkcs11/cca_stdll/Makefile.am
index f0b5a6a..4fc189e 100644
--- a/usr/lib/pkcs11/cca_stdll/Makefile.am
+++ b/usr/lib/pkcs11/cca_stdll/Makefile.am
@@ -54,4 +54,8 @@ noinst_HEADERS = h_extern.h tok_spec_struct.h defs.h 
csulincl.h               \
 install-data-hook:
        cd $(DESTDIR)/$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_cca.so PKCS11_CCA.so
-       $(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/ccatok
+
+uninstall-hook:
+       if test -d $(DESTDIR)/$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)/$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_CCA.so; fi
diff --git a/usr/lib/pkcs11/cr_stdll/Makefile.am 
b/usr/lib/pkcs11/cr_stdll/Makefile.am
index 2ee7a20..9658551 100644
--- a/usr/lib/pkcs11/cr_stdll/Makefile.am
+++ b/usr/lib/pkcs11/cr_stdll/Makefile.am
@@ -31,3 +31,8 @@ INCLUDES = $(CR_INC_DIRS) -I/usr/include                      
\
 install-data-hook:
        cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_cr.so PKCS11_CR.so
+
+uninstall-hook:
+       if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_CR.so; fi
diff --git a/usr/lib/pkcs11/ica_s390_stdll/Makefile.am 
b/usr/lib/pkcs11/ica_s390_stdll/Makefile.am
index b881e17..86e061e 100644
--- a/usr/lib/pkcs11/ica_s390_stdll/Makefile.am
+++ b/usr/lib/pkcs11/ica_s390_stdll/Makefile.am
@@ -29,4 +29,8 @@ INCLUDES = $(ICA_INC_DIRS) -I. 
-I../../../include/pkcs11/stdll        \
 install-data-hook:
        cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_ica.so PKCS11_ICA.so
-       $(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/lite
+
+uninstall-hook:
+       if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_ICA.so; fi
diff --git a/usr/lib/pkcs11/ica_stdll/Makefile.am 
b/usr/lib/pkcs11/ica_stdll/Makefile.am
index d5e60b5..2d0e0bb 100644
--- a/usr/lib/pkcs11/ica_stdll/Makefile.am
+++ b/usr/lib/pkcs11/ica_stdll/Makefile.am
@@ -33,3 +33,8 @@ INCLUDES = $(ICA_INC_DIRS) -I/usr/include                     
\
 install-data-hook:
        cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_ica.so PKCS11_ICA.so
+
+uninstall-hook:
+       if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_ICA.so; fi
diff --git a/usr/lib/pkcs11/leeds_stdll/Makefile.am 
b/usr/lib/pkcs11/leeds_stdll/Makefile.am
index e4b990c..c40e3a8 100644
--- a/usr/lib/pkcs11/leeds_stdll/Makefile.am
+++ b/usr/lib/pkcs11/leeds_stdll/Makefile.am
@@ -14,3 +14,8 @@ INCLUDES = $(SCC_INC_DIRS) -I/usr/include -I. 
-I../../../include/pkcs11/stdll \
 install-data-hook:
        cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_4758.so PKCS11_4758.so
+
+uninstall-hook:
+       if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_4758.so; fi
diff --git a/usr/lib/pkcs11/soft_stdll/Makefile.am 
b/usr/lib/pkcs11/soft_stdll/Makefile.am
index ea37e7e..8a1e7ca 100644
--- a/usr/lib/pkcs11/soft_stdll/Makefile.am
+++ b/usr/lib/pkcs11/soft_stdll/Makefile.am
@@ -50,4 +50,8 @@ opencryptoki_stdll_libpkcs11_sw_la_SOURCES = ../common/asn1.c 
        \
 install-data-hook:
        cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
                ln -sf libpkcs11_sw.so PKCS11_SW.so
-       $(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/swtok
+
+uninstall-hook:
+       if test -d $(DESTDIR)$(libdir)/opencryptoki/stdll; then \
+               cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
+               rm -f PKCS11_SW.so; fi
diff --git a/usr/lib/pkcs11/tpm_stdll/Makefile.am 
b/usr/lib/pkcs11/tpm_stdll/Makefile.am
index 023e959..c2420b8 100644
--- a/usr/lib/pkcs11/tpm_stdll/Makefile.am
+++ b/usr/lib/pkcs11/tpm_stdll/Makefile.am
@@ -52,8 +52,3 @@ opencryptoki_stdll_libpkcs11_tpm_la_SOURCES = 
../common/asn1.c           \
 
 noinst_HEADERS = h_extern.h tok_spec_struct.h defs.h   \
                 host_defs.h tpm_specific.h tok_specific.h
-
-install-data-hook:
-       cd $(DESTDIR)$(libdir)/opencryptoki/stdll && \
-               ln -sf libpkcs11_tpm.so PKCS11_TPM.so
-       $(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/opencryptoki/tpm

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to