Module: sip-router
Branch: master
Commit: c6f75a7e56f02abd271649797d2fa1db91ee1b16
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c6f75a7…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Apr 23 15:44:41 2009 +0200
makefiles: added Makefile.utils
- added Makefile.utils
- updated utils/{gen_ha1,sercmd} to use it
---
Makefile.utils | 81 ++++++++++++++++++++++++++++++++++++++++++++++++
utils/gen_ha1/Makefile | 6 +---
utils/sercmd/Makefile | 9 ++---
3 files changed, 86 insertions(+), 10 deletions(-)
diff --git a/Makefile.utils b/Makefile.utils
new file mode 100644
index 0000000..8c31594
--- /dev/null
+++ b/Makefile.utils
@@ -0,0 +1,81 @@
+#
+# $Id$
+#
+# utils Makefile
+#(to be included from each util/ subdirectory)
+#
+# History:
+# --------
+# 2009-04-23 initial version derived from Makefile.modules (andrei)
+
+
+# default path to the core makefiles
+COREPATH ?=../..
+
+ALLDEP=Makefile $(COREPATH)/Makefile.sources $(COREPATH)/Makefile.rules \
+ $(COREPATH)/Makefile.utils $(COREPATH)/Makefile.dirs $(COREPATH)/config.mak
+
+#override modules value, an util cannot have submodules
+override modules=
+override static_modules=
+override static_modules_path=
+
+ifneq ($(makefile_defs_included),1)
+$(error "the local makefile does not include Makefile.defs!")
+endif
+
+ifeq ($(MAKELEVEL), 0)
+# make called directly in the module dir!
+
+else
+# called by the main Makefile
+
+ALLDEP+=$(COREPATH)/Makefile
+
+endif
+
+include $(COREPATH)/Makefile.sources
+
+
+# if config was not loaded (makefile_defs!=1) ignore
+# the rest of makefile and try only to remake the config
+ifeq ($(makefile_defs),1)
+
+
+include $(COREPATH)/Makefile.dirs
+include $(COREPATH)/Makefile.targets
+include $(COREPATH)/Makefile.rules
+
+modules:
+
+# README build rules
+ifneq (,$(wildcard doc/Makefile))
+#doc/Makefile present => we can generate README
+
+README: doc/*.xml
+ $(MAKE) -C doc $(MOD_NAME).txt
+ mv doc/$(MOD_NAME).txt $@
+
+else
+# do nothing
+
+README:
+endif
+
+#man page build rules
+ifneq (,$(wildcard $(MOD_NAME).xml))
+
+$(MOD_NAME).7: $(MOD_NAME).xml
+ docbook2x-man -s ../../doc/stylesheets/serdoc2man.xsl $<
+
+man: $(MOD_NAME).7
+
+else
+
+man:
+
+endif
+
+endif # ifeq($(makefile_defs),1)
+
+include $(COREPATH)/Makefile.cfg
diff --git a/utils/gen_ha1/Makefile b/utils/gen_ha1/Makefile
index 92c3553..79e4d58 100644
--- a/utils/gen_ha1/Makefile
+++ b/utils/gen_ha1/Makefile
@@ -10,8 +10,4 @@ NAME=gen_ha1
LIBS=../../md5.o
-include ../../Makefile.sources
-include ../../Makefile.targets
-include ../../Makefile.rules
-
-modules:
+include ../../Makefile.utils
diff --git a/utils/sercmd/Makefile b/utils/sercmd/Makefile
index a70260d..b762ab6 100644
--- a/utils/sercmd/Makefile
+++ b/utils/sercmd/Makefile
@@ -1,7 +1,7 @@
# $Id$
-
-include ../../Makefile.defs
-include ../../Makefile.targets
+COREPATH=../..
+include $(COREPATH)/Makefile.defs
+include $(COREPATH)/Makefile.targets
auto_gen=
NAME=sercmd
@@ -43,8 +43,7 @@ ifeq ($(use_readline),1)
endif
-include ../../Makefile.sources
-include ../../Makefile.rules
+include $(COREPATH)/Makefile.utils
ifeq (,$(quiet))
ifeq ($(use_readline),1)