[PATCH] Fix 'make uninstall' target regarding some directories (cfe part)

Edoardo P. ed0.88.prez at gmail.com
Wed Dec 18 16:31:18 PST 2013


Hello, this is essentially a bump to the patch I posted in August:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130805/085392.html

It has a llvm equivalent patch, updated with new changes, which is already
posted in llvm-commits:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20131216/199257.html

Edward-san
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131219/66aef013/attachment.html>
-------------- next part --------------
diff --git a/include/clang-c/Makefile b/include/clang-c/Makefile
index b29e29e..49befb1 100644
--- a/include/clang-c/Makefile
+++ b/include/clang-c/Makefile
@@ -3,11 +3,9 @@ DIRS :=
 
 include $(CLANG_LEVEL)/Makefile
 
-IntIncludeDir = $(DESTDIR)$(PROJ_internal_prefix)/include
-
 install-local::
 	$(Echo) Installing Clang C API include files
-	$(Verb) $(MKDIR) $(IntIncludeDir)
+	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
 	$(Verb) if test -d "$(PROJ_SRC_DIR)" ; then \
 	  cd $(PROJ_SRC_DIR)/.. && \
 	  for  hdr in `find clang-c -type f '!' '(' -name '*~' \
@@ -36,3 +34,9 @@ ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
 	  done ; \
 	fi
 endif
+
+uninstall-local::
+	$(Echo) Uninstalling Clang C API include files
+	$(Verb) if test -d "$(DESTDIR)$(PROJ_includedir)/clang-c" ; then \
+	  $(RM) -rf $(DESTDIR)$(PROJ_includedir)/clang-c ; \
+	fi
diff --git a/include/clang/Makefile b/include/clang/Makefile
index 5f2077d..574ac48 100644
--- a/include/clang/Makefile
+++ b/include/clang/Makefile
@@ -42,3 +42,9 @@ ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
 	  done ; \
 	fi
 endif
+
+uninstall-local::
+	$(Echo) Uninstalling Clang include files
+	$(Verb) if test -d "$(DESTDIR)$(PROJ_includedir)/clang" ; then \
+	  $(RM) -rf $(DESTDIR)$(PROJ_includedir)/clang ; \
+	fi
diff --git a/runtime/compiler-rt/Makefile b/runtime/compiler-rt/Makefile
index 59a62e7..b6144dd 100644
--- a/runtime/compiler-rt/Makefile
+++ b/runtime/compiler-rt/Makefile
@@ -20,7 +20,8 @@ CLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \
 	$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc))
 
 ResourceDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/$(CLANG_VERSION)
-PROJ_resources := $(DESTDIR)$(PROJ_prefix)/lib/clang/$(CLANG_VERSION)
+PROJ_resources_root := $(DESTDIR)$(PROJ_prefix)/lib/clang
+PROJ_resources := $(PROJ_resources_root)/$(CLANG_VERSION)
 
 ResourceLibDir := $(ResourceDir)/lib
 PROJ_resources_lib := $(PROJ_resources)/lib
@@ -150,7 +151,10 @@ CleanRuntimeLibraries:
 	  clean
 .PHONY: CleanRuntimeLibraries
 
-$(PROJ_resources_lib):
+$(PROJ_resources_root):
+	$(Verb) $(MKDIR) $@
+
+$(PROJ_resources_lib): $(PROJ_resources_root)
 	$(Verb) $(MKDIR) $@
 
 # Expand rules for copying/installing each individual library. We can't use
@@ -213,6 +217,11 @@ $(foreach lib,$(RuntimeDirs), $(eval $(call RuntimeLibraryTemplate,$(lib))))
 all-local:: $(RuntimeDirs:%=RuntimeLibrary.%)
 install-local:: $(RuntimeDirs:%=RuntimeLibraryInstall.%)
 clean-local:: CleanRuntimeLibraries
+uninstall-local::
+	$(Echo) Uninstalling compiler runtime library
+	$(Verb) if test -d "$(PROJ_resources_root)" ; then \
+	  $(RM) -rf $(PROJ_resources_root) ; \
+	fi
 
 endif
 endif


More information about the cfe-commits mailing list