forked from rhboot/efivar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Make.rules
66 lines (48 loc) · 1.51 KB
/
Make.rules
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
default : all
.PHONY: default all deps clean install test
include $(TOPDIR)/Make.version
%.a :
$(AR) -cvqs $@ $^
% : %.c
% : %.c
$(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
%-static : ccldflags+=-static
%-static : %.c
$(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
%.so :
$(CCLD) $(ccldflags) $(CPPFLAGS) $(SOFLAGS) \
-Wl,-soname,$@.$(MAJOR_VERSION) \
-o $@ $^ $(LDLIBS)
%.o : %.c
$(CC) $(cflags) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
%.static.o : %.c
$(CC) $(cflags) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
%.o : %.S
$(CC) $(cflags) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
%.static.o : %.S
$(CC) $(cflags) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
%.S: %.c
$(CC) $(cflags) $(CPPFLAGS) -S $< -o $@
%.E: %.c
$(CC) $(cflags) $(CPPFLAGS) -E $< -o $@
%.c : %.h
define substitute-version =
sed \
-e "s,@@VERSION@@,$(VERSION),g" \
-e "s,@@LIBDIR@@,$(libdir),g" \
$(1) > $(2)
endef
%.pc : %.pc.in
@$(call substitute-version,$<,$@)
%.spec : %.spec.in
@$(call substitute-version,$<,$@)
pkg-config-cflags = \
$(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --cflags $(PKGS); fi)
pkg-config-ldflags = \
$(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-L --libs-only-other $(PKGS) ; fi)
pkg-config-ldlibs = \
$(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-l $(PKGS) ; fi)
define deps-of =
$(foreach src,$(filter %.c,$(1)),$(patsubst %.c,.%.d,$(src))) \
$(foreach src,$(filter %.S,$(1)),$(patsubst %.S,.%.d,$(src)))
endef