aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.rules
blob: 4982b2d3bfd6631b6874fbe49a7c93704f983c47 (plain)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# Asterisk -- A telephony toolkit for Linux.
# 
# Makefile rules
#
# Copyright (C) 2006, Digium, Inc.
#
# Kevin P. Fleming <kpfleming@digium.com>
#
# This program is free software, distributed under the terms of
# the GNU General Public License
#

ifeq ($(NOISY_BUILD),)

define ast_make_o_c
$(1): $(2)
	@echo "   [CC] $$< -> $$@"
	@$$(CC) -o $$@ -c $$< $$(CFLAGS)
endef

define ast_make_oo_cc
$(1): $(2)
	@echo "   [CXX] $$< -> $$@"
	@$$(CXX) -o $$@ -c $$< $$(CFLAGS)
endef

define ast_make_c_y
$(1): $(2)
	@echo "   [BISON] $$< -> $$@"
	@bison -o $$@ -d --name-prefix=ast_yy $$<
endef

define ast_make_c_fl
$(1): $(2)
	@echo "   [FLEX] $$< -> $$@"
	@flex -o $$@ --full $$<
endef

define ast_make_so_o
$(1): $(2)
	@echo "   [LD] $$^ -> $$@"
	@$$(CC) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
endef

define ast_make_so_oo
$(1): $(2)
	@echo "   [LDXX] $$^ -> $$@"
	@$$(CXX) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
endef

define ast_make_a_o
$(1): $(2)
	@echo "   [AR] $$^ -> $$@"
	@$$(AR) cr $$@ $$^
	@$$(RANLIB) $$@
endef

define ast_make_final
$(1): $(2)
	@echo "   [LD] $$^ -> $$@"
	@$$(CC) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
endef

define ast_make_final_host
$(1): $(2)
	@echo "   [LD] $$^ -> $$@"
	@$$(HOST_CC) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
endef

else

define ast_make_o_c
$(1): $(2)
	$$(CC) -o $$@ -c $$< $$(CFLAGS)
endef

define ast_make_oo_cc
$(1): $(2)
	$$(CXX) -o $$@ -c $$< $$(CFLAGS)
endef

define ast_make_c_y
$(1): $(2)
	bison -o $$@ -d --name-prefix=ast_yy $$<
endef

define ast_make_c_fl
$(1): $(2)
	flex -o $$@ --full $$<
endef

define ast_make_so_o
$(1): $(2)
	$$(CC) -o $$@ $$(LDFAGS) $$(SOLINK) $$^ $$(LIBS)
endef

define ast_make_so_oo
$(1): $(2)
	$$(CXX) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
endef

define ast_make_a_o
$(1): $(2)
	$$(AR) cr $$@ $$^
	$$(RANLIB) $$@
endef

define ast_make_final
$(1): $(2)
	$$(CC) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
endef

define ast_make_final_host
$(1): $(2)
	$$(HOST_CC) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
endef

endif

$(eval $(call ast_make_o_c,%.o,%.c))

$(eval $(call ast_make_oo_cc,%.oo,%.cc))

$(eval $(call ast_make_so_o,%.so,%.o))

$(eval $(call ast_make_so_oo,%.so,%.oo))

$(eval $(call ast_make_final,%,%.o))

$(eval $(call ast_make_c_y,%.c,%.y))

$(eval $(call ast_make_c_fl,%.c,%.fl))