2 # Asterisk -- A telephony toolkit for Linux.
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 # Rules for various build phases.
15 # Each command is preceded by a short comment on what to do.
16 # Prefixing one or the other with @\# or @ or nothing makes the desired
17 # behaviour. ECHO_PREFIX prefixes the comment, CMD_PREFIX prefixes the command.
19 -include $(ASTTOPDIR)/makeopts
23 # extra cflags to build dependencies. Recursively expanded.
24 MAKE_DEPS= -MMD -MT $@ -MF .$(subst /,_,$@).d -MP
26 ifeq ($(NOISY_BUILD),)
34 ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
35 # More GSM codec optimization
36 # Uncomment to enable MMXTM optimizations for x86 architecture CPU's
37 # which support MMX instructions. This should be newer pentiums,
38 # ppro's, etc, as well as the AMD K6 and K7.
42 ASTCFLAGS+=$(OPTIMIZE)
45 # build rules for various targets
47 $(ECHO_PREFIX) echo " [CC] $< -> $@"
48 $(CMD_PREFIX) $(CC) -o $@ -c $< $(PTHREAD_CFLAGS) $(ASTCFLAGS) $(MAKE_DEPS)
51 $(ECHO_PREFIX) echo " [CCi] $< -> $@"
52 $(CMD_PREFIX) $(CC) -o $@ -c $< $(PTHREAD_CFLAGS) $(ASTCFLAGS) $(MAKE_DEPS)
55 $(ECHO_PREFIX) echo " [CPP] $< -> $@"
56 $(CMD_PREFIX) $(CC) -o $@ -E $< $(PTHREAD_CFLAGS) $(ASTCFLAGS) $(MAKE_DEPS)
59 $(ECHO_PREFIX) echo " [AS] $< -> $@"
60 $(CMD_PREFIX) $(CC) -o $@ -c $< $(PTHREAD_CFLAGS) $(ASTCFLAGS) $(MAKE_DEPS)
63 $(ECHO_PREFIX) echo " [CXX] $< -> $@"
64 $(CMD_PREFIX) $(CXX) -o $@ -c $< $(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_DECLARATION_AFTER_STATEMENT),$(ASTCFLAGS)) $(MAKE_DEPS)
67 $(ECHO_PREFIX) echo " [BISON] $< -> $@"
68 $(CMD_PREFIX) bison -o $@ -d --name-prefix=ast_yy $<
71 $(ECHO_PREFIX) echo " [FLEX] $< -> $@"
72 $(CMD_PREFIX) flex -o $@ --full $<
75 $(ECHO_PREFIX) echo " [LD] $^ -> $@"
76 $(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) $^ $(PTHREAD_LIBS) $(LIBS)
79 $(ECHO_PREFIX) echo " [LDXX] $^ -> $@"
80 $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $(SOLINK) $^ $(PTHREAD_LIBS) $(LIBS)
83 $(ECHO_PREFIX) echo " [EMBED] $< -> $@"
84 $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_eo_script $* > .$@.ld
85 $(CMD_PREFIX) $(LD) -r -T .$@.ld -o $@ $<
86 $(CMD_PREFIX) rm -f .$@.ld
89 $(ECHO_PREFIX) echo " [EMBED] $< -> $@"
90 $(CMD_PREFIX) $(ASTTOPDIR)/build_tools/make_linker_eo_script $* > .$@.ld
91 $(CMD_PREFIX) $(LD) -r -T .$@.ld -o $@ $<
92 $(CMD_PREFIX) rm -f .$@.ld
95 $(ECHO_PREFIX) echo " [LD] $^ -> $@"
96 $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(PTHREAD_CFLAGS) $(ASTLDFLAGS) $^ $(PTHREAD_LIBS) $(LIBS)