Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Fri, 29 Jun 2001 02:47:26 +0000 (02:47 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Fri, 29 Jun 2001 02:47:26 +0000 (02:47 +0000)
Log message:

Makefile (build system) tuning: create directories before installing into
them; detect changes to sub-Makefiles and rebuild them properly; tuning to
permit VPATH operation.

VPATH operation is a very useful tool for developers and individuals who
need to compile from the same source tree on multiple platforms; it allows
you to build the server from a directory other than your source directory.
Simplest way to do it is create your build directory, cd into it, then use
something like ../relative/path/to/ircu2.10/configure.  The configure
script will build the Makefiles and necessary directories in the current
directory.  Caveat: "make depend" will not work properly with VPATH for two
basic reasons: chattr.tab.c will be missing; and the dependancies generated
will be relative paths into your source directory.  The latter can be
corrected by changing the -I flags fed to the gcc -MM invocation; the
former might be corrected by substituting <> for "" in ircd_string.c.
Realistically, the whole "make depend" infrastructure should probably be
rototilled, but I think I'll just move us to automake in u2.10.12.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@522 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
Makefile.in
doc/Makefile.in
ircd/Makefile.in

index c4534ae750cfb87c2a4ba5a3e0e2eb3f4035f398..75257b534ec276dcd8ea4421833d3ca7ebec65f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2001-06-28  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/Makefile.in: tune for VPATH builds/installs; add a rule to
+       force bin directory to be created if necessary prior to
+       installation; run make depend
+
+       * doc/Makefile.in (install): tune for VPATH installs by cd'ing to
+       the ${srcdir}
+
+       * Makefile.in: tune to detect Makefile.in changes in
+       subdirectories and to create installation directory indicated by
+       ${prefix}
+
        * ircd/whocmds.c (count_users): routine to count the number of
        users matching a given user@host mask
 
index cd9497b46e9ec73e49a597d70a65e6f9611add37..0ab281d38103ef119b38ec0f441ed6b322c35332 100644 (file)
@@ -18,6 +18,7 @@
 
 #### Start of system configuration section. ####
 
+prefix = @prefix@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
@@ -28,6 +29,7 @@ AWK = @AWK@
 #### End of system configuration section. ####
 
 SUBDIRS = doc ircd
+MAKEFILES = Makefile doc/Makefile ircd/Makefile
 
 all: build
 
@@ -35,7 +37,7 @@ all: build
 # Some versions of make give a warning when this is empty:
 .SUFFIXES: .dummy
 
-build:
+build: ${MAKEFILES}
        @for i in ${SUBDIRS}; do \
                echo "Building $$i..."; \
                cd $$i; ${MAKE} build; cd ..; \
@@ -61,7 +63,7 @@ root-clean:
                test -n "$$REMOVE_FILES" && ${RM} -f $$REMOVE_FILES; \
        done || true
 
-sub-clean:
+sub-clean: ${MAKEFILES}
        @for i in ${SUBDIRS}; do \
                echo "Cleaning $$i..."; \
                cd $$i; ${MAKE} clean; cd ..;\
@@ -76,7 +78,7 @@ root-distclean: root-clean
                test -n "$$REMOVE_FILES" && ${RM} -f $$REMOVE_FILES; \
        done || true
 
-sub-distclean:
+sub-distclean: ${MAKEFILES}
        @for i in ${SUBDIRS}; do \
                echo "Dist-cleaning $$i..."; \
                cd $$i; ${MAKE} distclean; cd ..;\
@@ -86,25 +88,26 @@ distclean: root-distclean sub-distclean
        ${RM} -f Makefile config.h config.log config.cache config.status \
                stamp-h
 
-maintainer-clean: root-distclean
+maintainer-clean: root-distclean ${MAKEFILES}
        @for i in ${SUBDIRS}; do \
                echo "maintainer-cleaning $$i..."; \
                cd $$i; ${MAKE} maintainer-clean; cd ..;\
        done
 
-depend:
+depend: ${MAKEFILES}
        @for i in ${SUBDIRS}; do \
                echo "Making dependencies in $$i..."; \
                cd $$i; ${MAKE} depend; cd ..; \
        done
 
-install:
+install: ${MAKEFILES}
+       test -d ${prefix} || mkdir ${prefix}
        @for i in ${SUBDIRS}; do \
                echo "Installing $$i..."; \
                cd $$i; ${MAKE} install; cd ..; \
        done
 
-uninstall:
+uninstall: ${MAKEFILES}
        @for i in ${SUBDIRS}; do \
                echo "Uninstalling $$i..."; \
                cd $$i; ${MAKE} uninstall; cd ..; \
index 90645160c9c3258058cd3d9efc1af1e6373afc13..c4f7c8f8b7078f111028d78f53c82ace6a249bbd 100644 (file)
@@ -45,7 +45,7 @@ maintainer-clean: distclean
 depend:
 
 install:
-       (test -d ${MANDIR}/man8 || mkdir ${MANDIR}/man8 || mkdir -p ${MANDIR}/man8) 2> /dev/null && ${INSTALL} -m 644 ircd.8 ${MANDIR}/man8
+       cd ${srcdir} && (test -d ${MANDIR}/man8 || mkdir ${MANDIR}/man8 || mkdir -p ${MANDIR}/man8) 2> /dev/null && ${INSTALL} -m 644 ircd.8 ${MANDIR}/man8
 
 uninstall:
        ${RM} -f ${MANDIR}/man8/ircd.8
index abc2f5b3217db7f8405392b10f22bb1680e8ce4c..d803749d93be03d1799b63d6111fd7b15cb4de06 100644 (file)
@@ -55,7 +55,7 @@ RPATH = ${DPATH}/remote.motd
 
 CC = @CC@
 CFLAGS = @CFLAGS@
-CPPFLAGS = -I.. -I${top_srcdir}/include @CPPFLAGS@
+CPPFLAGS = -I. -I.. -I${top_srcdir}/include @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 
@@ -227,7 +227,7 @@ ircd: ${OBJS} ../include/patchlevel.h version.o
 # only that one sum?
 #
 version.c: version.c.SH s_serv.c s_user.c channel.c s_bsd.c s_misc.c ircd.c
-       ${SHELL} version.c.SH
+       ${SHELL} ${srcdir}/version.c.SH
 
 ircd_string.o: ircd_string.c chattr.tab.c
 
@@ -238,15 +238,19 @@ chattr.tab.c: table_gen
        ./table_gen > chattr.tab.c
 
 chkcrule.o: crule.c
-       ${CC} ${CFLAGS} ${CPPFLAGS} -DCR_CHKCONF -o chkcrule.o -c crule.c
+       ${CC} ${CFLAGS} ${CPPFLAGS} -DCR_CHKCONF -o chkcrule.o -c \
+               ${srcdir}/crule.c
 
 chkconf: chkconf.o fda.o match.o chkcrule.o ircd_alloc.o fileio.o ircd_string.o
        ${CC} chkconf.o fda.o match.o chkcrule.o ircd_alloc.o fileio.o \
        ircd_string.o ${LDFLAGS} ${LIBS} -o chkconf
 
+mkbindir:
+       @test -d ${BINDIR} || mkdir ${BINDIR}
+
 install: ${INSTALL_RULE}
 
-install-with-symlink: build
+install-with-symlink: build mkbindir
        @if [ ! -d ${DPATH} -a ! -f ${DPATH} ]; then \
          echo "Creating directory ${DPATH}"; \
          ${MKDIR} ${DPATH}; \
@@ -262,14 +266,14 @@ install-with-symlink: build
          ${LN_S} ircd.`cat /tmp/ircd.tag` ${SYMLINK}; )
        @${RM} /tmp/ircd.tag
        ${INSTALL} -s -m 700 -o ${IRCDOWN} -g ${IRCDGRP} chkconf ${BINDIR}
