Mark Asselstine | ee0778a | 2012-10-09 11:31:44 -0400 | [diff] [blame] | 1 | CC = $(CROSS_COMPILE)gcc |
Thomas D | f82263c | 2015-01-05 21:37:23 +0100 | [diff] [blame] | 2 | BUILD_OUTPUT := $(CURDIR) |
Mark Asselstine | ee0778a | 2012-10-09 11:31:44 -0400 | [diff] [blame] | 3 | PREFIX := /usr |
| 4 | DESTDIR := |
| 5 | |
Thomas D | f82263c | 2015-01-05 21:37:23 +0100 | [diff] [blame] | 6 | ifeq ("$(origin O)", "command line") |
| 7 | BUILD_OUTPUT := $(O) |
| 8 | endif |
| 9 | |
Len Brown | 103a8fe | 2010-10-22 23:53:03 -0400 | [diff] [blame] | 10 | turbostat : turbostat.c |
Len Brown | c98d5d9 | 2012-06-04 00:56:40 -0400 | [diff] [blame] | 11 | CFLAGS += -Wall |
Josh Triplett | b731f31 | 2013-08-20 17:20:12 -0700 | [diff] [blame] | 12 | CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"' |
Len Brown | 103a8fe | 2010-10-22 23:53:03 -0400 | [diff] [blame] | 13 | |
Mark Asselstine | ee0778a | 2012-10-09 11:31:44 -0400 | [diff] [blame] | 14 | %: %.c |
| 15 | @mkdir -p $(BUILD_OUTPUT) |
| 16 | $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ |
Len Brown | 103a8fe | 2010-10-22 23:53:03 -0400 | [diff] [blame] | 17 | |
Mark Asselstine | ee0778a | 2012-10-09 11:31:44 -0400 | [diff] [blame] | 18 | .PHONY : clean |
Len Brown | 103a8fe | 2010-10-22 23:53:03 -0400 | [diff] [blame] | 19 | clean : |
Mark Asselstine | ee0778a | 2012-10-09 11:31:44 -0400 | [diff] [blame] | 20 | @rm -f $(BUILD_OUTPUT)/turbostat |
Len Brown | 103a8fe | 2010-10-22 23:53:03 -0400 | [diff] [blame] | 21 | |
Mark Asselstine | ee0778a | 2012-10-09 11:31:44 -0400 | [diff] [blame] | 22 | install : turbostat |
| 23 | install -d $(DESTDIR)$(PREFIX)/bin |
| 24 | install $(BUILD_OUTPUT)/turbostat $(DESTDIR)$(PREFIX)/bin/turbostat |
| 25 | install -d $(DESTDIR)$(PREFIX)/share/man/man8 |
| 26 | install turbostat.8 $(DESTDIR)$(PREFIX)/share/man/man8 |