![kpfleming](/assets/img/avatar_default.png)
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r44055 | kpfleming | 2006-09-29 17:47:40 -0500 (Fri, 29 Sep 2006) | 2 lines fix a few build system bugs, and convert Makefiles to be compatible with GNU make 3.80 ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44056 f38db490-d61c-443f-a65b-d21fe96a405b
90 lines
2.7 KiB
Makefile
90 lines
2.7 KiB
Makefile
#
|
|
# Asterisk -- A telephony toolkit for Linux.
|
|
#
|
|
# Makefile rules for subdirectories containing modules
|
|
#
|
|
# 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
|
|
#
|
|
|
|
ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
|
|
ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
|
|
endif
|
|
|
|
ifeq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
|
|
ASTCFLAGS+=${GC_CFLAGS}
|
|
endif
|
|
|
|
ifneq ($(findstring STATIC_BUILD,$(MENUSELECT_CFLAGS)),)
|
|
STATIC_BUILD=-static
|
|
endif
|
|
|
|
include $(ASTTOPDIR)/Makefile.rules
|
|
|
|
comma:=,
|
|
|
|
$(addsuffix .o,$(C_MODS)): ASTCFLAGS+=-DAST_MODULE=\"$*\" $(MENUSELECT_OPTS_$*:%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_INCLUDE))
|
|
$(addsuffix .oo,$(CC_MODS)): ASTCFLAGS+=-DAST_MODULE=\"$*\" $(MENUSELECT_OPTS_$*:%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_INCLUDE))
|
|
|
|
$(LOADABLE_MODS:%=%.so): ASTCFLAGS+=-fPIC
|
|
$(LOADABLE_MODS:%=%.so): LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_LIB))
|
|
$(LOADABLE_MODS:%=%.so): ASTLDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$*),$(value $(dep)_LDFLAGS))
|
|
|
|
$(addsuffix .so,$(filter $(LOADABLE_MODS),$(C_MODS))): %.so: %.o
|
|
$(addsuffix .so,$(filter $(LOADABLE_MODS),$(CC_MODS))): %.so: %.oo
|
|
|
|
modules.link: $(addsuffix .o,$(filter $(EMBEDDED_MODS),$(C_MODS)))
|
|
modules.link: $(addsuffix .oo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
|
|
|
|
.PHONY: clean clean-depend depend uninstall _all
|
|
|
|
ifneq ($(LOADABLE_MODS),)
|
|
_all: $(LOADABLE_MODS:%=%.so)
|
|
endif
|
|
|
|
ifneq ($(EMBEDDED_MODS),)
|
|
_all: modules.link
|
|
__embed_ldscript:
|
|
@echo "../$(SUBDIR)/modules.link"
|
|
__embed_ldflags:
|
|
@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
|
|
@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
|
|
__embed_libs:
|
|
@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
|
|
@echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
|
|
else
|
|
__embed_ldscript:
|
|
__embed_ldflags:
|
|
__embed_libs:
|
|
endif
|
|
|
|
modules.link:
|
|
@rm -f $@
|
|
@for file in $(patsubst %,$(SUBDIR)/%,$(filter %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
|
|
@for file in $(patsubst %,$(SUBDIR)/%,$(filter-out %.o,$^)); do echo "INPUT (../$${file})" >> $@; done
|
|
|
|
clean-depend::
|
|
rm -f .depend
|
|
|
|
clean:: clean-depend
|
|
rm -f *.so *.o *.oo
|
|
rm -f modules.link
|
|
|
|
install:: all
|
|
for x in $(LOADABLE_MODS:%=%.so); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
|
|
|
|
uninstall::
|
|
|
|
ifneq ($(wildcard .depend),)
|
|
include .depend
|
|
endif
|
|
|
|
depend: .depend
|
|
|
|
.depend:
|
|
../build_tools/mkdep $(ASTCFLAGS) `ls *.c *.cc 2> /dev/null`
|