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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.slo
*.lo
*.o
*.s.o

# Compiled Dynamic libraries
*.so
Expand All @@ -17,4 +18,4 @@
/.vscode
.atom-build.cson
.atom-dbg.cson
/bin
/bin
21 changes: 15 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ SHARED_LIB = lib$(LIBRARY_NAME).so.$(VERSION)
STATIC_LIB = lib$(LIBRARY_NAME).a.$(VERSION)
SOURCES = $(wildcard *.cpp) $(wildcard linux_tcp/*.cpp)
SHARED_OBJECTS = $(SOURCES:%.cpp=%.o)
SHARED_DEPS = $(SHARED_OBJECTS:%.o=%.d)
STATIC_OBJECTS = $(SOURCES:%.cpp=%.s.o)
DEPENDENCIES = $(SOURCES:%.cpp=%.d)
STATIC_DEPS = $(STATIC_OBJECTS:%.o=%.d)
DEPENDENCIES = $(SHARED_DEPS) $(STATIC_DEPS)
PURE_SHARED_OBJECTS = $(filter-out tcpconnection.o, $(SOURCES:%.cpp=%.o))
PURE_STATIC_OBJECTS = $(filter-out tcpconnection.s.o, $(SOURCES:%.cpp=%.s.o))

Expand All @@ -19,7 +21,14 @@ else
SONAMEPARAMETER = -soname
endif

-include ${DEPENDENCIES}
ifeq ($(MAKECMDGOALS),shared)
-include ${SHARED_DEPS}
else ifeq ($(MAKECMDGOALS),static)
-include ${STATIC_DEPS}
else
-include ${SHARED_DEPS}
-include ${STATIC_DEPS}
endif

all: CPPFLAGS += -g
all: LD_FLAGS += -g
Expand Down Expand Up @@ -48,8 +57,8 @@ ${STATIC_LIB}: ${STATIC_OBJECTS}
clean:
${RM} *.obj *~* ${SHARED_OBJECTS} ${STATIC_OBJECTS} ${SHARED_LIB} ${STATIC_LIB} ${DEPENDENCIES}

${SHARED_OBJECTS}:
${CPP} ${CPPFLAGS} -fpic -o $@ ${@:%.o=%.cpp}
%.o: %.cpp
${CPP} ${CPPFLAGS} -fpic -o $@ $<

${STATIC_OBJECTS}:
${CPP} ${CPPFLAGS} -o $@ ${@:%.s.o=%.cpp}
%.s.o: %.cpp
${CPP} ${CPPFLAGS} -o $@ $<