-       ${INSTALL} -m 600 -o ${IRCDOWN} -g ${IRCDGRP} ../doc/example.conf ${DPATH}
+       ${INSTALL} -m 600 -o ${IRCDOWN} -g ${IRCDGRP} ${top_srcdir}/doc/example.conf ${DPATH}
 #      ( cd ${DPATH}; \
 #        ${TOUCH} ${MPATH}; \
 #        ${TOUCH} ${RPATH}; \
 #        ${CHOWN} ${IRCDOWN} ${MPATH} ${RPATH}; \
 #        ${CHGRP} ${IRCDGRP} ${MPATH} ${RPATH}; )
 
-install-no-symlink: build
+install-no-symlink: build mkbindir
        @if [ ! -d ${DPATH} -a ! -f ${DPATH} ]; then \
          echo "Creating directory ${DPATH}"; \
          ${MKDIR} ${DPATH}; \
@@ -280,7 +284,7 @@ install-no-symlink: build
        @echo "Installing new ircd as ${BINDIR}/ircd :"
        ${INSTALL} -m ${IRCDMODE} -o ${IRCDOWN} -g ${IRCDGRP} ircd ${BINDIR}/ircd
        ${INSTALL} -s -m 700 -o ${IRCDOWN} -g ${IRCDGRP} chkconf ${BINDIR}
