Makefile: create list of components and use it for compile and clean

This commit is contained in:
Radu Iliescu 2018-11-29 10:17:20 -05:00
parent 5bc911bba3
commit bd6400c370

View file

@ -1,3 +1,4 @@
COMPONENTS = conn crypto db thirdparty hashmap identify net os peer record routing secio swarm utils yamux
DEBUG = true DEBUG = true
export DEBUG export DEBUG
@ -5,6 +6,7 @@ export DEBUG
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
OBJS = \ OBJS = \
conn/*.o \ conn/*.o \
crypto/*.o \ crypto/*.o \
@ -27,21 +29,7 @@ link: compile
ar rcs libp2p.a $(OBJS) $(LINKER_FLAGS) ar rcs libp2p.a $(OBJS) $(LINKER_FLAGS)
compile: compile:
cd conn; make all; $(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) all ;)
cd crypto; make all;
cd db; make all;
cd thirdparty; make all;
cd hashmap; make all;
cd identify; make all;
cd net; make all;
cd os; make all;
cd peer; make all;
cd record; make all;
cd routing; make all;
cd secio; make all;
cd swarm; make all;
cd utils; make all;
cd yamux; make all;
test: compile link test: compile link
cd test; make all; cd test; make all;
@ -51,21 +39,4 @@ rebuild: clean all
all: test all: test
clean: clean:
cd conn; make clean; $(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) clean ;)
cd crypto; make clean;
cd db; make clean;
cd hashmap; make clean;
cd identify; make clean;
cd net; make clean;
cd os; make clean;
cd peer; make clean;
cd thirdparty; make clean
cd record; make clean;
cd routing; make clean;
cd secio; make clean;
cd swarm; make clean;
cd utils; make clean;
cd test; make clean;
cd yamux; make clean;
rm -rf libp2p.a