File: Make.rules

package info (click to toggle)
efivar 37-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,320 kB
  • sloc: ansic: 10,423; makefile: 229; asm: 31
file content (90 lines) | stat: -rw-r--r-- 2,100 bytes parent folder | download
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
82
83
84
85
86
87
88
89
90
default : all

.PHONY: default all 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,$@.1 \
	  -Wl,--version-script=$(MAP) \
	  -o $@ $^ $(LDLIBS)
	ln -vfs $@ $@.1

%.abixml : %.so
	$(ABIDW) --headers-dir $(TOPDIR)/src/include/efivar/ --out-file $@ $^
	@sed -i -s 's,$(TOPDIR)/,,g' $@

%.abicheck : %.so
	$(ABIDIFF) \
		--suppr abignore \
		--headers-dir2 $(TOPDIR)/src/include/efivar/ \
		$(patsubst %.so,%.abixml,$<) \
		$<

%.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"		\
		-e "s,@@PREFIX@@,$(PREFIX),g"		\
		-e "s,@@EXEC_PREFIX@@,$(EXEC_PREFIX),g"		\
		-e "s,@@INCLUDEDIR@@,$(INCLUDEDIR),g"		\
		$(1) > $(2)
endef

%.pc : %.pc.in
	@$(call substitute-version,$<,$@)
%.spec : %.spec.in
	@$(call substitute-version,$<,$@)
%.map : %.map.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

define get-config
$(shell git config --local --get "efivar.$(1)")
endef

# vim:ft=make