| 1 |
# |
| 2 |
# Makefile for i7z, GPL v2, License in COPYING |
| 3 |
# |
| 4 |
|
| 5 |
#makefile updated from patch by anestling |
| 6 |
|
| 7 |
#explicitly disable two scheduling flags as they cause segfaults, two more seem to crash the GUI version so putting them |
| 8 |
#here |
| 9 |
CFLAGS_FOR_AVOIDING_SEG_FAULT = -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves |
| 10 |
CFLAGS ?= -O3 |
| 11 |
CFLAGS += $(CFLAGS_FOR_AVOIDING_SEG_FAULT) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILD_MAIN -Wimplicit-function-declaration |
| 12 |
|
| 13 |
LBITS := $(shell getconf LONG_BIT) |
| 14 |
ifeq ($(LBITS),64) |
| 15 |
CFLAGS += -Dx64_BIT |
| 16 |
else |
| 17 |
CFLAGS += -Dx86 |
| 18 |
endif |
| 19 |
|
| 20 |
CC ?= gcc |
| 21 |
|
| 22 |
LIBS += -lncurses -lpthread -lrt -lm |
| 23 |
INCLUDEFLAGS = |
| 24 |
|
| 25 |
BIN = i7z |
| 26 |
# PERFMON-BIN = perfmon-i7z #future version to include performance monitor, either standalone or integrated |
| 27 |
SRC = i7z.c helper_functions.c i7z_Single_Socket.c i7z_Dual_Socket.c |
| 28 |
OBJ = $(SRC:.c=.o) |
| 29 |
|
| 30 |
prefix ?= /usr |
| 31 |
sbindir = $(prefix)/sbin/ |
| 32 |
docdir = $(prefix)/share/doc/$(BIN)/ |
| 33 |
mandir ?= $(prefix)/share/man/ |
| 34 |
|
| 35 |
all: clean test_exist |
| 36 |
|
| 37 |
message: |
| 38 |
@echo "If the compilation complains about not finding ncurses.h, install ncurses (libncurses5-dev on ubuntu/debian)" |
| 39 |
|
| 40 |
bin: message $(OBJ) |
| 41 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $(BIN) $(OBJ) $(LIBS) |
| 42 |
|
| 43 |
#http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644728 for -ltinfo on debian |
| 44 |
static-bin: message $(OBJ) |
| 45 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $(BIN) $(OBJ) -static-libgcc -DNCURSES_STATIC -static -lpthread -lncurses -lrt -lm -ltinfo |
| 46 |
|
| 47 |
# perfmon-bin: message $(OBJ) |
| 48 |
# $(CC) $(CFLAGS) $(LDFLAGS) -o $(PERFMON-BIN) perfmon-i7z.c helper_functions.c $(LIBS) |
| 49 |
|
| 50 |
test_exist: bin |
| 51 |
@test -f i7z && echo 'Succeeded, now run sudo ./i7z' || echo 'Compilation failed' |
| 52 |
|
| 53 |
clean: |
| 54 |
rm -f *.o $(BIN) |
| 55 |
|
| 56 |
distclean: clean |
| 57 |
rm -f *~ \#* |
| 58 |
|
| 59 |
install: $(BIN) |
| 60 |
install -D -m 0644 doc/i7z.man $(DESTDIR)$(mandir)man1/i7z.1 |
| 61 |
install -D -m 755 $(BIN) $(DESTDIR)$(sbindir)$(BIN) |
| 62 |
install -d $(DESTDIR)$(docdir) |
| 63 |
install -m 0644 README.txt put_cores_offline.sh put_cores_online.sh MAKEDEV-cpuid-msr $(DESTDIR)$(docdir) |
| 64 |
install -m 0755 i7z_rw_registers.rb $(DESTDIR)$(sbindir)/i7z_rw_registers |