Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ SRCS=$(wildcard ../*.cc *.cc)
VPATH=..:.
#CXXFLAGS=-ggdb -Werror -Wall -Wextra -Wconversion -Wno-unused-parameter -Woverloaded-virtual -Wshadow -D_GNU_SOURCE -DHAVE_LIBSSL -DHAVE_IPV6 -DHAVE_C_ARES -D__DEBUG__
CXXFLAGS=-pthread -ggdb -Werror -Wall -Wextra -Wconversion -Wno-unused-parameter -Woverloaded-virtual -Wshadow -D_GNU_SOURCE -DHAVE_LIBSSL -DHAVE_IPV6 -D__DEBUG__
TESTBINS=GetWebPage SendTest ReceiveTest
TESTBINS=GetWebPage SendTest ReceiveTest TLSTest

INCLUDES=-I.. -I.
LIBS=-lssl -lcrypto -lcares -lcurl -ldl
LIBS=-ldl
ifneq (,$(findstring DHAVE_LIBSSL,$(CXXFLAGS)))
LIBS+=-lssl -lcrypto
endif
ifneq (,$(findstring DHAVE_C_ARES,$(CXXFLAGS)))
LIBS+=-lcares
endif

#INCLUDES=-I.. -I. -Ic:/OpenSSL/include
#LIBS=-Lc:/OpenSSL/lib/MinGW -lws2_32 -leay32 -lssleay32
Expand All @@ -22,13 +28,15 @@ all: $(OBJS) $(LOCALOBJS) $(TARGETS)
depend: .depend

.depend:
g++ -MM $(CXXFLAGS) $(SRCS) $(INCLUDES) | sed -e 's/^\([^[:space:]]\)/.objs\/\1/' -e 's/^.objs\/#.*//' >.depend
g++ -MM $(CXXFLAGS) $(SRCS) $(INCLUDES) | sed -e '/^#/d;s/^/.objs\//' >.depend
sed -e '/^\S\+\.o\s*:\s*\.\.\//d' -e 's/^\.objs\/\(\S\+\?\).o\s*:\s*/\1: /' -e 's/\s\+\(\S\+\?\)\.cc\b/ .objs\/\1.o/g' -e 's/\s\+\.\.\/\(\S\+\?\)\.h\b/ .objs\/\1.o/g' -e 's/\s\+\S\+\?\.h\b//g' .depend >>.depend
sed -e '/^\.objs\/\S\+\.o\s*:/d' -e '/[cC][uU][rR][lL]/!d' -e 's/^\(\S\+\)\s*:.*/\1: LIBS+=-lcurl/' .depend >>.depend

.objs/%.o: %.cc
$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<

%: .objs/%.o $(OBJS)
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ $< $(OBJS) $(LIBS)
%: .objs/%.o
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

tags: $(SRCS) $(wildcard ../*.h *.h)
/usr/bin/exuberant-ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ..
Expand All @@ -40,6 +48,6 @@ test: $(TESTBINS)
done

clean:
rm -rf .objs core.* core $(TARGETS) *.out *.err .depend RevieveTest.pem
rm -rf .objs core.* core $(TARGETS) *.out *.err .depend ReceiveTest.pem TLSTest*.pem

-include .depend
Loading