* [PATCH 1/3] tools/thermal: tmon: use "-fstack-protector" only if supported
2017-09-27 23:02 [PATCH 0/3] tools/thermal: tmon: Makefile improvements Markus Mayer
@ 2017-09-27 23:02 ` Markus Mayer
2017-09-27 23:02 ` [PATCH 2/3] tools/thermal: tmon: allow $(CC) to be defined externally Markus Mayer
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Markus Mayer @ 2017-09-27 23:02 UTC (permalink / raw)
To: Zhang Rui
Cc: Markus Mayer, Broadcom Kernel List, Power Management List,
Linux Kernel Mailing List
From: Markus Mayer <mmayer@broadcom.com>
Most, but not all, toolchains support the "-fstack-protector" flag. We
check if the compiler supports the flag before using it. This allows
tmon to be compiled for more environments.
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
tools/thermal/tmon/Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile
index 3a961e9..5777bc7 100644
--- a/tools/thermal/tmon/Makefile
+++ b/tools/thermal/tmon/Makefile
@@ -1,8 +1,13 @@
+# We need this for the "cc-option" macro.
+include ../../../scripts/Kbuild.include
+
VERSION = 1.0
BINDIR=usr/bin
WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int
-CFLAGS+= -O1 ${WARNFLAGS} -fstack-protector
+CFLAGS+= -O1 ${WARNFLAGS}
+# Add "-fstack-protector" only if toolchain supports it.
+CFLAGS+= $(call cc-option,-fstack-protector)
CC=$(CROSS_COMPILE)gcc
CFLAGS+=-D VERSION=\"$(VERSION)\"
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] tools/thermal: tmon: allow $(CC) to be defined externally
2017-09-27 23:02 [PATCH 0/3] tools/thermal: tmon: Makefile improvements Markus Mayer
2017-09-27 23:02 ` [PATCH 1/3] tools/thermal: tmon: use "-fstack-protector" only if supported Markus Mayer
@ 2017-09-27 23:02 ` Markus Mayer
2017-09-27 23:02 ` [PATCH 3/3] tools/thermal: tmon: use $(PKG_CONFIG) instead of hard-coding pkg-config Markus Mayer
2017-10-13 20:39 ` [PATCH 0/3] tools/thermal: tmon: Makefile improvements Markus Mayer
3 siblings, 0 replies; 6+ messages in thread
From: Markus Mayer @ 2017-09-27 23:02 UTC (permalink / raw)
To: Zhang Rui
Cc: Markus Mayer, Broadcom Kernel List, Power Management List,
Linux Kernel Mailing List
From: Markus Mayer <mmayer@broadcom.com>
It can be helpful, especially when using a build system, to set the C
compiler externally.
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
tools/thermal/tmon/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile
index 5777bc7..581da71 100644
--- a/tools/thermal/tmon/Makefile
+++ b/tools/thermal/tmon/Makefile
@@ -8,7 +8,7 @@ WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-
CFLAGS+= -O1 ${WARNFLAGS}
# Add "-fstack-protector" only if toolchain supports it.
CFLAGS+= $(call cc-option,-fstack-protector)
-CC=$(CROSS_COMPILE)gcc
+CC?= $(CROSS_COMPILE)gcc
CFLAGS+=-D VERSION=\"$(VERSION)\"
LDFLAGS+=
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] tools/thermal: tmon: use $(PKG_CONFIG) instead of hard-coding pkg-config
2017-09-27 23:02 [PATCH 0/3] tools/thermal: tmon: Makefile improvements Markus Mayer
2017-09-27 23:02 ` [PATCH 1/3] tools/thermal: tmon: use "-fstack-protector" only if supported Markus Mayer
2017-09-27 23:02 ` [PATCH 2/3] tools/thermal: tmon: allow $(CC) to be defined externally Markus Mayer
@ 2017-09-27 23:02 ` Markus Mayer
2017-10-13 20:39 ` [PATCH 0/3] tools/thermal: tmon: Makefile improvements Markus Mayer
3 siblings, 0 replies; 6+ messages in thread
From: Markus Mayer @ 2017-09-27 23:02 UTC (permalink / raw)
To: Zhang Rui
Cc: Markus Mayer, Broadcom Kernel List, Power Management List,
Linux Kernel Mailing List
From: Markus Mayer <mmayer@broadcom.com>
To ease cross-compiling, make use of the $(PKG_CONFIG) variable rather
than hard-coding calls to pkg-config.
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
tools/thermal/tmon/Makefile | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile
index 581da71..1e11bd3 100644
--- a/tools/thermal/tmon/Makefile
+++ b/tools/thermal/tmon/Makefile
@@ -9,6 +9,7 @@ CFLAGS+= -O1 ${WARNFLAGS}
# Add "-fstack-protector" only if toolchain supports it.
CFLAGS+= $(call cc-option,-fstack-protector)
CC?= $(CROSS_COMPILE)gcc
+PKG_CONFIG?= pkg-config
CFLAGS+=-D VERSION=\"$(VERSION)\"
LDFLAGS+=
@@ -23,12 +24,12 @@ STATIC := --static
endif
TMON_LIBS=-lm -lpthread
-TMON_LIBS += $(shell pkg-config --libs $(STATIC) panelw ncursesw 2> /dev/null || \
- pkg-config --libs $(STATIC) panel ncurses 2> /dev/null || \
+TMON_LIBS += $(shell $(PKG_CONFIG) --libs $(STATIC) panelw ncursesw 2> /dev/null || \
+ $(PKG_CONFIG) --libs $(STATIC) panel ncurses 2> /dev/null || \
echo -lpanel -lncurses)
-CFLAGS += $(shell pkg-config --cflags $(STATIC) panelw ncursesw 2> /dev/null || \
- pkg-config --cflags $(STATIC) panel ncurses 2> /dev/null)
+CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \
+ $(PKG_CONFIG) --cflags $(STATIC) panel ncurses 2> /dev/null)
OBJS = tmon.o tui.o sysfs.o pid.o
OBJS +=
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] tools/thermal: tmon: Makefile improvements
2017-09-27 23:02 [PATCH 0/3] tools/thermal: tmon: Makefile improvements Markus Mayer
` (2 preceding siblings ...)
2017-09-27 23:02 ` [PATCH 3/3] tools/thermal: tmon: use $(PKG_CONFIG) instead of hard-coding pkg-config Markus Mayer
@ 2017-10-13 20:39 ` Markus Mayer
2017-10-18 2:19 ` Zhang Rui
3 siblings, 1 reply; 6+ messages in thread
From: Markus Mayer @ 2017-10-13 20:39 UTC (permalink / raw)
To: Zhang Rui
Cc: Broadcom Kernel List, Power Management List,
Linux Kernel Mailing List
On 27 September 2017 at 16:02, Markus Mayer <code@mmayer.net> wrote:
> From: Markus Mayer <mmayer@broadcom.com>
>
> This series introduces a number of improvements to tmon's Makefile. The
> changes are meant to make it easier to cross-compile tmon on a greater
> number of platforms by giving more control to the person performing the
> build.
>
> At the same time, sensible defaults are retained so that building tmon
> will continue to work without any customizations on platforms on which
> it currently builds.
Rui, is there any chance you would be able to take this?
Thanks,
-Markus
> Markus Mayer (3):
> tools/thermal: tmon: use "-fstack-protector" only if supported
> tools/thermal: tmon: allow $(CC) to be defined externally
> tools/thermal: tmon: use $(PKG_CONFIG) instead of hard-coding
> pkg-config
>
> tools/thermal/tmon/Makefile | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] tools/thermal: tmon: Makefile improvements
2017-10-13 20:39 ` [PATCH 0/3] tools/thermal: tmon: Makefile improvements Markus Mayer
@ 2017-10-18 2:19 ` Zhang Rui
0 siblings, 0 replies; 6+ messages in thread
From: Zhang Rui @ 2017-10-18 2:19 UTC (permalink / raw)
To: Markus Mayer
Cc: Broadcom Kernel List, Power Management List,
Linux Kernel Mailing List
On Fri, 2017-10-13 at 13:39 -0700, Markus Mayer wrote:
> On 27 September 2017 at 16:02, Markus Mayer <code@mmayer.net> wrote:
> >
> > From: Markus Mayer <mmayer@broadcom.com>
> >
> > This series introduces a number of improvements to tmon's Makefile.
> > The
> > changes are meant to make it easier to cross-compile tmon on a
> > greater
> > number of platforms by giving more control to the person performing
> > the
> > build.
> >
> > At the same time, sensible defaults are retained so that building
> > tmon
> > will continue to work without any customizations on platforms on
> > which
> > it currently builds.
> Rui, is there any chance you would be able to take this?
>
yes, patches applied.
thanks,
rui
> Thanks,
> -Markus
>
> >
> > Markus Mayer (3):
> > tools/thermal: tmon: use "-fstack-protector" only if supported
> > tools/thermal: tmon: allow $(CC) to be defined externally
> > tools/thermal: tmon: use $(PKG_CONFIG) instead of hard-coding
> > pkg-config
> >
> > tools/thermal/tmon/Makefile | 18 ++++++++++++------
> > 1 file changed, 12 insertions(+), 6 deletions(-)
> >
> > --
> > 2.7.4
> >
^ permalink raw reply [flat|nested] 6+ messages in thread