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
This commit is contained in:
psychon
2008-01-07 21:28:03 +00:00
parent 378563abf9
commit 3637091b60
2 changed files with 18 additions and 13 deletions

View File

@@ -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)

View File

@@ -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)