1CC = $(CROSS_COMPILE)gcc 2BUILD_OUTPUT := $(CURDIR) 3PREFIX ?= /usr 4DESTDIR ?= 5 6ifeq ("$(origin O)", "command line") 7 BUILD_OUTPUT := $(O) 8endif 9 10turbostat : turbostat.c 11CFLAGS += -Wall 12CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' 13CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' 14 15%: %.c 16 @mkdir -p $(BUILD_OUTPUT) 17 $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ 18 19.PHONY : clean 20clean : 21 @rm -f $(BUILD_OUTPUT)/turbostat 22 23install : turbostat 24 install -d $(DESTDIR)$(PREFIX)/bin 25 install $(BUILD_OUTPUT)/turbostat $(DESTDIR)$(PREFIX)/bin/turbostat 26 install -d $(DESTDIR)$(PREFIX)/share/man/man8 27 install turbostat.8 $(DESTDIR)$(PREFIX)/share/man/man8 28