summaryrefslogtreecommitdiff
path: root/Makefile
blob: 0afb0945c822a025628d09b4c55a040a2cac896e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
CFLAGS = -g -O2 -Werror -Wall -Wshadow -Wextra -Wmissing-declarations -Wdeclaration-after-statement -Wredundant-decls -fno-strict-aliasing
LDFLAGS = -Wl,-z,relro,-z,now
# -Wstrict-overflow=5
CC = gcc

SHELL = /bin/sh


.c.o:
	$(CC) $(CFLAGS) -MMD -MF $(patsubst %.c,%.d,$<) -o $@ -c $<
	@cp $*.d $*.P; \
	 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
	     -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
	rm -f $*.d

.S.o:
	$(CC) $(CFLAGS) -o $@ -c $<


all: x86info test lsmsr


LSMSR_TMP_HEADERS=AMD/k8.h AMD/fam10h.h AMD/fam11h.h generic_msr.h

%.h: %.regs scripts/createheader.py
	python scripts/createheader.py $< `basename $< .regs` >$@

LSMSR_SRC =\
	lsmsr.c\
	cpuid.c\
	havecpuid.c

LSMSR_OBJS = $(LSMSR_SRC:%.c=%.o)

lsmsr.c: $(LSMSR_TMP_HEADERS)

lsmsr: $(LSMSR_TMP_HEADERS) $(LSMSR_OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o lsmsr $(LSMSR_OBJS)

-include $(LSMSR_SRC:%.c=%.P)

X86INFO_SRC =\
	AMD/identify.c\
	AMD/machine_check.c\
	AMD/MSR-Athlon.c\
	AMD/MSR-K6.c\
	AMD/powernow.c\
	AMD/dumppsb.c\
	AMD/bugs.c\
\
	Cyrix/identify.c\
\
	Intel/identify.c\
	Intel/identify-family6.c\
	Intel/identify-family6-extended.c\
	Intel/identify-family15.c\
	Intel/info.c\
	Intel/machine_check.c\
	Intel/cachesize.c\
	Intel/eblcr.c\
	Intel/MSR-P4.c\
	Intel/MSR-P6.c\
	Intel/MSR-performance.c\
	Intel/MSR-thermal.c\
	Intel/microcode.c\
	Intel/topology.c\
\
	Centaur/identify.c\
	Centaur/MSR-C3.c\
	Centaur/longhaul.c\
	Centaur/powersaver.c\
\
	NatSemi/identify.c\
\
	RiSE/identify.c\
\
	SiS/identify.c\
\
	x86info.c\
	havecpuid.c\
	cpuid.c\
	dumpregs.c\
	features.c\
	identify.c\
	rdmsr.c\
	binary.c\
	mptable.c\
	get_model_name.c\
	mtrr.c \
	apic.c \
	connector.c\
\
	bench/benchmarks.c\
	bench/MHz.c

X86INFO_OBJS = $(X86INFO_SRC:%.c=%.o)

x86info: $(X86INFO_OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o x86info $(X86INFO_OBJS)

-include $(X86INFO_SRC:%.c=%.P)


nodes:
	scripts/makenodes

test:
	scripts/testnodes

VERSION=1.28

release:
	git repack -a -d
	git prune-packed
	git archive --format=tar --prefix=x86info-$(VERSION)/ HEAD | gzip -9 > x86info-$(VERSION).tgz

clean:
	@find . -name "*.o" -exec rm {} \;
	@find . -name "*~" -exec rm {} \;
	@find . -name "*.P" -exec rm {} \;
	@rm -f x86info x86info.exe
	@rm -f lsmsr $(LSMSR_TMP_HEADERS)
	@rm -f core.*

splint:
	splint +posixlib -badflag -fileextensions -type -nullassign -boolops -showcolumn -sysunrecog -fullinitblock -onlytrans -unrecog -usedef -statictrans -compdestroy -predboolint -predboolothers -D__`uname -m`__ $(X86INFO_SRC)

sparse:
	sparse $(X86INFO_SRC)

cscope:
	cscope -Rb