-       ${INSTALL} -m 600 -o ${IRCDOWN} -g ${IRCDGRP} ../doc/example.conf ${DPATH}
+       ${INSTALL} -m 600 -o ${IRCDOWN} -g ${IRCDGRP} ${top_srcdir}/doc/example.conf ${DPATH}
 #      ( cd ${DPATH}; \
 #        ${TOUCH} ${MPATH}; \
 #        ${TOUCH} ${RPATH}; \
@@ -305,7 +309,8 @@ maintainer-clean: distclean
 # If I read this right, this will only work with gcc.  Still, how many admins
 # are going to be doing "make depend"?
 depend:
-       @if [ -f Makefile.in.bak ]; then \
+       @cd ${srcdir}; \
+       if [ -f Makefile.in.bak ]; then \
          echo "make depend: First remove ircd/Makefile.in.bak"; \
        else \
          ( ${MV} Makefile.in Makefile.in.bak; \
@@ -381,11 +386,13 @@ gline.o: gline.c ../config.h ../include/gline.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/ircd.h \
  ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \
- ../include/ircd_log.h ../include/ircd_reply.h \
- ../include/ircd_string.h ../include/ircd_chattr.h ../include/match.h \
- ../include/numeric.h ../include/s_bsd.h ../include/s_debug.h \
- ../include/s_misc.h ../include/send.h ../include/support.h \
- ../include/msg.h ../include/numnicks.h ../include/sys.h
+ ../include/ircd_features.h ../include/ircd_log.h \
+ ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_snprintf.h ../include/ircd_string.h \
+ ../include/ircd_chattr.h ../include/match.h ../include/numeric.h \
+ ../include/s_bsd.h ../include/s_debug.h ../include/s_misc.h \
+ ../include/send.h ../include/support.h ../include/msg.h \
+ ../include/numnicks.h ../include/sys.h ../include/whocmds.h
 hash.o: hash.c ../config.h ../include/hash.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h \
@@ -463,11 +470,12 @@ jupe.o: jupe.c ../config.h ../include/jupe.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/hash.h \
  ../include/ircd.h ../include/struct.h ../include/ircd_alloc.h \
- ../include/fda.h ../include/ircd_log.h ../include/ircd_reply.h \
- ../include/ircd_string.h ../include/ircd_chattr.h ../include/match.h \
- ../include/msg.h ../include/numeric.h ../include/numnicks.h \
- ../include/s_bsd.h ../include/s_misc.h ../include/send.h \
- ../include/support.h ../include/sys.h
+ ../include/fda.h ../include/ircd_log.h ../include/ircd_policy.h \
+ ../include/ircd_reply.h ../include/ircd_string.h \
+ ../include/ircd_chattr.h ../include/match.h ../include/msg.h \
+ ../include/numeric.h ../include/numnicks.h ../include/s_bsd.h \
+ ../include/s_misc.h ../include/send.h ../include/support.h \
+ ../include/sys.h
 list.o: list.c ../config.h ../include/list.h ../include/client.h \
  ../include/ircd_defs.h ../include/dbuf.h ../include/msgq.h \
  ../include/ircd_events.h ../include/ircd_handler.h ../include/ircd.h \
@@ -1155,19 +1163,18 @@ s_user.o: s_user.c ../config.h ../include/s_user.h \
  ../include/IPcheck.h ../include/channel.h ../include/ircd_defs.h \
  ../include/class.h ../include/client.h ../include/dbuf.h \
  ../include/msgq.h ../include/ircd_events.h ../include/ircd_handler.h \
- ../include/gline.h ../include/hash.h ../include/ircd.h \
- ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \
- ../include/ircd_chattr.h ../include/ircd_features.h \
- ../include/ircd_log.h ../include/ircd_policy.h \
- ../include/ircd_reply.h ../include/ircd_string.h ../include/list.h \
- ../include/match.h ../include/motd.h ../include/msg.h \
- ../include/numeric.h ../include/numnicks.h ../include/parse.h \
- ../include/querycmds.h ../include/random.h ../include/s_bsd.h \
- ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \
- ../include/s_serv.h ../include/send.h ../include/sprintf_irc.h \
- ../include/support.h ../include/supported.h ../include/sys.h \
- ../include/userload.h ../include/version.h ../include/whowas.h \
- ../include/handlers.h
+ ../include/hash.h ../include/ircd.h ../include/struct.h \
+ ../include/ircd_alloc.h ../include/fda.h ../include/ircd_chattr.h \
+ ../include/ircd_features.h ../include/ircd_log.h \
+ ../include/ircd_policy.h ../include/ircd_reply.h \
+ ../include/ircd_string.h ../include/list.h ../include/match.h \
+ ../include/motd.h ../include/msg.h ../include/numeric.h \
+ ../include/numnicks.h ../include/parse.h ../include/querycmds.h \
+ ../include/random.h ../include/s_bsd.h ../include/s_conf.h \
+ ../include/s_debug.h ../include/s_misc.h ../include/s_serv.h \
+ ../include/send.h ../include/sprintf_irc.h ../include/support.h \
+ ../include/supported.h ../include/sys.h ../include/userload.h \
+ ../include/version.h ../include/whowas.h ../include/handlers.h
 send.o: send.c ../config.h ../include/send.h ../include/channel.h \
  ../include/ircd_defs.h ../include/class.h ../include/client.h \
  ../include/dbuf.h ../include/msgq.h ../include/ircd_events.h \
@@ -1205,7 +1212,8 @@ whocmds.o: whocmds.c ../config.h ../include/whocmds.h \
  ../include/channel.h ../include/ircd_defs.h ../include/client.h \
  ../include/dbuf.h ../include/msgq.h ../include/ircd_events.h \
  ../include/ircd_handler.h ../include/hash.h ../include/ircd.h \
- ../include/struct.h ../include/ircd_chattr.h ../include/ircd_reply.h \
+ ../include/struct.h ../include/ircd_chattr.h ../include/ircd_policy.h \
+ ../include/ircd_reply.h ../include/ircd_snprintf.h \
  ../include/ircd_string.h ../include/list.h ../include/match.h \
  ../include/numeric.h ../include/numnicks.h ../include/querycmds.h \
  ../include/ircd_features.h ../include/random.h ../include/s_bsd.h \