Skip to contentSkip to conversation

tools/thermal/tmon: simplify Makefile and fix cross build

PATCH RESEND In review Rolf Eike Beer 4 participants 8 messages Jul 30, 2021 – Sep 9, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 tools/thermal/tmon: simplify Makefile and fix cross build

Hi,

cross-building tmon can fail because it uses the non-prefixed, i.e. host, pkg- config.

If you prefer a merge the code is also available at:

https://github.com/emlix/linux thermal-makefile

Would be nice if someone could finally pick this up, it's almost 3 years now…

If someone knows anyone who better fits into these reviews please add CC's, sadly tools/thermal/ is not covered in MAINTAINERS.

Eike

Signature · 7 lines
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source
#1 lore raw

PATCH 1/2 tools/thermal: tmon: simplify Makefile

---
 tools/thermal/tmon/Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tools/thermal/tmon/Makefile +2 -6
index 9db867df76794..3e650878ea824 100644
@@ -13,7 +13,6 @@ CC?= $(CROSS_COMPILE)gcc
 PKG_CONFIG?= pkg-config
 
 override CFLAGS+=-D VERSION=\"$(VERSION)\"
-LDFLAGS+=
 TARGET=tmon
 
 INSTALL_PROGRAM=install -m 755 -p
@@ -33,7 +32,6 @@ override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /
 		     $(PKG_CONFIG) --cflags $(STATIC) panel ncurses 2> /dev/null)
 
 OBJS = tmon.o tui.o sysfs.o pid.o
-OBJS +=
 
 tmon: $(OBJS) Makefile tmon.h
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS)  -o $(TARGET) $(TMON_LIBS)
@@ -42,15 +40,13 @@ valgrind: tmon
 	 sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET)  1> /dev/null
 
 install:
-	- mkdir -p $(INSTALL_ROOT)/$(BINDIR)
-	- $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
+	- $(INSTALL_PROGRAM) -D "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
 
 uninstall:
 	$(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
 
 clean:
-	find . -name "*.o" | xargs $(DEL_FILE)
-	rm -f $(TARGET)
+	rm -f $(TARGET) $(OBJS)
 
 dist:
 	git tag v$(VERSION)
Signature · 10 lines
2.32.0

-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source
#2 lore raw

[thermal: thermal/next] thermal/tools/tmon: Improve the Makefile

The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     99d88c30055376b56316d3c431c9873e88208348
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//99d88c30055376b56316d3c431c9873e88208348
Author:        Rolf Eike Beer <[email protected]>
AuthorDate:    Fri, 30 Jul 2021 13:49:04 +02:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Sat, 14 Aug 2021 15:30:11 +02:00

thermal/tools/tmon: Improve the Makefile

- Remove empty macros assignments
- Use directory creation parameter for the install tool
- Use $OBJ instead of building the list of object for the 'clean' target

[dlezcano] : Changed title and description

---
 tools/thermal/tmon/Makefile | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tools/thermal/tmon/Makefile +2 -6
index 9db867d..3e65087 100644
@@ -13,7 +13,6 @@ CC?= $(CROSS_COMPILE)gcc
 PKG_CONFIG?= pkg-config
 
 override CFLAGS+=-D VERSION=\"$(VERSION)\"
-LDFLAGS+=
 TARGET=tmon
 
 INSTALL_PROGRAM=install -m 755 -p
@@ -33,7 +32,6 @@ override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /
 		     $(PKG_CONFIG) --cflags $(STATIC) panel ncurses 2> /dev/null)
 
 OBJS = tmon.o tui.o sysfs.o pid.o
-OBJS +=
 
 tmon: $(OBJS) Makefile tmon.h
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS)  -o $(TARGET) $(TMON_LIBS)
@@ -42,15 +40,13 @@ valgrind: tmon
 	 sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET)  1> /dev/null
 
 install:
