[Ffmpeg-devel] (UPDATE) ffmpeg uninstall patch

Richard richiek
Thu May 18 03:00:28 CEST 2006


Sorry for the run-around.
I pretty printed the Makefiles and also added a check to make sure
the directory $(incdir) existed before calling rmdir (something I
really should have done in the first place). Now if you "make
uninstall" twice in a row it won't cause a Makefile error.

RichieK.


-------------- next part --------------
--- ffmpeg.orig/common.mak	2006-05-16 15:59:48.000000000 +1000
+++ ffmpeg/common.mak	2006-05-17 12:09:43.000000000 +1000
@@ -64,14 +64,18 @@
 
 ifeq ($(BUILD_SHARED),yes)
 INSTLIBTARGETS += install-lib-shared
+UNINSTLIBTARGETS += uninstall-lib-shared
 endif
 ifeq ($(BUILD_STATIC),yes)
 INSTLIBTARGETS += install-lib-static
+UNINSTLIBTARGETS += uninstall-lib-static
 endif
 
 install: install-libs install-headers
+uninstall: uninstall-libs uninstall-headers
 
 install-libs: $(INSTLIBTARGETS)
+uninstall-libs: $(UNINSTLIBTARGETS)
 
 install-lib-shared: $(SLIBNAME)
 	install -d "$(libdir)"
@@ -86,16 +90,33 @@
 		$(libdir)/$(SLIBNAME)
 endif
 
+uninstall-lib-shared:
+ifeq ($(CONFIG_WIN32),yes)
+	rm -f $(prefix)/$(SLIBNAME)
+else
+	rm -f $(libdir)/$(SLIBNAME_WITH_MAJOR) \
+	      $(libdir)/$(SLIBNAME)            \
+	      $(libdir)/$(SLIBNAME_WITH_VERSION)
+endif
+
+
 install-lib-static: $(LIB)
 	install -d "$(libdir)"
 	install -m 644 $(LIB) "$(libdir)"
 
+uninstall-lib-static:
+	rm -f $(libdir)/$(LIB)
+
 install-headers:
 	install -d "$(incdir)"
 	install -d "$(libdir)/pkgconfig"
 	install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
 	install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
 
+uninstall-headers:
+	rm -f $(addprefix $(incdir)/,$(HEADERS))
+	rm -f $(libdir)/pkgconfig/lib$(NAME).pc
+
 #
 # include dependency files if they exist
 #
--- ffmpeg.orig/Makefile	2006-03-27 09:30:46.000000000 +1100
+++ ffmpeg/Makefile	2006-05-18 10:53:05.000000000 +1000
@@ -45,6 +45,7 @@
 ifeq ($(BUILD_VHOOK),yes)
 VHOOK=videohook
 INSTALLVHOOK=install-vhook
+UNINSTALLVHOOK=uninstall-vhook
 endif
 
 ifeq ($(TARGET_OS), SunOS)
@@ -64,8 +65,8 @@
 all: lib $(PROG_G) $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
 
 lib:
-	$(MAKE) -C libavutil all
-	$(MAKE) -C libavcodec all
+	$(MAKE) -C libavutil   all
+	$(MAKE) -C libavcodec  all
 	$(MAKE) -C libavformat all
 ifeq ($(CONFIG_PP),yes)
 	$(MAKE) -C libavcodec/libpostproc all
@@ -112,6 +113,7 @@
 .PHONY: install
 
 install: install-progs install-libs install-headers install-man $(INSTALLVHOOK)
+uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man $(UNINSTALLVHOOK)
 
 ifeq ($(BUILD_SHARED),yes)
 install-progs: $(PROG) install-libs
@@ -121,6 +123,9 @@
 	install -d "$(bindir)"
 	install -c $(INSTALLSTRIP) -m 755 $(PROG) "$(bindir)"
 
+uninstall-progs:
+	rm -f $(addprefix $(bindir)/, $(PROG))
+
 # create the window installer
 wininstaller: all install
 	makensis ffinstall.nsi
@@ -134,9 +139,17 @@
 	fi
 endif
 
+uninstall-man:
+ifneq ($(CONFIG_WIN32),yes)
+	rm -f $(addprefix $(mandir)/man1/,$(MANPAGE))
+endif
+
 install-vhook:
 	$(MAKE) -C vhook install
 
+uninstall-vhook:
+	$(MAKE) -C vhook uninstall
+
 install-libs:
 	$(MAKE) -C libavutil   install-libs
 	$(MAKE) -C libavcodec  install-libs
@@ -148,6 +161,14 @@
 	-$(LDCONFIG)
 endif
 
+uninstall-libs:
+	$(MAKE) -C libavutil   uninstall-libs
+	$(MAKE) -C libavcodec  uninstall-libs
+	$(MAKE) -C libavformat uninstall-libs
+ifeq ($(CONFIG_PP),yes)
+	$(MAKE) -C libavcodec/libpostproc uninstall-libs
+endif
+
 install-headers:
 	$(MAKE) -C libavutil   install-headers
 	$(MAKE) -C libavcodec  install-headers
@@ -156,10 +177,22 @@
 	$(MAKE) -C libavcodec/libpostproc install-headers
 endif
 
+uninstall-headers:
+	$(MAKE) -C libavutil   uninstall-headers
+	$(MAKE) -C libavcodec  uninstall-headers
+	$(MAKE) -C libavformat uninstall-headers
+ifeq ($(CONFIG_PP),yes)
+	$(MAKE) -C libavcodec/libpostproc uninstall-headers
+endif
+	if [ -d  $(incdir) ]; \
+	then                  \
+	  rmdir $(incdir);    \
+	fi
+
 dep:	depend
 
 depend: .depend
-	$(MAKE) -C libavcodec depend
+	$(MAKE) -C libavcodec  depend
 	$(MAKE) -C libavformat depend
 ifeq ($(BUILD_VHOOK),yes)
 	$(MAKE) -C vhook depend
@@ -173,8 +206,8 @@
 	@for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
 
 clean:
-	$(MAKE) -C libavutil clean
-	$(MAKE) -C libavcodec clean
+	$(MAKE) -C libavutil   clean
+	$(MAKE) -C libavcodec  clean
 	$(MAKE) -C libavformat clean
 	$(MAKE) -C libavcodec/libpostproc clean
 	$(MAKE) -C tests clean
--- ffmpeg.orig/vhook/Makefile	2006-03-27 09:31:40.000000000 +1100
+++ ffmpeg/vhook/Makefile	2006-05-17 13:59:10.000000000 +1000
@@ -30,6 +30,9 @@
 	install -d "$(libdir)/vhook"
 	install -m 755 $(HOOKS) "$(libdir)/vhook"
 
+uninstall:
+	rm -rf $(libdir)/vhook
+
 imlib2$(SLIBSUF): imlib2.o
 	$(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< -lImlib2
 



More information about the ffmpeg-devel mailing list