diff --git a/Makefile b/Makefile index 5e8c992e..594491ef 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ UNAME := $(shell uname -s) +SHLIB := libi2pd.so +I2PD := i2p ifeq ($(UNAME),Darwin) include Makefile.osx @@ -8,22 +10,25 @@ else include Makefile.linux endif -all: obj i2p - -i2p: $(OBJECTS:obj/%=obj/%) - $(CXX) -o $@ $^ $(LDLIBS) $(LDFLAGS) $(LIBS) +all: obj $(SHLIB) $(I2PD) .SUFFIXES: .SUFFIXES: .c .cc .C .cpp .o obj/%.o : %.cpp - $(CXX) -o $@ $< -c $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $< obj: mkdir -p obj +$(I2PD): $(OBJECTS:obj/%=obj/%) + $(CXX) -o $@ $^ $(LDLIBS) $(LDFLAGS) $(LIBS) + +$(SHLIB): $(OBJECTS:obj/%=obj/%) api.cpp + $(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -shared -o $@ $^ + clean: - rm -fr obj i2p + rm -fr obj $(I2PD) $(SHLIB) .PHONY: all .PHONY: clean diff --git a/Makefile.linux b/Makefile.linux index 37c52b0a..c9c72403 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -1,4 +1,4 @@ -CXXFLAGS = -g -Wall +CXXFLAGS = -g -Wall -fPIC CXXVER := $(shell $(CXX) -dumpversion) FGREP = fgrep diff --git a/api/api.cpp b/api.cpp similarity index 100% rename from api/api.cpp rename to api.cpp diff --git a/api/api.h b/api.h similarity index 100% rename from api/api.h rename to api.h diff --git a/api/Makefile b/api/Makefile deleted file mode 100644 index 0da6f5b1..00000000 --- a/api/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -UNAME := $(shell uname -s) - -ifeq ($(UNAME),Darwin) - include ../Makefile.osx -else ifeq ($(UNAME), FreeBSD) - include ../Makefile.bsd -else - include ../Makefile.linux -endif - -SHARED_LIB = libi2pd.so -all: obj $(SHARED_LIB) - -$(SHARED_LIB): $(OBJECTS:obj/%=obj/%) - $(CXX) -shared -o $(SHARED_LIB) $^ - -.SUFFIXES: -.SUFFIXES: .c .cc .C .cpp .o - -obj/%.o : ../%.cpp - $(CXX) -o $@ $< -c $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -I.. -fPIC $(CPU_FLAGS) - -obj/api.o: api.cpp - $(CXX) -o obj/api.o api.cpp -c $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) -I.. -fPIC $(CPU_FLAGS) - -obj: - mkdir -p obj - -clean: - rm -fr obj $(SHARED_LIB) - -.PHONY: all -.PHONY: clean diff --git a/api/filelist.mk b/api/filelist.mk deleted file mode 100644 index 4b098ae3..00000000 --- a/api/filelist.mk +++ /dev/null @@ -1,19 +0,0 @@ - - -CPP_FILES := ../CryptoConst.cpp ../base64.cpp ../NTCPSession.cpp ../RouterInfo.cpp \ - ../Transports.cpp ../RouterContext.cpp ../NetDb.cpp ../LeaseSet.cpp Tunnel.cpp \ - ../TunnelEndpoint.cpp ../TunnelGateway.cpp ../TransitTunnel.cpp ../I2NPProtocol.cpp \ - ../Log.cpp ../Garlic.cpp ../Streaming.cpp ../Destination.cpp ../Identity.cpp \ - ../SSU.cpp ../SSUSession.cpp ../SSUData.cpp ../util.cpp ../Reseed.cpp ../SSUData.cpp \ - ../aes.cpp ../TunnelPool.cpp ../AddressBook.cpp ../Datagram.cpp api.cpp - - -H_FILES := ../CryptoConst.h ../base64.h ../NTCPSession.h ../RouterInfo.h ../Transports.h \ - ../RouterContext.h ../NetDb.h ../LeaseSet.h ../Tunnel.h ../TunnelEndpoint.h \ - ../TunnelGateway.h ../TransitTunnel.h ../I2NPProtocol.h ../Log.h ../Garlic.h \ - ../Streaming.h ../Destination.h ../Identity.h ../SSU.h ../SSUSession.h ../SSUData.h \ - ../util.h ../Reseed.h ../SSUData.h ../aes.h ../TunnelPool.h ../AddressBook.h ../version.h \ - ../Signature.h ../TransportSession.h ../Datagram.h api.h - -OBJECTS = $(addprefix obj/, $(notdir $(CPP_FILES:.cpp=.o))) -