File: Make.rules

package info (click to toggle)
linuxtv-dvb-apps 1.1.1+rev1500-1.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,644 kB
  • ctags: 6,793
  • sloc: ansic: 49,003; makefile: 785; perl: 236; sh: 110; xml: 13
file content (115 lines) | stat: -rw-r--r-- 2,697 bytes parent folder | download | duplicates (4)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# build rules for linuxtv.org dvb-apps

CFLAGS ?= -g -Wall -W -Wshadow -Wpointer-arith -Wstrict-prototypes

ifneq ($(lib_name),)

# additional rules for libraries

CFLAGS_LIB ?= -fPIC
CFLAGS += $(CFLAGS_LIB)

libraries = $(lib_name).so $(lib_name).a

.PHONY: library

library: $(libraries)

$(libraries): $(objects)

endif

prerequisites = $(subst .o,.d,$(objects)) $(addsuffix .d,$(binaries))

.PHONY: clean install

ifeq ($(static),1)
LDFLAGS += -static
endif

prefix ?= /usr

bindir     ?= $(prefix)/bin
includedir ?= $(prefix)/include
libdir     ?= $(prefix)/lib
sharedir   ?= $(prefix)/share
mandir     ?= $(prefix)/share/man/man1

ifneq ($(DESTDIR),)
DESTDIR := $(DESTDIR)/
endif

ifeq ($(V),1)
%.o: %.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -MMD -o $@ $< $(filter-out %.h %.c,$^)
%: %.o
	$(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
%: %.c
	$(CC) $(CPPFLAGS) $(CFLAGS) -MMD $(LDFLAGS) -o $@ $< $(filter-out %.h %.c,$^) $(LOADLIBES) $(LDLIBS)
%.so:
	$(CC) -shared $(LDFLAGS) -o $@ $^
%.a:
	$(AR) rcs $@ $^
clean::
	$(RM) -f $(prerequisites) $(objects) $(libraries) $(binaries) $(removing) *~
install::
ifneq ($(includes),)
	mkdir -p $(DESTDIR)$(includedir)/$(lib_name)
	install -m 644 $(includes) $(DESTDIR)$(includedir)/$(lib_name)/
endif
ifneq ($(libraries),)
	mkdir -p $(DESTDIR)$(libdir)
	install -m 644 $(libraries) $(DESTDIR)$(libdir)/
endif
ifneq ($(inst_bin),)
	mkdir -p $(DESTDIR)$(bindir)
	install -m 755 $(inst_bin) $(DESTDIR)$(bindir)/
endif
ifneq ($(inst_man),)
	@echo installing manpages
	@mkdir -p $(DESTDIR)$(mandir)
	@install -m 755 $(inst_man) $(DESTDIR)$(mandir)/
endif
else
%.o: %.c
	@echo CC $@
	@$(CC) -c $(CPPFLAGS) $(CFLAGS) -MMD -o $@ $< $(filter-out %.h %.c,$^)
%: %.o
	@echo CC $@
	@$(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
%: %.c
	@echo CC $@
	@$(CC) $(CPPFLAGS) $(CFLAGS) -MMD $(LDFLAGS) -o $@ $< $(filter-out %.h %.c,$^) $(LOADLIBES) $(LDLIBS)
%.so:
	@echo CC $@
	@$(CC) -shared $(LDFLAGS) -o $@ $^
%.a:
	@echo AR $@
	@$(AR) rcs $@ $^
clean::
	@echo cleaning
	@$(RM) -f $(prerequisites) $(objects) $(libraries) $(binaries) $(removing) *~
install::
ifneq ($(includes),)
	@echo installing headers
	@mkdir -p $(DESTDIR)$(includedir)/$(lib_name)
	@install -m 644 $(includes) $(DESTDIR)$(includedir)/$(lib_name)/
endif
ifneq ($(libraries),)
	@echo installing libraries
	@mkdir -p $(DESTDIR)$(libdir)
	@install -m 644 $(libraries) $(DESTDIR)$(libdir)/
endif
ifneq ($(inst_bin),)
	@echo installing binaries
	@mkdir -p $(DESTDIR)$(bindir)
	@install -m 755 $(inst_bin) $(DESTDIR)$(bindir)/
endif
ifneq ($(inst_man),)
	@echo installing manpages
	@mkdir -p $(DESTDIR)$(mandir)
	@install -m 755 $(inst_man) $(DESTDIR)$(mandir)/
endif
endif

-include $(prerequisites)