From 3637091b60ec191ddc96d331fe3aedf1fcf4a01a Mon Sep 17 00:00:00 2001 From: psychon Date: Mon, 7 Jan 2008 21:28:03 +0000 Subject: [PATCH] Fix/Change the generation of .depend Instead of having one big file which is generated in a seperated step, we now have a directory where serveral files are created. This fixes .depend, which was broken since we don't generate .o files for our modules. Everyone will have to delete his .depend file after this. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@914 726aef4b-f618-498e-8847-2d620e286838 --- Makefile.in | 17 +++++++++-------- modules/Makefile.in | 14 +++++++++----- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile.in b/Makefile.in index ef3f77a1..83667438 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,6 +13,7 @@ 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 \ @@ -22,17 +23,12 @@ CLEAN := znc znc-static *.o core core.* DISTCLEAN := Makefile config.log config.status znc-config .depend \ modules/.depend modules/Makefile -.PHONY: all modules clean distclean install depend +.PHONY: all modules clean distclean install all: @DEPEND@ znc @MODTARGET@ .depend: - $(CXX) -MM $(CXXFLAGS) $(SRCS) $(INCLUDES) >.depend - @if test -n "@MODTARGET@"; then \ - $(MAKE) -C modules .depend; \ - fi - -depend: .depend + @mkdir -p .depend znc: $(OBJS) $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) @@ -56,8 +52,13 @@ clean: distclean: clean rm -rf $(DISTCLEAN) +ifeq ($(DEPEND), yes) +.cpp.o: .depend + $(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $< -MMD -MF .depend/$<.dep +else .cpp.o: $(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $< +endif install: znc @MODTARGET@ mkdir -p $(DESTDIR)$(prefix)/bin @@ -70,4 +71,4 @@ install: znc @MODTARGET@ $(MAKE) -C modules install DESTDIR=$(DESTDIR); \ fi --include .depend +-include $(wildcard .depend/*.dep) diff --git a/modules/Makefile.in b/modules/Makefile.in index 81b40947..8441c066 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -15,6 +15,7 @@ LIBS := @LIBS@ PERL := @PERL@ MODDIR := @MODDIR@ DATADIR := @DATADIR@ +DEPEND := yes ifeq "@NOSSL@" "1" FILES := $(foreach file, $(wildcard *.cpp), \ @@ -45,14 +46,12 @@ TARGETS := $(addsuffix .so, $(FILES)) CLEAN := *.so -.PHONY: all clean install depend modperl_install +.PHONY: all clean install modperl_install all: $(TARGETS) .depend: - $(CXX) -MM $(CXXFLAGS) $(SRCS) $(INCLUDES) $(PERLCC) >.depend - -depend: .depend + @mkdir -p .depend install: all create_install_dir install_metadirs $(PERLHOOK) install -m 0755 $(TARGETS) $(DESTDIR)$(MODDIR) @@ -72,12 +71,17 @@ install_metadirs: create_install_dir clean: rm -rf $(CLEAN) +ifeq ($(DEPEND), yes) +%.so: %.cpp .depend + $(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) $($(basename $<)FLAGS) -shared -o $@ $< -MMD -MF .depend/$<.dep +else %.so: %.cpp $(CXX) $(CXXFLAGS) $(INCLUDES) $(LDFLAGS) $($(basename $<)FLAGS) -shared -o $@ $< +endif modperl_install: create_install_dir for i in *.pm; do \ install -m 0755 $$i $(DESTDIR)$(MODDIR); \ done --include .depend +-include $(wildcard .depend/*.dep)