From 1ec8728ab056342ccb014515e030950ce51992af Mon Sep 17 00:00:00 2001 From: Mikal Villa Date: Wed, 16 Jul 2014 18:59:17 +0200 Subject: [PATCH] Makefile now detects which file to use (OSX or Linux) Issue #82 --- Makefile | 39 +++++---------------------------------- Makefile.linux | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 Makefile.linux diff --git a/Makefile b/Makefile index 5c04f3fd..8c426254 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,9 @@ -CC = g++ -CFLAGS = -g -Wall -std=c++0x -OBJECTS = obj/CryptoConst.o obj/base64.o obj/NTCPSession.o obj/RouterInfo.o obj/Transports.o \ - obj/RouterContext.o obj/NetDb.o obj/LeaseSet.o obj/Tunnel.o obj/TunnelEndpoint.o \ - obj/TunnelGateway.o obj/TransitTunnel.o obj/I2NPProtocol.o obj/Log.o obj/Garlic.o \ - obj/HTTPServer.o obj/Streaming.o obj/Identity.o obj/SSU.o obj/util.o obj/Reseed.o \ - obj/UPnP.o obj/TunnelPool.o obj/HTTPProxy.o obj/AddressBook.o obj/Daemon.o \ - obj/DaemonLinux.o obj/SSUData.o obj/i2p.o obj/aes.o obj/SOCKS.o -INCFLAGS = -LDFLAGS = -Wl,-rpath,/usr/local/lib -lcryptopp -lboost_system -lboost_filesystem -lboost_regex -lboost_program_options -lpthread -LIBS = +UNAME := $(shell uname -s) -#check if AES-NI is supported by CPU -ifneq ($(shell grep -c aes /proc/cpuinfo),0) - CPU_FLAGS = -DAESNI +ifeq ($(UNAME),Darwin) + include Makefile.osx +else + include Makefile.linux endif -all: obj i2p - -i2p: $(OBJECTS:obj/%=obj/%) - $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .cc .C .cpp .o - -obj/%.o : %.cpp - $(CC) -o $@ $< -c $(CFLAGS) $(INCFLAGS) $(CPU_FLAGS) - -obj: - mkdir -p obj - -clean: - rm -fr obj i2p - -.PHONY: all -.PHONY: clean - diff --git a/Makefile.linux b/Makefile.linux new file mode 100644 index 00000000..5c04f3fd --- /dev/null +++ b/Makefile.linux @@ -0,0 +1,38 @@ + +CC = g++ +CFLAGS = -g -Wall -std=c++0x +OBJECTS = obj/CryptoConst.o obj/base64.o obj/NTCPSession.o obj/RouterInfo.o obj/Transports.o \ + obj/RouterContext.o obj/NetDb.o obj/LeaseSet.o obj/Tunnel.o obj/TunnelEndpoint.o \ + obj/TunnelGateway.o obj/TransitTunnel.o obj/I2NPProtocol.o obj/Log.o obj/Garlic.o \ + obj/HTTPServer.o obj/Streaming.o obj/Identity.o obj/SSU.o obj/util.o obj/Reseed.o \ + obj/UPnP.o obj/TunnelPool.o obj/HTTPProxy.o obj/AddressBook.o obj/Daemon.o \ + obj/DaemonLinux.o obj/SSUData.o obj/i2p.o obj/aes.o obj/SOCKS.o +INCFLAGS = +LDFLAGS = -Wl,-rpath,/usr/local/lib -lcryptopp -lboost_system -lboost_filesystem -lboost_regex -lboost_program_options -lpthread +LIBS = + +#check if AES-NI is supported by CPU +ifneq ($(shell grep -c aes /proc/cpuinfo),0) + CPU_FLAGS = -DAESNI +endif + +all: obj i2p + +i2p: $(OBJECTS:obj/%=obj/%) + $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) + +.SUFFIXES: +.SUFFIXES: .c .cc .C .cpp .o + +obj/%.o : %.cpp + $(CC) -o $@ $< -c $(CFLAGS) $(INCFLAGS) $(CPU_FLAGS) + +obj: + mkdir -p obj + +clean: + rm -fr obj i2p + +.PHONY: all +.PHONY: clean +