Makefile: refactor CFLAGS to come from main Makefile

Also remove CC and link flags since linking is done in main Makefile
This commit is contained in:
Radu Iliescu 2018-12-03 07:22:33 -05:00
parent 209e7c432e
commit 8d3957f3b8
17 changed files with 16 additions and 91 deletions

View file

@ -1,10 +1,15 @@
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
DEBUG = true export DEBUG = true
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
export CFLAGS = $(INCLUDE) -Wall -O0
ifdef DEBUG
CFLAGS += -g3
endif
OBJS = $(shell (find $(COMPONENTS) -name *.o)) OBJS = $(shell (find $(COMPONENTS) -name *.o))
@ -23,3 +28,4 @@ all: test
clean: clean:
$(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) clean ;) $(foreach dir,$(COMPONENTS), $(MAKE) -C $(dir) clean ;)
make -C test clean

View file

@ -1,6 +1,3 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -g3
LFLAGS =
DEPS = DEPS =
OBJS = dialer.o transport_dialer.o connection.o tcp_transport_dialer.o session.o OBJS = dialer.o transport_dialer.o connection.o tcp_transport_dialer.o session.o

View file

@ -1,6 +1,3 @@
CC = gcc
export CFLAGS = $(INCLUDE) -O0 -g3
LFLAGS =
DEPS = DEPS =
OBJS = rsa.o sha256.o sha512.o sha1.o key.o peerutils.o ephemeral.o aes.o OBJS = rsa.o sha256.o sha512.o sha1.o key.o peerutils.o ephemeral.o aes.o

View file

@ -1,4 +1,3 @@
CC = gcc
LFLAGS = LFLAGS =
DEPS = ../../include/libp2p/crypto/encoding/base58.h ../../include/libp2p/crypto/encoding/base64.h \ 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 \ ../../include/libp2p/crypto/encoding/x509.h ../../include/libp2p/crypto/encoding/base16.h \

View file

@ -1,11 +1,8 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -g3 -std=c99
LFLAGS =
DEPS = DEPS =
OBJS = datastore.o filestore.o OBJS = datastore.o filestore.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -std=c99
all: $(OBJS) all: $(OBJS)

View file

@ -1,6 +1,3 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -g3
LFLAGS =
DEPS = DEPS =
OBJS = hashmap.o OBJS = hashmap.o

View file

@ -1,16 +1,8 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -Wall -Werror -std=c11
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS = DEPS =
OBJS = identify.o OBJS = identify.o
%.o: %.c %.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -std=c11
all: $(OBJS) all: $(OBJS)

View file

@ -1,11 +1,3 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -Wall
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS = DEPS =
OBJS = sctp.o socket.o tcp.o udp.o multistream.o protocol.o connectionstream.o stream.o server.o OBJS = sctp.o socket.o tcp.o udp.o multistream.o protocol.o connectionstream.o stream.o server.o

View file

@ -1,11 +1,3 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -Wall
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS = DEPS =
OBJS = nodeio.o OBJS = nodeio.o

View file

@ -1,6 +1,3 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -g3
LFLAGS =
DEPS = DEPS =
OBJS = utils.o memstream.o OBJS = utils.o memstream.o

View file

@ -1,11 +1,8 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -g3 -std=c11
LFLAGS =
DEPS = DEPS =
OBJS = peer.o peerstore.o providerstore.o OBJS = peer.o peerstore.o providerstore.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -std=c11
all: $(OBJS) all: $(OBJS)

View file

@ -1,6 +1,3 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -g3
LFLAGS =
DEPS = DEPS =
OBJS = record.o message.o message_handler.o OBJS = record.o message.o message_handler.o

View file

@ -1,12 +1,9 @@
DHT_DIR = dht DHT_DIR = dht
CC = gcc
CFLAGS = $(INCLUDE) -I$(DHT_DIR) -O0 -g3
LFLAGS =
DEPS = # $(DHT_DIR)/dht.h DEPS = # $(DHT_DIR)/dht.h
OBJS = kademlia.o dht.o dht_protocol.o OBJS = kademlia.o dht.o dht_protocol.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -I$(DHT_DIR)
all: $(OBJS) all: $(OBJS)

View file

@ -1,16 +1,8 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -Wall -std=c99
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS = DEPS =
OBJS = exchange.o propose.o secio.o OBJS = exchange.o propose.o secio.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -std=c99
all: $(OBJS) all: $(OBJS)

View file

@ -1,16 +1,8 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -Wall -std=c99
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS = DEPS =
OBJS = swarm.o OBJS = swarm.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -std=c99
all: $(OBJS) all: $(OBJS)

View file

@ -1,16 +1,8 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -Wall -std=c99
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS = DEPS =
OBJS = string_list.o vector.o linked_list.o logger.o urlencode.o thread_pool.o threadsafe_buffer.o OBJS = string_list.o vector.o linked_list.o logger.o urlencode.o thread_pool.o threadsafe_buffer.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -std=c99
all: $(OBJS) all: $(OBJS)

View file

@ -1,16 +1,8 @@
CC = gcc
CFLAGS = $(INCLUDE) -O0 -Wall -Werror -std=c11
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS = DEPS =
OBJS = frame.o session.o stream.o yamux.o ../os/timespec.o OBJS = frame.o session.o stream.o yamux.o ../os/timespec.o
%.o: %.c %.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS) -std=c11
all: $(OBJS) all: $(OBJS)