File: Makefile

package info (click to toggle)
mcelog 147%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 876 kB
  • ctags: 979
  • sloc: ansic: 7,634; sh: 482; makefile: 110; python: 60
file content (132 lines) | stat: -rw-r--r-- 3,813 bytes parent folder | download | duplicates (2)
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 -Os
prefix := /usr
etcprefix :=
MANDIR := ${prefix}/share/man
# Define appropiately for your distribution
# DOCDIR := /usr/share/doc/packages/mcelog

# Note when changing prefix: some of the non-critical files like
# the manpage or the init script have hardcoded prefixes

# Warning flags added implicitely to CFLAGS in the default rule
# this is done so that even when CFLAGS are overriden we still get
# the additional warnings
# Some warnings require the global optimizer and are only output with 
# -O2/-Os, so that should be tested occasionally
WARNINGS := -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter \
	    -Wstrict-prototypes -Wformat-security -Wmissing-declarations \
	    -Wdeclaration-after-statement

TRIGGERS=cache-error-trigger dimm-error-trigger page-error-trigger \
	 socket-memory-error-trigger \
	 bus-error-trigger \
	 iomca-error-trigger \
	 unknown-error-trigger

all: mcelog

.PHONY: install clean depend FORCE

OBJ := p4.o k8.o mcelog.o dmi.o tsc.o core2.o bitfield.o intel.o \
       nehalem.o dunnington.o tulsa.o config.o memutil.o msg.o   \
       eventloop.o leaky-bucket.o memdb.o server.o trigger.o 	 \
       client.o cache.o sysfs.o yellow.o page.o rbtree.o 	 \
       sandy-bridge.o ivy-bridge.o haswell.o		 	 \
       broadwell_de.o broadwell_epex.o skylake_xeon.o		 \
       denverton.o						 \
       msr.o bus.o unknown.o
CLEAN := mcelog dmi tsc dbquery .depend .depend.X dbquery.o \
	version.o version.c version.tmp
DOC := mce.pdf

ADD_DEFINES :=

SRC := $(OBJ:.o=.c)

mcelog: ${OBJ} version.o

# dbquery intentionally not installed by default
install: mcelog mcelog.conf mcelog.conf.5 mcelog.triggers.5
	mkdir -p $(DESTDIR)${etcprefix}/etc/mcelog $(DESTDIR)${prefix}/sbin $(DESTDIR)$(MANDIR)/man5 $(DESTDIR)$(MANDIR)/man8
	install -m 755 -p mcelog $(DESTDIR)${prefix}/sbin/mcelog
	install -m 644 -p mcelog.8 $(DESTDIR)$(MANDIR)/man8
	install -m 644 -p mcelog.conf.5 $(DESTDIR)$(MANDIR)/man5
	install -m 644 -p mcelog.triggers.5 $(DESTDIR)$(MANDIR)/man5
	install -m 644 -p -b mcelog.conf $(DESTDIR)${etcprefix}/etc/mcelog/mcelog.conf
	for i in ${TRIGGERS} ; do 						\
		install -m 755 -p -b triggers/$$i $(DESTDIR)${etcprefix}/etc/mcelog ; 	\
	done
ifdef DOCDIR
	install -d 755 $(DESTDIR)${DOCDIR} 
	install -m 644 -p ${DOC} $(DESTDIR)${DOCDIR} 
else
	echo
	echo "Consider defining DOCDIR to install additional documentation"
endif

mcelog.conf.5: mcelog.conf config-intro.man
	./genconfig.py mcelog.conf config-intro.man > mcelog.conf.5

clean: test-clean
	rm -f ${CLEAN} ${OBJ} 

tsc:    tsc.c
	$(CC) -o tsc ${CFLAGS} -DSTANDALONE tsc.c ${LDFLAGS}

dbquery: db.o dbquery.o memutil.o

depend: .depend

%.o: %.c
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(WARNINGS) $(ADD_DEFINES) -o $@ $<

version.tmp: FORCE
	( echo -n "char version[] = \"" ; 	\
	if type -p git >/dev/null; then 	\
	if [ -d .git ] ; then 			\
		git describe --tags HEAD | tr -d '\n'; 	\
	else 					\
		echo -n "unknown" ; 		\
	fi ;					\
	else echo -n "unknown" ; fi ;		\
	echo '";'				\
	 ) > version.tmp

version.c: version.tmp
	cmp version.tmp version.c || mv version.tmp version.c

.depend: ${SRC}
	${CC} -MM -I. ${SRC} > .depend.X && mv .depend.X .depend

include .depend

Makefile: .depend

.PHONY: iccverify src test

# run the icc static verifier over sources. you need the intel compiler installed for this
DISABLED_DIAGS := -diag-disable 188,271,869,2259,981,12072,181,12331,1572

iccverify:
	icc -Wall -diag-enable sv3 $(DISABLED_DIAGS) $(ADD_DEFINES) $(SRC)	

clangverify:
	clang --analyze $(ADD_DEFINES) $(SRC)

src:
	echo $(SRC)

config-test: config.c
	$(CC) -DTEST=1 config.c -o config-test

test:
	$(MAKE) -C tests test DEBUG=""

VALGRIND=valgrind --leak-check=full

valgrind-test:
	$(MAKE) -C tests test DEBUG="${VALGRIND}"

test-clean:
	$(MAKE) -C tests clean