Skip to contentSkip to conversation

New helper tool: hwmon-dev

PATCH In review Jean Delvare 1 participant 1 message May 9, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 New helper tool: hwmon-dev

This tool is a hwmon device name resolution helper. It can tell which libsensors chip name corresponds to which kernel hwmon class device.

---
 Makefile                   |    2 
 prog/hwmon-dev/Module.mk   |   58 +++++++++++
 prog/hwmon-dev/hwmon-dev.1 |   63 ++++++++++++
 prog/hwmon-dev/hwmon-dev.c |  229 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 351 insertions(+), 1 deletion(-)
prog/hwmon-dev/Module.mk new file +58 -0
@@ -0,0 +1,58 @@
+#  Copyright (C) 2014  Jean Delvare <[email protected]>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+#  MA 02110-1301 USA.
+
+# Note that MODULE_DIR (the directory in which this file resides) is a
+# 'simply expanded variable'. That means that its value is substituted
+# verbatim in the rules, until it is redefined.
+MODULE_DIR := prog/hwmon-dev
+PROGHWMONDEVDIR := $(MODULE_DIR)
+
+PROGHWMONDEVMAN1DIR := $(MANDIR)/man1
+PROGHWMONDEVMAN1FILES := $(MODULE_DIR)/hwmon-dev.1
+
+# Regrettably, even 'simply expanded variables' will not put their currently
+# defined value verbatim into the command-list of rules...
+PROGHWMONDEVTARGETS := $(MODULE_DIR)/hwmon-dev
+PROGHWMONDEVSOURCES := $(MODULE_DIR)/hwmon-dev.c
+
+# Include all dependency files. We use '.rd' to indicate this will create
+# executables.
+INCLUDEFILES += $(PROGHWMONDEVSOURCES:.c=.rd)
+
+REMOVEHWMONDEVBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(BINDIR)/%,$(PROGHWMONDEVTARGETS))
+REMOVEHWMONDEVMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGHWMONDEVMAN1DIR)/%,$(PROGHWMONDEVMAN1FILES))
+
+$(PROGHWMONDEVTARGETS): $(PROGHWMONDEVSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
+	$(CC) $(EXLDFLAGS) -o $@ $(PROGHWMONDEVSOURCES:.c=.ro) -Llib -lsensors
+
+all-prog-hwmondev: $(PROGHWMONDEVTARGETS)
+user :: all-prog-hwmondev
+
+install-prog-hwmondev: all-prog-hwmondev
+	$(MKDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(PROGHWMONDEVMAN1DIR)
+	$(INSTALL) -m 755 $(PROGHWMONDEVTARGETS) $(DESTDIR)$(BINDIR)
+	$(INSTALL) -m 644 $(PROGHWMONDEVMAN1FILES) $(DESTDIR)$(PROGHWMONDEVMAN1DIR)
+user_install :: install-prog-hwmondev
+
+user_uninstall::
+	$(RM) $(REMOVEHWMONDEVBIN)
+	$(RM) $(REMOVEHWMONDEVMAN)
+
+clean-prog-hwmondev:
+	$(RM) $(PROGHWMONDEVDIR)/*.rd $(PROGHWMONDEVDIR)/*.ro
+	$(RM) $(PROGHWMONDEVTARGETS)
+clean :: clean-prog-hwmondev
prog/hwmon-dev/hwmon-dev.c new file +229 -0

229 lines not on this page · raw message

Makefile +1 -1
@@ -106,7 +106,7 @@ BUILD_STATIC_LIB := 1
 # to do this. 
 
 # The subdirectories we need to build things in 
-SRCDIRS := lib prog/detect prog/pwm \
+SRCDIRS := lib prog/detect prog/hwmon-dev prog/pwm \
            prog/sensors ${PROG_EXTRA:%=prog/%} etc
 # Only build isadump and isaset on x86 machines.
 ifneq (,$(findstring $(MACHINE), i386 i486 i586 i686 x86_64))
prog/hwmon-dev/hwmon-dev.1 new file +63 -0

63 lines not on this page · raw message

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors