And again some makefile stuff (this time it's some new depend code)

We are back to the behaviour of some old version of the Makefile

If you want to compile ZNC only once, just use make.

If you want the Makefile do to dependency tracking and that fancy stuff,
run make depend which creates the .depend and modules/.depend dirs.

From then on some dependency files get written when you compile something.

(The way we did it before now was bad, because all the .cpp files depended on
 the .depend dir which got its mtime updated regulary)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@922 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-01-16 20:56:07 +00:00
parent ce6adf6941
commit d7c51ed141
4 changed files with 25 additions and 16 deletions
+14 -3
View File
@@ -13,7 +13,6 @@ LDFLAGS := @LDFLAGS@
INCLUDES := @INCLUDES@
LIBS := @LIBS@
prefix := @prefix@
DEPEND := yes
SRCS := String.cpp Csocket.cpp main.cpp znc.cpp User.cpp IRCSock.cpp Client.cpp DCCBounce.cpp \
DCCSock.cpp Chan.cpp Nick.cpp Server.cpp Modules.cpp MD5.cpp Buffer.cpp Utils.cpp \
@@ -23,12 +22,24 @@ CLEAN := znc znc-static *.o core core.*
DISTCLEAN := Makefile config.log config.status znc-config .depend \
modules/.depend modules/Makefile
DEPEND := $(wildcard .depend)
ifeq ($(DEPEND), )
DEPEND := no
else
DEPEND := yes
endif
.PHONY: all modules clean distclean install
all: @DEPEND@ znc @MODTARGET@
all: znc @MODTARGET@
.depend:
@mkdir -p .depend
@if test -n "@MODTARGET@"; then \
$(MAKE) -C modules .depend ; \
fi
depend: .depend
znc: $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
@@ -53,7 +64,7 @@ distclean: clean
rm -rf $(DISTCLEAN)
ifeq ($(DEPEND), yes)
.cpp.o: .depend
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $< -MMD -MF .depend/$<.dep
else
.cpp.o:
Vendored
+1 -7
View File
@@ -633,7 +633,6 @@ CFLAGS
ac_ct_CC
MODFLAGS
INCLUDES
DEPEND
MODULES
MODTARGET
VERSION
@@ -2414,7 +2413,6 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
CXXFLAGS="$SAVED_CXXFLAGS -D_GNU_SOURCE -D_FORTIFY_SOURCE=2"
INCLUDES=""
LIBS=""
DEPEND=""
appendLib () {
if test "$LIBS" != ""; then
@@ -2525,8 +2523,6 @@ fi
if test "x$GXX" = "xyes"; then
appendCXX -Wall -W -Wno-unused -Woverloaded-virtual
# enable g++ dependency tracking
DEPEND=".depend"
fi
ac_ext=c
@@ -3929,7 +3925,6 @@ VERSION=0.053
ac_config_files="$ac_config_files Makefile"
ac_config_files="$ac_config_files znc-config"
@@ -4625,7 +4620,6 @@ CFLAGS!$CFLAGS$ac_delim
ac_ct_CC!$ac_ct_CC$ac_delim
MODFLAGS!$MODFLAGS$ac_delim
INCLUDES!$INCLUDES$ac_delim
DEPEND!$DEPEND$ac_delim
MODULES!$MODULES$ac_delim
MODTARGET!$MODTARGET$ac_delim
VERSION!$VERSION$ac_delim
@@ -4638,7 +4632,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 68; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 67; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-4
View File
@@ -7,7 +7,6 @@ AC_CANONICAL_HOST
CXXFLAGS="$SAVED_CXXFLAGS -D_GNU_SOURCE -D_FORTIFY_SOURCE=2"
INCLUDES=""
LIBS=""
DEPEND=""
appendLib () {
if test "$LIBS" != ""; then
@@ -100,8 +99,6 @@ fi
if test "x$GXX" = "xyes"; then
appendCXX -Wall -W -Wno-unused -Woverloaded-virtual
# enable g++ dependency tracking
DEPEND=".depend"
fi
AC_CHECK_LIB( gnugetopt, getopt_long,)
@@ -193,7 +190,6 @@ AC_SUBST([CXXFLAGS])
AC_SUBST([MODFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([INCLUDES])
AC_SUBST([DEPEND])
AC_SUBST([LIBS])
AC_SUBST([MODULES])
AC_SUBST([MODTARGET])
+10 -2
View File
@@ -15,7 +15,6 @@ LIBS := @LIBS@
PERL := @PERL@
MODDIR := @MODDIR@
DATADIR := @DATADIR@
DEPEND := yes
ifeq "@NOSSL@" "1"
FILES := $(foreach file, $(wildcard *.cpp), \
@@ -46,6 +45,13 @@ TARGETS := $(addsuffix .so, $(FILES))
CLEAN := *.so
DEPEND := $(wildcard .depend)
ifeq ($(DEPEND), )
DEPEND := no
else
DEPEND := yes
endif
.PHONY: all clean install modperl_install
all: $(TARGETS)
@@ -53,6 +59,8 @@ all: $(TARGETS)
.depend:
@mkdir -p .depend
depend: .depend
install: all create_install_dir install_metadirs $(PERLHOOK)
install -m 0755 $(TARGETS) $(DESTDIR)$(MODDIR)
@@ -72,7 +80,7 @@ clean:
rm -rf $(CLEAN)
ifeq ($(DEPEND), yes)
%.so: %.cpp .depend
%.so: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) $($(basename $<)FLAGS) -shared -o $@ $< -MMD -MF .depend/$<.dep
else
%.so: %.cpp