Makefile 769 B

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