-	- mkdir -p $(INSTALL_ROOT)/$(BINDIR)
-	- $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
+	- $(INSTALL_PROGRAM) -D "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
 
 uninstall:
 	$(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
 
 clean:
-	find . -name "*.o" | xargs $(DEL_FILE)
-	rm -f $(TARGET)
+	rm -f $(TARGET) $(OBJS)
 
 dist:
 	git tag v$(VERSION)
#3 lore raw

PATCH 2/2 tools/thermal: tmon: default to prefixed pkg-config when crosscompiling

In reply to Rolf Eike Beer

This matches what other parts of the tools/ directory already do.

---
 tools/thermal/tmon/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/thermal/tmon/Makefile +1 -1
index 3e650878ea824..f9c52b7fab7bc 100644
@@ -10,7 +10,7 @@ override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS}
 # Add "-fstack-protector" only if toolchain supports it.
 override CFLAGS+= $(call cc-option,-fstack-protector-strong)
 CC?= $(CROSS_COMPILE)gcc
-PKG_CONFIG?= pkg-config
+PKG_CONFIG?= $(CROSS_COMPILE)pkg-config
 
 override CFLAGS+=-D VERSION=\"$(VERSION)\"
 TARGET=tmon
Signature · 10 lines
2.32.0

-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source
#4 lore raw

[thermal: thermal/next] tools/thermal/tmon: Add cross compiling support

The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     b5f7912bb604b47a0fe024560488a7556dce8ee7
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//b5f7912bb604b47a0fe024560488a7556dce8ee7
Author:        Rolf Eike Beer <[email protected]>
AuthorDate:    Fri, 30 Jul 2021 13:51:54 +02:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Sat, 14 Aug 2021 15:33:19 +02:00

tools/thermal/tmon: Add cross compiling support

Default to prefixed pkg-config when crosscompiling, this matches what other parts of the tools/ directory already do.

[dlezcano] : Reworked description

---
 tools/thermal/tmon/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/thermal/tmon/Makefile +1 -1
index 3e65087..f9c52b7 100644
@@ -10,7 +10,7 @@ override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS}
 # Add "-fstack-protector" only if toolchain supports it.
 override CFLAGS+= $(call cc-option,-fstack-protector-strong)
 CC?= $(CROSS_COMPILE)gcc
-PKG_CONFIG?= pkg-config
+PKG_CONFIG?= $(CROSS_COMPILE)pkg-config
 
 override CFLAGS+=-D VERSION=\"$(VERSION)\"
 TARGET=tmon
#5 lore raw

PATCH 1/1 MAINTAINERS: Add missing userspace thermal tools to the thermal section

In reply to Rolf Eike Beer

Patches related to the tmon which is in tools/thermal are floating around since years because it is unclear who takes care of it.

Add the missing userspace tools directory related to thermal to fix the situation.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index a61f4f3b78a9..a78f490fd128 100644
@@ -18358,6 +18358,7 @@ F:	drivers/thermal/
 F:	include/linux/cpu_cooling.h
 F:	include/linux/thermal.h
 F:	include/uapi/linux/thermal.h
+F:	tools/thermal/
 
 THERMAL DRIVER FOR AMLOGIC SOCS
 M:	Guillaume La Roque <[email protected]>
Signature · 1 line
2.25.1
#6 lore raw
In reply to Rolf Eike Beer
Quoted 5 lines · Rolf Eike Beer

Hi,

cross-building tmon can fail because it uses the non-prefixed, i.e. host, pkg- config.

Quoted 8 lines

If you prefer a merge the code is also available at:

https://github.com/emlix/linux thermal-makefile

Would be nice if someone could finally pick this up, it's almost 3 years now…

If someone knows anyone who better fits into these reviews please add CC's, sadly tools/thermal/ is not covered in MAINTAINERS.

That would be Daniel Lezcano. CCing.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#7 lore raw

Hi Jiri,

Quoted 9 lines · Jiri Kosina
Quoted 7 lines · Rolf Eike Beer

Hi,

cross-building tmon can fail because it uses the non-prefixed, i.e. host, pkg- config.

If you prefer a merge the code is also available at:

Quoted 8 lines
Quoted 6 lines

https://github.com/emlix/linux thermal-makefile

Would be nice if someone could finally pick this up, it's almost 3 years now…

If someone knows anyone who better fits into these reviews please add CC's, sadly tools/thermal/ is not covered in MAINTAINERS.

That would be Daniel Lezcano. CCing.

I sent a patch for that

https://lkml.org/lkml/2021/8/14/152

and applied the series

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog