From 8d3957f3b888adcd45cd5e3bd3e850fc885c93a6 Mon Sep 17 00:00:00 2001 From: Radu Iliescu Date: Mon, 3 Dec 2018 07:22:33 -0500 Subject: [PATCH] Makefile: refactor CFLAGS to come from main Makefile Also remove CC and link flags since linking is done in main Makefile --- Makefile | 10 ++++++++-- conn/Makefile | 3 --- crypto/Makefile | 3 --- crypto/encoding/Makefile | 1 - db/Makefile | 5 +---- hashmap/Makefile | 3 --- identify/Makefile | 10 +--------- net/Makefile | 8 -------- nodeio/Makefile | 8 -------- os/Makefile | 3 --- peer/Makefile | 5 +---- record/Makefile | 3 --- routing/Makefile | 5 +---- secio/Makefile | 10 +--------- swarm/Makefile | 10 +--------- utils/Makefile | 10 +--------- yamux/Makefile | 10 +--------- 17 files changed, 16 insertions(+), 91 deletions(-) diff --git a/Makefile b/Makefile index 064ce21..4f2e097 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,15 @@ COMPONENTS = conn crypto db thirdparty hashmap identify net os peer record routing secio swarm utils yamux -DEBUG = true -export DEBUG +export DEBUG = true ROOT= $(shell pwd) export INCLUDE = -I$(ROOT)/include -I$(ROOT)/c-protobuf -I$(ROOT)/c-multihash/include -I$(ROOT)/c-multiaddr/include +export CFLAGS = $(INCLUDE) -Wall -O0 + +ifdef DEBUG +CFLAGS += -g3 +endif + OBJS = $(shell (find $(COMPONENTS) -name *.o)) @@ -23,3 +28,4 @@ all: test clean: $(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) clean ;) + make -C test clean diff --git a/conn/Makefile b/conn/Makefile index 2e05e2c..a2048f6 100644 --- a/conn/Makefile +++ b/conn/Makefile @@ -1,6 +1,3 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -g3 -LFLAGS = DEPS = OBJS = dialer.o transport_dialer.o connection.o tcp_transport_dialer.o session.o diff --git a/crypto/Makefile b/crypto/Makefile index 8b511e5..b4be33a 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -1,6 +1,3 @@ -CC = gcc -export CFLAGS = $(INCLUDE) -O0 -g3 -LFLAGS = DEPS = OBJS = rsa.o sha256.o sha512.o sha1.o key.o peerutils.o ephemeral.o aes.o diff --git a/crypto/encoding/Makefile b/crypto/encoding/Makefile index 3719318..8e91776 100644 --- a/crypto/encoding/Makefile +++ b/crypto/encoding/Makefile @@ -1,4 +1,3 @@ -CC = gcc LFLAGS = DEPS = ../../include/libp2p/crypto/encoding/base58.h ../../include/libp2p/crypto/encoding/base64.h \ ../../include/libp2p/crypto/encoding/x509.h ../../include/libp2p/crypto/encoding/base16.h \ diff --git a/db/Makefile b/db/Makefile index 8a24d0f..b69194a 100644 --- a/db/Makefile +++ b/db/Makefile @@ -1,11 +1,8 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -g3 -std=c99 -LFLAGS = DEPS = OBJS = datastore.o filestore.o %.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -std=c99 all: $(OBJS) diff --git a/hashmap/Makefile b/hashmap/Makefile index 0acbb2c..aa803f7 100644 --- a/hashmap/Makefile +++ b/hashmap/Makefile @@ -1,6 +1,3 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -g3 -LFLAGS = DEPS = OBJS = hashmap.o diff --git a/identify/Makefile b/identify/Makefile index 22677db..9aa0fc5 100644 --- a/identify/Makefile +++ b/identify/Makefile @@ -1,16 +1,8 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -Wall -Werror -std=c11 - -ifdef DEBUG -CFLAGS += -g3 -endif - -LFLAGS = DEPS = OBJS = identify.o %.o: %.c - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -std=c11 all: $(OBJS) diff --git a/net/Makefile b/net/Makefile index 65c150f..9c2cbd3 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1,11 +1,3 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -Wall - -ifdef DEBUG -CFLAGS += -g3 -endif - -LFLAGS = DEPS = OBJS = sctp.o socket.o tcp.o udp.o multistream.o protocol.o connectionstream.o stream.o server.o diff --git a/nodeio/Makefile b/nodeio/Makefile index 876a573..d279292 100644 --- a/nodeio/Makefile +++ b/nodeio/Makefile @@ -1,11 +1,3 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -Wall - -ifdef DEBUG -CFLAGS += -g3 -endif - -LFLAGS = DEPS = OBJS = nodeio.o diff --git a/os/Makefile b/os/Makefile index 1bf8853..1f46bef 100644 --- a/os/Makefile +++ b/os/Makefile @@ -1,6 +1,3 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -g3 -LFLAGS = DEPS = OBJS = utils.o memstream.o diff --git a/peer/Makefile b/peer/Makefile index af36362..8a395ce 100644 --- a/peer/Makefile +++ b/peer/Makefile @@ -1,11 +1,8 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -g3 -std=c11 -LFLAGS = DEPS = OBJS = peer.o peerstore.o providerstore.o %.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -std=c11 all: $(OBJS) diff --git a/record/Makefile b/record/Makefile index bca5d02..56e58f6 100644 --- a/record/Makefile +++ b/record/Makefile @@ -1,6 +1,3 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -g3 -LFLAGS = DEPS = OBJS = record.o message.o message_handler.o diff --git a/routing/Makefile b/routing/Makefile index 18bfa0f..57cc06b 100644 --- a/routing/Makefile +++ b/routing/Makefile @@ -1,12 +1,9 @@ DHT_DIR = dht -CC = gcc -CFLAGS = $(INCLUDE) -I$(DHT_DIR) -O0 -g3 -LFLAGS = DEPS = # $(DHT_DIR)/dht.h OBJS = kademlia.o dht.o dht_protocol.o %.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -I$(DHT_DIR) all: $(OBJS) diff --git a/secio/Makefile b/secio/Makefile index 59a0167..696275b 100644 --- a/secio/Makefile +++ b/secio/Makefile @@ -1,16 +1,8 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -Wall -std=c99 - -ifdef DEBUG -CFLAGS += -g3 -endif - -LFLAGS = DEPS = OBJS = exchange.o propose.o secio.o %.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -std=c99 all: $(OBJS) diff --git a/swarm/Makefile b/swarm/Makefile index c5bf8d0..88bb67f 100644 --- a/swarm/Makefile +++ b/swarm/Makefile @@ -1,16 +1,8 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -Wall -std=c99 - -ifdef DEBUG -CFLAGS += -g3 -endif - -LFLAGS = DEPS = OBJS = swarm.o %.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -std=c99 all: $(OBJS) diff --git a/utils/Makefile b/utils/Makefile index 5e9d048..a726924 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -1,16 +1,8 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -Wall -std=c99 - -ifdef DEBUG -CFLAGS += -g3 -endif - -LFLAGS = DEPS = OBJS = string_list.o vector.o linked_list.o logger.o urlencode.o thread_pool.o threadsafe_buffer.o %.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -std=c99 all: $(OBJS) diff --git a/yamux/Makefile b/yamux/Makefile index 942a128..b151cfa 100644 --- a/yamux/Makefile +++ b/yamux/Makefile @@ -1,16 +1,8 @@ -CC = gcc -CFLAGS = $(INCLUDE) -O0 -Wall -Werror -std=c11 - -ifdef DEBUG -CFLAGS += -g3 -endif - -LFLAGS = DEPS = OBJS = frame.o session.o stream.o yamux.o ../os/timespec.o %.o: %.c - $(CC) -c -o $@ $< $(CFLAGS) + $(CC) -c -o $@ $< $(CFLAGS) -std=c11 all: $(OBJS)