34
34
LIB_SRCS := ZNCString.cpp Csocket.cpp znc.cpp IRCNetwork.cpp User.cpp IRCSock.cpp \
35
35
Client.cpp Chan.cpp Nick.cpp Server.cpp Modules.cpp MD5.cpp Buffer.cpp Utils.cpp \
36
36
FileUtils.cpp HTTPSock.cpp Template.cpp ClientCommand.cpp Socket.cpp SHA256.cpp \
37
WebModules.cpp Listener.cpp Config.cpp ZNCDebug.cpp version.cpp
37
WebModules.cpp Listener.cpp Config.cpp ZNCDebug.cpp Threads.cpp version.cpp
38
38
LIB_SRCS := $(addprefix src/,$(LIB_SRCS))
39
39
BIN_SRCS := src/main.cpp
40
40
LIB_OBJS := $(patsubst %cpp,%o,$(LIB_SRCS))
41
41
BIN_OBJS := $(patsubst %cpp,%o,$(BIN_SRCS))
42
CLEAN := znc src/*.o core core.* .version_extra
43
DISTCLEAN := Makefile config.log config.status znc-buildmod .depend \
44
modules/.depend modules/Makefile man/Makefile znc.pc znc-uninstalled.pc
42
TESTS := StringTest ConfigTest
43
TESTS := $(addprefix test/,$(addsuffix .o,$(TESTS)))
45
CLEAN := znc src/*.o test/*.o core core.* .version_extra .depend modules/.depend
46
DISTCLEAN := Makefile config.log config.status znc-buildmod \
47
modules/Makefile man/Makefile znc.pc znc-uninstalled.pc test/Makefile
46
49
CXXFLAGS += -D_MODDIR_=\"$(MODDIR)\" -D_DATADIR_=\"$(DATADIR)\"
82
86
$(Q)$(CXX) $(LDFLAGS) -shared -o $@ $(LIB_OBJS) $(LIBS)
89
unittest: $(LIB_OBJS) test/gtest-all.o test/gtest-main.o $(TESTS)
90
$(E) Linking unit test...
91
$(Q)$(CXX) $(LDFLAGS) -o $@ $(LIB_OBJS) test/gtest-all.o test/gtest-main.o $(TESTS) $(LIBS)
86
94
@$(MAKE) -C man $(C)
101
109
$(E) Building core object $*...
102
110
$(Q)$(CXX) $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/$*.dep -MT $@
105
# If git-describe differs from .version_extra, add a phony target to dependencies, forcing version.o to be recompiled
106
# znc-0.200-430-g80acaa7 -> -DVERSION_EXTRA="\"-git-430-80acaa7\""
107
src/version.o: src/version.cpp Makefile $(shell if [ x`cat .version_extra 2> /dev/null` != x`$(GIT) --git-dir=$(srcdir)/.git describe 2> /dev/null` ]; then echo version_extra_recompile; fi)
112
test/%.o: test/%.cpp Makefile
113
@mkdir -p .depend test
114
$(E) Building test object $*...
115
$(Q)$(CXX) $(CXXFLAGS) -Itest/gtest-$(GTEST_VER)/fused-src -c -o $@ $< -MD -MF .depend/$*.dep -MT $@
117
test/gtest-all.o: test/gtest-$(GTEST_VER)/fused-src/gtest/gtest-all.cc Makefile
118
@mkdir -p .depend test
119
$(E) Building test object gtest-all...
120
$(Q)$(CXX) $(CXXFLAGS) -Itest/gtest-$(GTEST_VER)/fused-src -c -o $@ $< -MD -MF .depend/gtest-all.dep -MT $@
122
test/gtest-main.o: test/gtest-$(GTEST_VER)/fused-src/gtest/gtest_main.cc Makefile
123
@mkdir -p .depend test
124
$(E) Building test object gtest-main...
125
$(Q)$(CXX) $(CXXFLAGS) -Itest/gtest-$(GTEST_VER)/fused-src -c -o $@ $< -MD -MF .depend/gtest-main.dep -MT $@
128
$(E) Downloading GoogleTest $(GTEST_VER)
129
$(Q)wget http://googletest.googlecode.com/files/gtest-$(GTEST_VER).zip -O $@
131
test/gtest-$(GTEST_VER)/fused-src/gtest/gtest-all.cc test/gtest-$(GTEST_VER)/fused-src/gtest/gtest_main.cc test/gtest-$(GTEST_VER)/fused-src/gtest/gtest.h: test/gtest.zip
132
$(E) Unpacking GoogleTest $(GTEST_VER)
133
$(Q)test -r $@ || unzip $^ -d test/
138
# If git commit was changed since previous build, add a phony target to dependencies, forcing version.o to be recompiled
139
# Nightlies have pregenerated version.cpp
140
src/version.cpp: Makefile version.sh $(shell if [ x`cat .version_extra 2> /dev/null` != x`$(srcdir)/version.sh $(GIT) 2> /dev/null` ]; then echo version_extra_recompile; fi)
108
141
@mkdir -p .depend src
109
$(E) Building core object version...
110
$(Q)$(CXX) $(shell $(GIT) --git-dir=$(srcdir)/.git describe 2> /dev/null | $(SED) 's/.*-\([0123456789][0123456789]*\)-g\(.*\)/-DVERSION_EXTRA="\\"-git-\1-\2\\""/') $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/version.dep -MT $@
111
$(Q)$(GIT) --git-dir=$(srcdir)/.git describe > .version_extra 2> /dev/null || true
142
$(E) Building source file version.cpp...
143
$(Q)WRITE_OUTPUT=yes $(srcdir)/version.sh "$(GIT)" > .version_extra 2> /dev/null
145
CLEAN += src/version.cpp
114
148
install: znc $(LIBZNC)