Adjust Makefile to compile libx86info.so From: Thomas Renninger Index: x86info-1.24/Makefile =================================================================== --- x86info-1.24.orig/Makefile +++ x86info-1.24/Makefile @@ -1,4 +1,4 @@ -CFLAGS = -g -O2 -Werror -Wall -Wshadow -Wextra -Wmissing-declarations -Wdeclaration-after-statement -Wredundant-decls +override CFLAGS = -g -O2 -Werror -Wall -Wshadow -Wextra -Wmissing-declarations -Wdeclaration-after-statement -Wredundant-decls CC = gcc SHELL = /bin/sh @@ -15,7 +15,7 @@ SHELL = /bin/sh $(CC) $(CFLAGS) -o $@ -c $< -all: x86info test lsmsr +all: x86info test lsmsr libx86info.so LSMSR_TMP_HEADERS=AMD/k8.h AMD/fam10h.h generic_msr.h @@ -77,9 +77,8 @@ X86INFO_SRC =\ dumpregs.c\ features.c\ identify.c\ - msr.c\ dumpmsr.c\ - binary.c\ + binary.c\ mptable.c\ get_model_name.c\ mtrr.c \ @@ -90,11 +89,18 @@ X86INFO_SRC =\ X86INFO_OBJS = $(X86INFO_SRC:%.c=%.o) -x86info: $(X86INFO_OBJS) - $(CC) $(CFLAGS) -o x86info $(X86INFO_OBJS) +x86info: $(X86INFO_OBJS) libx86info.so + $(CC) $(CFLAGS) -o x86info $(X86INFO_OBJS) -L. -lx86info -include $(X86INFO_SRC:%.c=%.P) +msr.o: CFLAGS += -fPIC + +libx86info.so.1: msr.o + ${CC} -shared -Wl,-soname=libx86info.so.1 -o libx86info.so.1 $^ + +libx86info.so: libx86info.so.1 + ln -sf libx86info.so.1 libx86info.so nodes: scripts/makenodes