aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.rules
blob: cdad748dfdc1d5ba2b414d6928c7643767d70970 (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
#
# 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
#

# Each command is preceded by a short comment on what to do.
# Prefixing one or the other with @\# or @ or nothing makes the desired
# behaviour. ECHO_PREFIX prefixes the comment, CMD_PREFIX prefixes the command.

-include $(ASTTOPDIR)/makeopts

ifeq ($(NOISY_BUILD),)
   ECHO_PREFIX=@
   CMD_PREFIX=@
else
   ECHO_PREFIX=@\# 
   CMD_PREFIX=
endif

ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
# More GSM codec optimization
# Uncomment to enable MMXTM optimizations for x86 architecture CPU's
# which support MMX instructions.  This should be newer pentiums,
# ppro's, etc, as well as the AMD K6 and K7.  
#K6OPT=-DK6OPT

OPTIMIZE?=-O6
ASTCFLAGS+=$(OPTIMIZE)
endif

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

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

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

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

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

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

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

define ast_make_final
$(1): $(2)
	$(ECHO_PREFIX) echo "   [LD] $$^ -> $$@"
	$(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(ASTLDFLAGS) $$^ $$(LIBS)
endef

define ast_make_final_host
$(1): $(2)
	$(ECHO_PREFIX) echo "   [LD] $$^ -> $$@"
	$(CMD_PREFIX) $$(HOST_CC) $$(STATIC_BUILD) -o $$@ $$(HOST_CFLAGS) $$(HOST_LDFLAGS) $$^ $$(LIBS)
endef

$(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_final,%,%.o))