x86/mce: Handle Local MCE events
[deliverable/linux.git] / tools / lib / lockdep / Makefile
1 # file format version
2 FILE_VERSION = 1
3
4 LIBLOCKDEP_VERSION=$(shell make --no-print-directory -sC ../../.. kernelversion)
5
6 # Makefiles suck: This macro sets a default value of $(2) for the
7 # variable named by $(1), unless the variable has been set by
8 # environment or command line. This is necessary for CC and AR
9 # because make sets default values, so the simpler ?= approach
10 # won't work as expected.
11 define allow-override
12 $(if $(or $(findstring environment,$(origin $(1))),\
13 $(findstring command line,$(origin $(1)))),,\
14 $(eval $(1) = $(2)))
15 endef
16
17 # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
18 $(call allow-override,CC,$(CROSS_COMPILE)gcc)
19 $(call allow-override,AR,$(CROSS_COMPILE)ar)
20
21 INSTALL = install
22
23 # Use DESTDIR for installing into a different root directory.
24 # This is useful for building a package. The program will be
25 # installed in this directory as if it was the root directory.
26 # Then the build tool can move it later.
27 DESTDIR ?=
28 DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
29
30 prefix ?= /usr/local
31 libdir_relative = lib
32 libdir = $(prefix)/$(libdir_relative)
33 bindir_relative = bin
34 bindir = $(prefix)/$(bindir_relative)
35
36 export DESTDIR DESTDIR_SQ INSTALL
37
38 MAKEFLAGS += --no-print-directory
39
40 include ../../scripts/Makefile.include
41
42 # copy a bit from Linux kbuild
43
44 ifeq ("$(origin V)", "command line")
45 VERBOSE = $(V)
46 endif
47 ifndef VERBOSE
48 VERBOSE = 0
49 endif
50
51 ifeq ($(srctree),)
52 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
53 srctree := $(patsubst %/,%,$(dir $(srctree)))
54 srctree := $(patsubst %/,%,$(dir $(srctree)))
55 #$(info Determined 'srctree' to be $(srctree))
56 endif
57
58 # Shell quotes
59 libdir_SQ = $(subst ','\'',$(libdir))
60 bindir_SQ = $(subst ','\'',$(bindir))
61
62 LIB_IN := $(OUTPUT)liblockdep-in.o
63
64 BIN_FILE = lockdep
65 LIB_FILE = $(OUTPUT)liblockdep.a $(OUTPUT)liblockdep.so.$(LIBLOCKDEP_VERSION)
66
67 CONFIG_INCLUDES =
68 CONFIG_LIBS =
69 CONFIG_FLAGS =
70
71 OBJ = $@
72 N =
73
74 export Q VERBOSE
75
76 INCLUDES = -I. -I./uinclude -I./include -I../../include $(CONFIG_INCLUDES)
77
78 # Set compile option CFLAGS if not set elsewhere
79 CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g
80 CFLAGS += -fPIC
81
82 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
83
84 ifeq ($(VERBOSE),1)
85 Q =
86 print_shared_lib_compile =
87 print_install =
88 else
89 Q = @
90 print_shared_lib_compile = echo ' LD '$(OBJ);
91 print_static_lib_build = echo ' LD '$(OBJ);
92 print_install = echo ' INSTALL '$1' to $(DESTDIR_SQ)$2';
93 endif
94
95 export srctree OUTPUT CC LD CFLAGS V
96 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
97
98 do_compile_shared_library = \
99 ($(print_shared_lib_compile) \
100 $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$@"';$(shell ln -s $@ liblockdep.so))
101
102 do_build_static_lib = \
103 ($(print_static_lib_build) \
104 $(RM) $@; $(AR) rcs $@ $^)
105
106 CMD_TARGETS = $(LIB_FILE)
107
108 TARGETS = $(CMD_TARGETS)
109
110
111 all: all_cmd
112
113 all_cmd: $(CMD_TARGETS)
114
115 $(LIB_IN): force
116 $(Q)$(MAKE) $(build)=liblockdep
117
118 liblockdep.so.$(LIBLOCKDEP_VERSION): $(LIB_IN)
119 $(Q)$(do_compile_shared_library)
120
121 liblockdep.a: $(LIB_IN)
122 $(Q)$(do_build_static_lib)
123
124 tags: force
125 $(RM) tags
126 find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
127 --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
128
129 TAGS: force
130 $(RM) TAGS
131 find . -name '*.[ch]' | xargs etags \
132 --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'
133
134 define do_install
135 $(print_install) \
136 if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
137 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
138 fi; \
139 $(INSTALL) $1 '$(DESTDIR_SQ)$2'
140 endef
141
142 install_lib: all_cmd
143 $(Q)$(call do_install,$(LIB_FILE),$(libdir_SQ))
144 $(Q)$(call do_install,$(BIN_FILE),$(bindir_SQ))
145
146 install: install_lib
147
148 clean:
149 $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d
150 $(RM) tags TAGS
151
152 PHONY += force
153 force:
154
155 # Declare the contents of the .PHONY variable as phony. We keep that
156 # information in a variable so we can use it in if_changed and friends.
157 .PHONY: $(PHONY)
This page took 0.033759 seconds and 5 git commands to generate.