2006-07-06 23:20:14 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2006-07-16 22:24:39 +00:00
|
|
|
# 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.
|
2006-07-06 23:20:14 +00:00
|
|
|
|
2006-07-16 22:24:39 +00:00
|
|
|
ifeq ($(NOISY_BUILD),)
|
|
|
|
ECHO_PREFIX=@
|
|
|
|
CMD_PREFIX=@
|
|
|
|
else
|
|
|
|
ECHO_PREFIX=@\#
|
|
|
|
CMD_PREFIX=
|
|
|
|
endif
|
2006-07-06 23:20:14 +00:00
|
|
|
|
|
|
|
define ast_make_o_c
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [CC] $$< -> $$@"
|
|
|
|
$(CMD_PREFIX) $$(CC) -o $$@ -c $$< $$(CFLAGS)
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_oo_cc
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [CXX] $$< -> $$@"
|
|
|
|
$(CMD_PREFIX) $$(CXX) -o $$@ -c $$< $$(CFLAGS)
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_c_y
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [BISON] $$< -> $$@"
|
|
|
|
$(CMD_PREFIX) bison -o $$@ -d --name-prefix=ast_yy $$<
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_c_fl
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [FLEX] $$< -> $$@"
|
|
|
|
$(CMD_PREFIX) flex -o $$@ --full $$<
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_so_o
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
|
|
|
|
$(CMD_PREFIX) $$(CC) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_so_oo
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [LDXX] $$^ -> $$@"
|
|
|
|
$(CMD_PREFIX) $$(CXX) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_a_o
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [AR] $$^ -> $$@"
|
|
|
|
$(CMD_PREFIX) $$(AR) cr $$@ $$^
|
|
|
|
$(CMD_PREFIX) $$(RANLIB) $$@
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_final
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
|
|
|
|
$(CMD_PREFIX) $$(CC) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
|
2006-07-06 23:20:14 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define ast_make_final_host
|
|
|
|
$(1): $(2)
|
2006-07-16 22:24:39 +00:00
|
|
|
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
|
|
|
|
$(CMD_PREFIX) $$(HOST_CC) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
|
2006-07-06 23:20:14 +00:00
|
|
|
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_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))
|