From 79283c8393effec5d9e1704a52b874994c67c936 Mon Sep 17 00:00:00 2001
From: danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Date: Sat, 6 Jun 2009 00:29:19 +0000
Subject: Makefile updates: Add "make help" and "make M=m_modname" to build an
 individual module

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11402 e03df62e-2008-0410-955e-edbf42e46eb7
---
 .Makefile.inc | 42 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 36 insertions(+), 6 deletions(-)

diff --git a/.Makefile.inc b/.Makefile.inc
index 3e60143f7..9a4f1d3a3 100644
--- a/.Makefile.inc
+++ b/.Makefile.inc
@@ -1,9 +1,9 @@
-#             InspIRCd Main Makefile
+#               InspIRCd Main Makefile
 #
-#     (C) InspIRCd Development Team, 2002-2009
+#       (C) InspIRCd Development Team, 2002-2009
 # This file is automagically generated by configure, from
-#    .Makefile.inc. Any changes made will go away! :P
-# Please do not edit unless you know what you're doing.
+#     .Makefile.inc. Any changes make will go away!
+#   Please do not edit unless you know what you're doing.
 #
 
 @GNU_ONLY COMPILE_ROOT = $(shell pwd)
@@ -47,6 +47,12 @@ INSTMODE = 0755
 @GNU_ONLY export COMPILE_ROOT RUNCC FLAGS NICEFLAGS CC LDLIBS MODULES MODPATH LIBPATH INSTMODE
 @BSD_ONLY MAKEARGS = -s 'RUNCC=${RUNCC}' 'FLAGS=${FLAGS}' 'NICEFLAGS=${NICEFLAGS}' 'CC=${CC}' 'LDLIBS=${LDLIBS}' 'MODULES=${MODULES}' 'MODPATH=${MODPATH}' 'LIBPATH=${LIBPATH}' 'INSTMODE=${INSTMODE}'
 
+# Default target
+
+@IFDEF M
+   _all: module
+@ENDIF
+
 all: ircd mods finishmessage
 
 debug:
@@ -110,7 +116,8 @@ install: ircd mods@EXTRA_DIR@
 	@echo "*************************************"
 
 module:
-	@${MAKE} -C src/modules $(MAKEARGS) ${name}
+	@BSD_ONLY @${MAKE} -C src/modules $(MAKEARGS) ${M:S/.so$//}.so
+	@GNU_ONLY @${MAKE} -C src/modules $(MAKEARGS) $(M:.so=).so
 
 clean:
 	@echo Cleaning...
@@ -147,4 +154,27 @@ configureclean:
 
 distclean: modclean clean configureclean
 
-.PHONY: all debug debug-header std-header ircd mods finishmessage install module clean modclean deinstall squeakyclean launchd_dir configureclean
+help:
+	@echo 'InspIRCd Makefile'
+	@echo ''
+	@echo 'Use: ${MAKE} [flags] [targets]'
+	@echo ''
+	@echo 'Flags:'
+	@echo ' V=1       Show the full command being executed instead of "BUILD: dns.cpp"'
+	@echo ' D=1       Enable debug build, for module development or crash tracing'
+	@echo ' -j <N>    Run a parallel build using N jobs'
+	@echo ''
+	@echo 'User targets:'
+	@echo ' all       Complete build of InspIRCd, without installing'
+	@echo ' install   Build and install InspIRCd to the directory chosen in ./configure'
+	@echo '           Currently installs to ${BASE}'
+	@echo ' debug     Compile a debug build. Equivalent to "make D=1 all"'
+	@echo ' module    Builds a single module, which is specified by "M=m_modname"'
+	@echo '           The command "make M=m_modname" is a shortcut for this target'
+	@echo ''
+	@echo ' clean     Cleans object files produced by the compile'
+	@echo ' distclean Cleans all files produced by compile and ./configure'
+	@echo ' deinstall Removes the files created by "make install"'
+	@echo
+
+.PHONY: all help debug debug-header std-header ircd mods finishmessage install module clean modclean deinstall squeakyclean launchd_dir configureclean
-- 
cgit v1.2.3