OSDN Git Service

efi_loadopt_create(): check buf for NULLness.
[android-x86/external-efivar.git] / Make.rules
1 default : all
2
3 .PHONY: default all clean install test
4
5 include $(TOPDIR)/Make.version
6
7 %.a :
8         $(AR) -cvqs $@ $^
9
10 % : %.c
11
12 % : %.c
13         $(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
14
15 %-static : ccldflags+=-static
16 %-static : %.c
17         $(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
18
19 %.so :
20         $(CCLD) $(ccldflags) $(CPPFLAGS) $(SOFLAGS) \
21           -Wl,-soname,$@.1 \
22           -Wl,--version-script=$(MAP) \
23           -o $@ $^ $(LDLIBS)
24
25 %.abixml : %.so
26         $(ABIDW) --headers-dir $(TOPDIR)/src/include/efivar/ --out-file $@ $^
27
28 %.abicheck : %.so
29         $(ABIDIFF) --suppr \
30                 $(patsubst %.so,%.abignore,$<) \
31                 $(patsubst %.so,%.abixml,$<) \
32                 $<
33
34 %.o : %.c
35         $(CC) $(cflags) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
36
37 %.static.o : %.c
38         $(CC) $(cflags) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
39
40 %.o : %.S
41         $(CC) $(cflags) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
42
43 %.static.o : %.S
44         $(CC) $(cflags) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
45
46 %.S: %.c
47         $(CC) $(cflags) $(CPPFLAGS) -S $< -o $@
48
49 %.E: %.c
50         $(CC) $(cflags) $(CPPFLAGS) -E $< -o $@
51
52 %.c : %.h
53
54 define substitute-version
55         sed                                             \
56                 -e "s,@@VERSION@@,$(VERSION),g"         \
57                 -e "s,@@LIBDIR@@,$(libdir),g"           \
58                 $(1) > $(2)
59 endef
60
61 %.pc : %.pc.in
62         @$(call substitute-version,$<,$@)
63 %.spec : %.spec.in
64         @$(call substitute-version,$<,$@)
65 %.map : %.map.in
66         @$(call substitute-version,$<,$@)
67
68 pkg-config-cflags = \
69         $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --cflags $(PKGS); fi)
70 pkg-config-ldflags = \
71         $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-L --libs-only-other $(PKGS) ; fi)
72 pkg-config-ldlibs = \
73         $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-l $(PKGS) ; fi)
74
75 define deps-of
76         $(foreach src,$(filter %.c,$(1)),$(patsubst %.c,.%.d,$(src))) \
77         $(foreach src,$(filter %.S,$(1)),$(patsubst %.S,.%.d,$(src)))
78 endef