Skip to content

Commit ee0778a

Browse files
masselstinelenb
authored andcommitted
tools/power: turbostat: make Makefile a bit more capable
The turbostat Makefile is pretty simple, its output is placed in the same directory as the source, the install rule has no concept of a prefix or sysroot, and you can set CC to use a specific compiler but not use the more familiar CROSS_COMPILE. By making a few minor changes these limitations are removed while leaving the default behavior matching what it used to be. Example build with these changes: make CROSS_COMPILE=i686-wrs-linux-gnu- DESTDIR=/tmp install or from the tools directory make CROSS_COMPILE=i686-wrs-linux-gnu- DESTDIR=/tmp turbostat_install Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 84764a4 commit ee0778a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

tools/power/x86/turbostat/Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1+
CC = $(CROSS_COMPILE)gcc
2+
BUILD_OUTPUT := $(PWD)
3+
PREFIX := /usr
4+
DESTDIR :=
5+
16
turbostat : turbostat.c
27
CFLAGS += -Wall
38
CFLAGS += -I../../../../arch/x86/include/
49

10+
%: %.c
11+
@mkdir -p $(BUILD_OUTPUT)
12+
$(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@
13+
14+
.PHONY : clean
515
clean :
6-
rm -f turbostat
16+
@rm -f $(BUILD_OUTPUT)/turbostat
717

8-
install :
9-
install turbostat /usr/bin/turbostat
10-
install turbostat.8 /usr/share/man/man8
18+
install : turbostat
19+
install -d $(DESTDIR)$(PREFIX)/bin
20+
install $(BUILD_OUTPUT)/turbostat $(DESTDIR)$(PREFIX)/bin/turbostat
21+
install -d $(DESTDIR)$(PREFIX)/share/man/man8
22+
install turbostat.8 $(DESTDIR)$(PREFIX)/share/man/man8

0 commit comments

Comments
 (0)