4 LIBLOCKDEP_VERSION
=$(shell make
--no-print-directory
-sC ..
/..
/.. kernelversion
)
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.
12 $(if
$(or
$(findstring environment
,$(origin $(1))),\
13 $(findstring command line
,$(origin $(1)))),,\
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)
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.
28 DESTDIR_SQ
= '$(subst ','\'',$(DESTDIR
))'
32 libdir = $(prefix)/$(libdir_relative)
34 bindir = $(prefix)/$(bindir_relative)
36 export DESTDIR DESTDIR_SQ INSTALL
38 MAKEFLAGS += --no-print-directory
40 include ../../scripts/Makefile.include
42 # copy a bit from Linux kbuild
44 ifeq ("$(origin V)", "command line")
52 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
53 srctree := $(patsubst %/,%,$(dir $(srctree)))
54 srctree := $(patsubst %/,%,$(dir $(srctree)))
55 #$(info Determined 'srctree
' to be $(srctree))
59 libdir_SQ = $(subst ','\'',$(libdir))
60 bindir_SQ
= $(subst ','\'',$(bindir))
62 LIB_IN := $(OUTPUT)liblockdep-in.o
65 LIB_FILE = $(OUTPUT)liblockdep.a $(OUTPUT)liblockdep.so.$(LIBLOCKDEP_VERSION)
76 INCLUDES = -I. -I./uinclude -I./include -I../../include $(CONFIG_INCLUDES)
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
82 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
86 print_shared_lib_compile =
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';
95 export srctree OUTPUT CC LD CFLAGS V
96 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
98 do_compile_shared_library = \
99 ($(print_shared_lib_compile) \
100 $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$@"';$(shell ln -s $@ liblockdep.so))
102 do_build_static_lib = \
103 ($(print_static_lib_build) \
104 $(RM) $@; $(AR) rcs $@ $^)
106 CMD_TARGETS = $(LIB_FILE)
108 TARGETS = $(CMD_TARGETS)
113 all_cmd: $(CMD_TARGETS)
116 $(Q)$(MAKE) $(build)=liblockdep
118 liblockdep.so.$(LIBLOCKDEP_VERSION): $(LIB_IN)
119 $(Q)$(do_compile_shared_library)
121 liblockdep.a: $(LIB_IN)
122 $(Q)$(do_build_static_lib)
126 find . -name '*.
[ch
]' | xargs ctags --extra=+f --c-kinds=+px \
127 --regex-c++='/_PE\
(([^
,)]*).
*/PEVENT_ERRNO__\
1/'
131 find . -name '*.
[ch
]' | xargs etags \
132 --regex='/_PE
(\
([^
,)]*\
).
*/PEVENT_ERRNO__\
1/'
136 if [ ! -d '$(DESTDIR_SQ
)$2' ]; then \
137 $(INSTALL) -d -m 755 '$(DESTDIR_SQ
)$2'; \
139 $(INSTALL) $1 '$(DESTDIR_SQ
)$2'
143 $(Q)$(call do_install,$(LIB_FILE),$(libdir_SQ))
144 $(Q)$(call do_install,$(BIN_FILE),$(bindir_SQ))
149 $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d
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.
This page took 0.033759 seconds and 5 git commands to generate.