-
Notifications
You must be signed in to change notification settings - Fork 98
/
Make.rules
81 lines (57 loc) · 1.62 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
default : all
.PHONY: default all deps clean install
include $(TOPDIR)/Make.version
all : deps
deps :
clean :
install :
%.a : %.so
$(AR) -cvqs $@ $^
% : %.c
% : | %.c
$(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
%-static : %.c
$(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS)
%.so :
$(CCLD) $(ccldflags) $(CPPFLAGS) $(SOFLAGS) \
-Wl,-soname,$@.$(VERSION) \
-o $@ $^ $(LDLIBS)
%.o : %.c
$(CC) $(cflags) $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^)
%.S: %.c
$(CC) $(cflags) $(CPPFLAGS) -S $< -o $@
%.E: %.c
$(CC) $(cflags) $(CPPFLAGS) -E $< -o $@
%.c : %.h
.%.d :
define substitute-version =
sed \
-e "s,@@VERSION@@,$(VERSION),g" \
-e "s,@@LIBDIR@@,$(libdir),g" \
-e "s,@@LIBEXECDIR@@,$(libexecdir),g" \
-e "s,@@EFIDIR@@,$(EFIDIR),g" \
-e "s,@@EFI_LOADER@@,$(EFI_LOADER),g" \
-e 's,@@DEFAULT_LOADER@@,\\\\EFI\\\\$(EFIDIR)\\\\$(EFI_LOADER),g' \
$(1) > $(2)
endef
%.8 : %.8.in
@$(call substitute-version,$<,$@)
%.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)
objects-of = \
$(patsubst %.c,%.o,$(1))
define deps-of =
$(foreach src,$(filter %.c,$(1)),$(patsubst %.c,.%.d,$(src))) \
$(foreach src,$(filter %.S,$(1)),$(patsubst %.S,.%.d,$(src)))
endef
define get-config =
$(shell git config --local --get "efibootmgr.$(1)")
endef