Merged revisions 80166 via svnmerge from
[asterisk/asterisk.git] / Makefile.moddir_rules
index 6925636..1c78ebd 100644 (file)
@@ -12,7 +12,9 @@
 #
 
 ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
+ ifeq ($(findstring astmm.h,$(ASTCFLAGS)),)
   ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
+ endif
 endif
 
 ifeq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
@@ -34,13 +36,15 @@ $(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))
 
+$(EMBEDDED_MODS:%=%.o): ASTCFLAGS+=-DEMBEDDED_MODULE=$*
+
 $(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)))
+modules.link: $(addsuffix .eo,$(filter $(EMBEDDED_MODS),$(C_MODS)))
+modules.link: $(addsuffix .eoo,$(filter $(EMBEDDED_MODS),$(CC_MODS)))
 
-.PHONY: clean clean-depend depend uninstall _all
+.PHONY: clean uninstall _all
 
 ifneq ($(LOADABLE_MODS),)
 _all: $(LOADABLE_MODS:%=%.so)
@@ -64,14 +68,12 @@ 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
+       @for file in $(patsubst %,$(SUBDIR)/%,$(filter %.eo %.eoo,$^)); do echo "INPUT (../$${file})" >> $@; done
+       @for file in $(patsubst %,$(SUBDIR)/%,$(filter-out %.eo %.eoo,$^)); do echo "INPUT (../$${file})" >> $@; done
 
-clean:: clean-depend
-       rm -f *.so *.o *.oo
+clean::
+       rm -f *.so *.o *.oo *.eo *.eoo
+       rm -f .*.o.d .*.oo.d
        rm -f modules.link
 
 install:: all
@@ -79,11 +81,6 @@ install:: all
 
 uninstall::
 
-ifneq ($(wildcard .depend),)
-  include .depend
+ifneq ($(wildcard .*.d),)
+   include .*.d
 endif
-
-depend: .depend
-
-.depend:
-       ../build_tools/mkdep $(ASTCFLAGS) `ls *.c *.cc 2> /dev/null`