From e7e4c799daba0e1783c817921cd94e11c30d16dd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 20 Jun 2004 14:18:28 +0000 Subject: [PATCH] Implement "make user_uninstall". Original patch contributed by Rudolf Marek. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2604 7894878c-1315-0410-8ee3-d5d059ff63e0 --- Makefile | 15 +++++++++++++++ kernel/include/Module.mk | 5 +++++ lib/Module.mk | 12 ++++++++++++ prog/detect/Module.mk | 7 +++++++ prog/dump/Module.mk | 7 +++++++ prog/eeprom/Module.mk | 4 ++++ prog/pwm/Module.mk | 4 ++++ prog/sensord/Module.mk | 7 +++++++ prog/sensors/Module.mk | 7 +++++++ prog/xeon/Module.mk | 4 ++++ 10 files changed, 72 insertions(+) diff --git a/Makefile b/Makefile index 32161896..8b32c8c9 100644 --- a/Makefile +++ b/Makefile @@ -153,10 +153,12 @@ MACHINE := $(shell uname -m) SRCDIRS := ifneq ($(MAKECMDGOALS),user) ifneq ($(MAKECMDGOALS),user_install) +ifneq ($(MAKECMDGOALS),user_uninstall) SRCDIRS += mkpatch SRCDIRS += kernel kernel/busses kernel/chips endif endif +endif SRCDIRS += kernel/include SRCDIRS += lib prog/detect prog/dump prog/eeprom prog/pwm \ prog/sensors prog/xeon ${PROG_EXTRA:%=prog/%} etc @@ -242,8 +244,14 @@ all:: INCLUDEFILES := include $(patsubst %,%/Module.mk,$(SRCDIRS)) ifneq ($(MAKECMDGOALS),clean) +ifneq ($(MAKECMDGOALS),uninstall) +ifneq ($(MAKECMDGOALS),user_uninstall) +ifneq ($(MAKECMDGOALS),help) include $(INCLUDEFILES) endif +endif +endif +endif # Man pages MANPAGES := $(LIBMAN3FILES) $(LIBMAN5FILES) $(PROGDETECTMAN8FILES) $(PROGDUMPMAN8FILES) \ @@ -283,6 +291,12 @@ endif clean:: $(RM) lm_sensors-* +user_uninstall:: + +uninstall :: user_uninstall + @echo "*** Note:" + @echo "*** * Kernel modules were not uninstalled." + # This is tricky, but it works like a charm. It needs lots of utilities # though: cut, find, gzip, ln, tail and tar. package: version clean @@ -311,6 +325,7 @@ help: @echo ' install: install modules and userspace programs' @echo ' user: build userspace programs' @echo ' user_install: install userspace programs' + @echo ' user_uninstall: remove userspace programs' @echo ' clean: cleanup' @echo ' package: create a distribution package' @echo 'Note: make dep is automatic' diff --git a/kernel/include/Module.mk b/kernel/include/Module.mk index a7e701c9..4c5ba338 100644 --- a/kernel/include/Module.mk +++ b/kernel/include/Module.mk @@ -36,6 +36,8 @@ $(KERNELINCLUDEDIR)/sensors.hd: # Get dependencies of sensors.h INCLUDEFILES += $(MODULE_DIR)/sensors.hd +REMOVEKERNELINC := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SYSINCLUDEDIR)/%,$(KERNELINCLUDEFILES)) + install-all-kernel-include: if [ -n "$(KERNELINCLUDEFILES)" ] ; then \ $(MKDIR) $(DESTDIR)$(SYSINCLUDEDIR) ; \ @@ -44,6 +46,9 @@ install-all-kernel-include: user_install :: install-all-kernel-include +user_uninstall:: + $(RM) $(REMOVEKERNELINC) + clean-all-kernel-include: $(RM) $(KERNELINCLUDEDIR)/*.h.install $(KERNELINCLUDEDIR)/sensors.h $(KERNELINCLUDEDIR)/sensors.hd diff --git a/lib/Module.mk b/lib/Module.mk index c0e4ab07..e331baee 100644 --- a/lib/Module.mk +++ b/lib/Module.mk @@ -92,6 +92,14 @@ $(MODULE_DIR)/conf-lex.ao: $(MODULE_DIR)/conf-lex.c $(MODULE_DIR)/conf-lex.lo: $(MODULE_DIR)/conf-lex.c $(CC) $(LIBCPPFLAGS) $(LIBCFLAGS) -Wno-unused -c $< -o $@ +REMOVELIBST := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBDIR)/%,$(LIB_DIR)/$(LIBSTLIBNAME)) +REMOVELIBSH := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBDIR)/%,$(LIB_DIR)/$(LIBSHLIBNAME)) +REMOVELNSO := $(DESTDIR)$(LIBDIR)/$(LIBSHSONAME) +REMOVELNBS := $(DESTDIR)$(LIBDIR)/$(LIBSHBASENAME) +REMOVELIBHF := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBINCLUDEDIR)/%,$(LIBHEADERFILES)) +REMOVEMAN3 := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBMAN3DIR)/%,$(LIBMAN3FILES)) +REMOVEMAN5 := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(LIBMAN5DIR)/%,$(LIBMAN5FILES)) + all-lib: $(LIBTARGETS) user :: all-lib @@ -140,6 +148,10 @@ install-lib: all-lib user_install :: install-lib +user_uninstall:: + $(RM) $(REMOVELIBST) $(REMOVELIBSH) $(REMOVELNSO) $(REMOVELNBS) + $(RM) $(REMOVELIBHF) $(REMOVEMAN3) $(REMOVEMAN5) + clean-lib: $(RM) $(LIB_DIR)/*.ld $(LIB_DIR)/*.ad $(RM) $(LIB_DIR)/*.lo $(LIB_DIR)/*.ao diff --git a/prog/detect/Module.mk b/prog/detect/Module.mk index 774ea2ef..c1f57ead 100644 --- a/prog/detect/Module.mk +++ b/prog/detect/Module.mk @@ -35,6 +35,9 @@ PROGDETECTSBININSTALL := $(MODULE_DIR)/sensors-detect \ # executables. INCLUDEFILES += $(PROGDETECTSOURCES:.c=.rd) +REMOVEDETECTBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SBINDIR)/%,$(PROGDETECTSBININSTALL)) +REMOVEDETECTMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGDETECTMAN8DIR)/%,$(PROGDETECTMAN8FILES)) + all-prog-detect: $(PROGDETECTTARGETS) user :: all-prog-detect @@ -47,6 +50,10 @@ install-prog-detect: all-prog-detect $(INSTALL) -m 644 $(PROGDETECTMAN8FILES) $(DESTDIR)$(PROGDETECTMAN8DIR) user_install :: install-prog-detect +user_uninstall:: + $(RM) $(REMOVEDETECTBIN) + $(RM) $(REMOVEDETECTMAN) + clean-prog-detect: $(RM) $(PROGDETECTDIR)/*.rd $(PROGDETECTDIR)/*.ro $(PROGDETECTTARGETS) clean :: clean-prog-detect diff --git a/prog/dump/Module.mk b/prog/dump/Module.mk index 30c0694a..053ebcb4 100644 --- a/prog/dump/Module.mk +++ b/prog/dump/Module.mk @@ -43,6 +43,9 @@ endif # executables. INCLUDEFILES += $(PROGDUMPSOURCES:.c=.rd) +REMOVEDUMPBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SBINDIR)/%,$(PROGDUMPBININSTALL)) +REMOVEDUMPMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGDUMPMAN8DIR)/%,$(PROGDUMPMAN8FILES)) + all-prog-dump: $(PROGDUMPTARGETS) user :: all-prog-dump @@ -58,6 +61,10 @@ install-prog-dump: all-prog-dump $(INSTALL) -m 644 $(PROGDUMPMAN8FILES) $(DESTDIR)$(PROGDUMPMAN8DIR) user_install :: install-prog-dump +user_uninstall:: + $(RM) $(REMOVEDUMPBIN) + $(RM) $(REMOVEDUMPMAN) + clean-prog-dump: $(RM) $(PROGDUMPDIR)/*.rd $(PROGDUMPDIR)/*.ro $(PROGDUMPTARGETS) clean :: clean-prog-dump diff --git a/prog/eeprom/Module.mk b/prog/eeprom/Module.mk index 954a1a49..a1225969 100644 --- a/prog/eeprom/Module.mk +++ b/prog/eeprom/Module.mk @@ -22,9 +22,13 @@ PROGEEPROMTARGETS := $(MODULE_DIR)/decode-dimms.pl \ $(MODULE_DIR)/decode-edid.pl \ $(MODULE_DIR)/decode-vaio.pl +REMOVEEEPROMBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGEEPROMTARGETS)) + install-prog-eeprom: $(PROGEEPROMTARGETS) $(MKDIR) $(DESTDIR)$(BINDIR) $(INSTALL) -m 755 $(PROGEEPROMTARGETS) $(DESTDIR)$(BINDIR) user_install :: install-prog-eeprom +user_uninstall:: + $(RM) $(REMOVEEEPROMBIN) diff --git a/prog/pwm/Module.mk b/prog/pwm/Module.mk index 8ee210bf..d1c88cb3 100644 --- a/prog/pwm/Module.mk +++ b/prog/pwm/Module.mk @@ -22,9 +22,13 @@ PROGPWMTARGETS := $(MODULE_DIR)/fancontrol \ $(MODULE_DIR)/fancontrol.pl \ $(MODULE_DIR)/pwmconfig +REMOVEPWMBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SBINDIR)/%,$(PROGPWMTARGETS)) + install-prog-pwm: $(PROGPWMTARGETS) $(MKDIR) $(DESTDIR)$(SBINDIR) $(INSTALL) -m 755 $(PROGPWMTARGETS) $(DESTDIR)$(SBINDIR) user_install :: install-prog-pwm +user_uninstall:: + $(RM) $(REMOVEPWMBIN) diff --git a/prog/sensord/Module.mk b/prog/sensord/Module.mk index f3b17308..e744858e 100644 --- a/prog/sensord/Module.mk +++ b/prog/sensord/Module.mk @@ -37,6 +37,9 @@ PROGSENSORDSOURCES := $(MODULE_DIR)/args.c $(MODULE_DIR)/chips.c $(MODULE_DIR)/l # executables. INCLUDEFILES += $(PROGSENSORDSOURCES:.c=.rd) +REMOVESENSORDBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SBINDIR)/%,$(PROGSENSORDTARGETS)) +REMOVESENSORDMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORDMAN8DIR)/%,$(PROGSENSORDMAN8FILES)) + $(PROGSENSORDTARGETS): $(PROGSENSORDSOURCES:.c=.ro) lib/$(LIBSHBASENAME) $(CC) $(EXLDFLAGS) -o $@ $(PROGSENSORDSOURCES:.c=.ro) -Llib -lsensors -lrrd @@ -49,6 +52,10 @@ install-prog-sensord: all-prog-sensord $(INSTALL) -m 644 $(PROGSENSORDMAN8FILES) $(DESTDIR)$(PROGSENSORDMAN8DIR) user_install :: install-prog-sensord +user_uninstall:: + $(RM) $(REMOVESENSORDBIN) + $(RM) $(REMOVESENSORDMAN) + clean-prog-sensord: $(RM) $(PROGSENSORDDIR)/*.rd $(PROGSENSORDDIR)/*.ro $(RM) $(PROGSENSORDTARGETS) diff --git a/prog/sensors/Module.mk b/prog/sensors/Module.mk index 7bb32fcc..6a117625 100644 --- a/prog/sensors/Module.mk +++ b/prog/sensors/Module.mk @@ -33,6 +33,9 @@ PROGSENSORSSOURCES := $(MODULE_DIR)/main.c $(MODULE_DIR)/chips.c # executables. INCLUDEFILES += $(PROGSENSORSSOURCES:.c=.rd) +REMOVESENSORSBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGSENSORSTARGETS)) +REMOVESENSORSMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORSMAN1DIR)/%,$(PROGSENSORSMAN1FILES)) + LIBICONV := $(shell if /sbin/ldconfig -p | grep -q libiconv\\.so ; then echo \-liconv; else echo; fi) $(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME) @@ -47,6 +50,10 @@ install-prog-sensors: all-prog-sensors $(INSTALL) -m 644 $(PROGSENSORSMAN1FILES) $(DESTDIR)$(PROGSENSORSMAN1DIR) user_install :: install-prog-sensors +user_uninstall:: + $(RM) $(REMOVESENSORSBIN) + $(RM) $(REMOVESENSORSMAN) + clean-prog-sensors: $(RM) $(PROGSENSORSDIR)/*.rd $(PROGSENSORSDIR)/*.ro $(RM) $(PROGSENSORSTARGETS) diff --git a/prog/xeon/Module.mk b/prog/xeon/Module.mk index 2f66aecc..b356f95d 100644 --- a/prog/xeon/Module.mk +++ b/prog/xeon/Module.mk @@ -20,9 +20,13 @@ PROGXEONDIR := $(MODULE_DIR) PROGXEONTARGETS := $(MODULE_DIR)/decode-xeon.pl +REMOVEXEONBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGXEONTARGETS)) + install-prog-xeon: $(PROGXEONTARGETS) $(MKDIR) $(DESTDIR)$(BINDIR) $(INSTALL) -m 755 $(PROGXEONTARGETS) $(DESTDIR)$(BINDIR) user_install :: install-prog-xeon +user_uninstall:: + $(RM) $(REMOVEXEONBIN)