Makefile: build libp2p as shared library

This commit is contained in:
Radu Iliescu 2018-12-03 09:24:50 -05:00
parent d386a4b496
commit 2949b2468f

View file

@ -1,10 +1,11 @@
COMPONENTS = conn crypto db thirdparty hashmap identify net os peer record routing secio swarm utils yamux COMPONENTS = conn crypto db thirdparty hashmap identify net os peer record routing secio swarm utils yamux
export DEBUG = true export DEBUG = true
export SHARED = true
ROOT= $(shell pwd) ROOT= $(shell pwd)
export INCLUDE = -I$(ROOT)/include -I$(ROOT)/c-protobuf -I$(ROOT)/c-multihash/include -I$(ROOT)/c-multiaddr/include export INCLUDE = -I$(ROOT)/include -I$(ROOT)/c-protobuf -I$(ROOT)/c-multihash/include -I$(ROOT)/c-multiaddr/include
export CFLAGS = $(INCLUDE) -Wall -O0 export CFLAGS = $(INCLUDE) -Wall -O0 -fPIC
ifdef DEBUG ifdef DEBUG
CFLAGS += -g3 CFLAGS += -g3
@ -17,6 +18,9 @@ all: test
link: compile link: compile
$(AR) rcs libp2p.a $(OBJS) $(LINKER_FLAGS) $(AR) rcs libp2p.a $(OBJS) $(LINKER_FLAGS)
#ifdef SHARED
gcc -shared -o libp2p.so $(OBJS) $(LINKER_FLAGS)
#endif
compile: compile:
$(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) all ;) $(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) all ;)