From a564545f75483548eead671c2df7ead96106db83 Mon Sep 17 00:00:00 2001 From: imaginos Date: Wed, 30 Mar 2005 18:49:14 +0000 Subject: [PATCH] moving to standard makefile system, and cpp only extension git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@46 726aef4b-f618-498e-8847-2d620e286838 --- Makefile.in | 5 +-- configure | 8 +--- configure.in | 6 +-- modules/Makefile.in | 28 +++++++++++++ modules/buildmod.in | 70 --------------------------------- modules/{email.cc => email.cpp} | 7 +++- 6 files changed, 38 insertions(+), 86 deletions(-) create mode 100644 modules/Makefile.in delete mode 100644 modules/buildmod.in rename modules/{email.cc => email.cpp} (97%) diff --git a/Makefile.in b/Makefile.in index 616c7ccb..f35b65fa 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,7 +13,6 @@ SRCS=main.cpp znc.cpp User.cpp IRCSock.cpp UserSock.cpp DCCBounce.cpp DCCSock.cp all: znc @MODTARGET@ depend:: - cat /dev/null >.depend g++ -M $(CXXFLAGS) $(SRCS) $(INCLUDES) >.depend znc: $(OBJS) @@ -29,9 +28,9 @@ modules:: clean: rm -rf znc znc-static *.o core core.* -include .depend +-include .depend -.cpp.o: +%.o: %.cpp $(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $*.o $*.cpp install: znc @MODTARGET@ diff --git a/configure b/configure index 186c31f2..2f42957d 100755 --- a/configure +++ b/configure @@ -2840,7 +2840,7 @@ fi ac_config_files="$ac_config_files Makefile" if test "$MODULES" = "yes"; then - ac_config_files="$ac_config_files modules/buildmod" + ac_config_files="$ac_config_files modules/Makefile" fi cat >confcache <<\_ACEOF @@ -3393,7 +3393,7 @@ do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "modules/buildmod" ) CONFIG_FILES="$CONFIG_FILES modules/buildmod" ;; + "modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; @@ -3731,7 +3731,3 @@ if test "$no_create" != yes; then $ac_cs_success || { (exit 1); exit 1; } fi -if test -f modules/buildmod; then - chmod 0711 modules/buildmod -fi -touch .depend diff --git a/configure.in b/configure.in index fd793b56..a60420c1 100644 --- a/configure.in +++ b/configure.in @@ -78,10 +78,6 @@ AC_SUBST([MODULES]) AC_SUBST([MODTARGET]) AC_CONFIG_FILES([Makefile]) if test "$MODULES" = "yes"; then - AC_CONFIG_FILES([modules/buildmod]) + AC_CONFIG_FILES([modules/Makefile]) fi AC_OUTPUT -if test -f modules/buildmod; then - chmod 0711 modules/buildmod -fi -touch .depend diff --git a/modules/Makefile.in b/modules/Makefile.in new file mode 100644 index 00000000..5fc57cb5 --- /dev/null +++ b/modules/Makefile.in @@ -0,0 +1,28 @@ +ifneq ($(MAKE),gmake) +# If you got an ERROR on the previous line, then you aren't using gmake +endif + +CXX=g++ +CXXFLAGS=@CXXFLAGS@ +INCLUDES=@INCLUDES@ +LIBS=@LIBS@ +VPATH=.:.. +OBJS=$(addsuffix .o, $(basename $(wildcard *.cpp))) +SRCS=$(wildcard *.cpp) $(wildcard ../*.cpp) + + +all: $(addsuffix .so, $(basename $(wildcard *.cpp))) + +depend:: + g++ -M $(CXXFLAGS) $(SRCS) $(INCLUDES) >.depend + +clean: + rm -rf *.so *.o core core.* + +-include .depend + +%.so: %.o + $(CXX) $(CXXFLAGS) -shared -o $@ $< $(INCLUDES) $(LIBS) + +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $< diff --git a/modules/buildmod.in b/modules/buildmod.in deleted file mode 100644 index eb8c1407..00000000 --- a/modules/buildmod.in +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -CXXFLAGS="@MODFLAGS@" -LIBS="@LIBS@" - -if test -z "$1"; then - echo "Usage: $0 [--cflags] [--libs] | --all | [...]" - exit 1 -fi - -if [ -z "$CXX" ]; then - CXX="g++" -fi - -if [ "$1" = "--cflags" ]; then - echo "$CXXFLAGS" - exit 0 -fi - -if [ "$1" = "--libs" ]; then - echo "$LIBS" - exit 0 -fi - -if [ "$1" = "--all" ]; then - FILES="email raw sample shell watch" - if `echo $CXXFLAGS | grep 'HAVE_LIBSSL' >/dev/null 2>/dev/null`; then - FILES="$FILES schat savebuff" - fi -else - FILES=$@ -fi - -for arg in $FILES -do - if test -d $arg && test "$arg" != "CVS"; then - (cd $arg && make || exit 1) - elif test -f "$arg"; then - FILE="$arg" - MOD="${FILE%.cpp}" - MOD="${MOD%.cc}" - elif test -f "$arg.cpp"; then - FILE="$arg.cpp" - MOD="$arg" - elif test -f "$arg.cc"; then - FILE="$arg.cc" - MOD="$arg" - else - continue - fi - - rm -f "$MOD.so" - - if test -n "$FILE"; then - COMMAND="$CXX $CXXFLAGS -c $FILE" - echo $COMMAND - $COMMAND || exit 1 - COMMAND="$CXX $CXXFLAGS -shared -o $MOD.so $MOD.o $LIBS" - echo $COMMAND - $COMMAND || exit 1 - fi - - if ! test -f "$MOD.so"; then - echo "Failed to build $MOD.so!" - exit 1 - else - echo "Built $MOD.so" - fi -done - -exit 0 diff --git a/modules/email.cc b/modules/email.cpp similarity index 97% rename from modules/email.cc rename to modules/email.cpp index 14731034..01fb2912 100644 --- a/modules/email.cc +++ b/modules/email.cpp @@ -14,8 +14,11 @@ * Author: imaginos * * $Log$ - * Revision 1.1 2004/08/24 00:08:52 prozacx - * Initial revision + * Revision 1.1 2005/03/30 18:46:35 imaginos + * moving to standard makefile system, and cpp only extension + * + * Revision 1.1.1.1 2004/08/24 00:08:52 prozacx + * * * */