diff --git a/libsgxstep/Makefile b/libsgxstep/Makefile index 012d757..4fefe57 100644 --- a/libsgxstep/Makefile +++ b/libsgxstep/Makefile @@ -4,7 +4,14 @@ CC = gcc AS = gcc AR = ar ARFLAGS = -rcs -CFLAGS += -DHAS_PSTATE -DHAS_TURBO + +ifneq "$(WITH_PSTATE)" "0" +CPPFLAGS += -DHAS_PSTATE +endif + +ifneq "$(WITH_TURBO)" "0" +CPPFLAGS += -DHAS_TURBO +endif ifeq ($(M32), 1) ASFLAGS = -m32 -DM32=1 @@ -25,7 +32,7 @@ $(OUTPUT): $(OBJECTS) %.o : %.c echo "$(INDENT)[CC] " $< - $(CC) $(CFLAGS) $(INCLUDE) -c $< + $(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDE) -c $< %.o : %.S echo "$(INDENT)[AS] " $< diff --git a/libsgxstep/sched.c b/libsgxstep/sched.c index d8be00a..bf2adfe 100644 --- a/libsgxstep/sched.c +++ b/libsgxstep/sched.c @@ -113,10 +113,14 @@ int disable_turbo(void) int turbo_enabled( void ) { +#ifdef HAS_TURBO int result; - - file_read_int( "/sys/devices/system/cpu/intel_pstate/no_turbo", &result); + + file_read_int( "/sys/devices/system/cpu/intel_pstate/no_turbo", &result); return (result == 0)? 1 : 0; +#else + return 0; +#endif } int restore_system_state(void)