oops... missed one
[asterisk-bristuff.git] / Makefile.rules
blob02eed1fdd63a4479793524b4b50d9356dbb2bb3e
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Makefile rules
6 # Copyright (C) 2006, Digium, Inc.
8 # Kevin P. Fleming <kpfleming@digium.com>
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
14 # Each command is preceded by a short comment on what to do.
15 # Prefixing one or the other with @\# or @ or nothing makes the desired
16 # behaviour. ECHO_PREFIX prefixes the comment, CMD_PREFIX prefixes the command.
18 include $(ASTTOPDIR)/makeopts
20 ifeq ($(NOISY_BUILD),)
21    ECHO_PREFIX=@
22    CMD_PREFIX=@
23 else
24    ECHO_PREFIX=@\# 
25    CMD_PREFIX=
26 endif
28 ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
29 # More GSM codec optimization
30 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
31 # which support MMX instructions.  This should be newer pentiums,
32 # ppro's, etc, as well as the AMD K6 and K7.  
33 #K6OPT=-DK6OPT
35 OPTIMIZE?=-O6
36 CFLAGS+=$(OPTIMIZE)
37 endif
39 define ast_make_o_c
40 $(1): $(2)
41         $(ECHO_PREFIX) echo "   [CC] $$< -> $$@"
42         $(CMD_PREFIX) $$(CC) -o $$@ -c $$< $$(CFLAGS)
43 endef
45 define ast_make_oo_cc
46 $(1): $(2)
47         $(ECHO_PREFIX) echo "   [CXX] $$< -> $$@"
48         $(CMD_PREFIX) $$(CXX) -o $$@ -c $$< $$(CFLAGS)
49 endef
51 define ast_make_c_y
52 $(1): $(2)
53         $(ECHO_PREFIX) echo "   [BISON] $$< -> $$@"
54         $(CMD_PREFIX) bison -o $$@ -d --name-prefix=ast_yy $$<
55 endef
57 define ast_make_c_fl
58 $(1): $(2)
59         $(ECHO_PREFIX) echo "   [FLEX] $$< -> $$@"
60         $(CMD_PREFIX) flex -o $$@ --full $$<
61 endef
63 define ast_make_so_o
64 $(1): $(2)
65         $(ECHO_PREFIX) echo "   [LD] $$^ -> $$@"
66         $(CMD_PREFIX) $$(CC) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
67 endef
69 define ast_make_so_oo
70 $(1): $(2)
71         $(ECHO_PREFIX) echo "   [LDXX] $$^ -> $$@"
72         $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
73 endef
75 define ast_make_a_o
76 $(1): $(2)
77         $(ECHO_PREFIX) echo "   [AR] $$^ -> $$@"
78         $(CMD_PREFIX) $$(AR) cr $$@ $$^
79         $(CMD_PREFIX) $$(RANLIB) $$@
80 endef
82 define ast_make_final
83 $(1): $(2)
84         $(ECHO_PREFIX) echo "   [LD] $$^ -> $$@"
85         $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
86 endef
88 define ast_make_final_host
89 $(1): $(2)
90         $(ECHO_PREFIX) echo "   [LD] $$^ -> $$@"
91         $(CMD_PREFIX) $$(HOST_CC) $$(STATIC_BUILD) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
92 endef
94 $(eval $(call ast_make_o_c,%.o,%.c))
96 $(eval $(call ast_make_oo_cc,%.oo,%.cc))
98 $(eval $(call ast_make_so_o,%.so,%.o))
100 $(eval $(call ast_make_final,%,%.o))