summaryrefslogtreecommitdiffstats
path: root/tools/thermal/tmon/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/thermal/tmon/Makefile')
-rw-r--r--tools/thermal/tmon/Makefile11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile
index 13d1876..0788621 100644
--- a/tools/thermal/tmon/Makefile
+++ b/tools/thermal/tmon/Makefile
@@ -16,12 +16,21 @@ INSTALL_CONFIGFILE=install -m 644 -p
CONFIG_FILE=
CONFIG_PATH=
+# Static builds might require -ltinfo, for instance
+ifneq ($(findstring -static, $(LDFLAGS)),)
+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 || \
+ echo -lpanel -lncurses)
OBJS = tmon.o tui.o sysfs.o pid.o
OBJS +=
tmon: $(OBJS) Makefile tmon.h
- $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -ltinfo -lpthread
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(TARGET) $(TMON_LIBS)
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
OpenPOWER on IntegriCloud