000ba592b2
don't reuse LIBS variable from top-level Makefile (oops) build Asterisk binary after subdirs (preparing for embedded modules) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
69 lines
1.7 KiB
Makefile
69 lines
1.7 KiB
Makefile
#
|
|
# 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
|
|
#
|
|
|
|
include $(ASTTOPDIR)/Makefile.rules
|
|
|
|
define module_o_c_template
|
|
$(1).o: $(1).c
|
|
$(1).o: CFLAGS+=$$(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_INCLUDE))
|
|
endef
|
|
|
|
define module_oo_cc_template
|
|
$(1).oo: $(1).cc
|
|
$(1).oo: CFLAGS+=$$(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_INCLUDE))
|
|
endef
|
|
|
|
define module_so_o_template
|
|
$(1).so: $(1).o
|
|
$(1).so: LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
|
|
$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
|
|
endef
|
|
|
|
define module_so_oo_template
|
|
$(1).so: $(1).oo
|
|
$(1).so: LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
|
|
$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
|
|
endef
|
|
|
|
$(foreach mod,$(C_MODS),$(eval $(call module_o_c_template,$(mod))))
|
|
|
|
$(foreach mod,$(C_MODS),$(eval $(call module_so_o_template,$(mod))))
|
|
|
|
$(foreach mod,$(CC_MODS),$(eval $(call module_oo_cc_template,$(mod))))
|
|
|
|
$(foreach mod,$(CC_MODS),$(eval $(call module_so_oo_template,$(mod))))
|
|
|
|
.PHONY: clean clean-depend depend uninstall _all
|
|
|
|
_all: $(SELECTED_MODS:%=%.so)
|
|
|
|
clean-depend::
|
|
rm -f .depend
|
|
|
|
clean:: clean-depend
|
|
rm -f *.so *.o *.oo
|
|
|
|
install:: all
|
|
for x in $(SELECTED_MODS:%=%.so); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
|
|
|
|
uninstall::
|
|
|
|
ifneq ($(wildcard .depend),)
|
|
include .depend
|
|
endif
|
|
|
|
depend: .depend
|
|
|
|
.depend:
|
|
../build_tools/mkdep $(CFLAGS) `ls *.c`
|