From fcd3d33498dee707486a6c74b0516967e86a3449 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Tue, 13 Sep 2016 21:41:19 +0100 Subject: [PATCH 1/4] Simplified Makefile gcc and clang can generate dep files as well as compiling in a single pass, no need for two. Signed-off-by: Michel Pollet --- Makefile | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 655325a..2095ced 100644 --- a/Makefile +++ b/Makefile @@ -50,8 +50,7 @@ CC?=gcc LIBS=-lpthread INC=-I/usr/include/libev -Isrc/common -Isrc/server -Isrc/proxy -COMPILE=$(CC) $(INC) -c $(CCFLAGS) -SAVEDEP=$(CC) $(INC) -MM $(CCFLAGS) +COMPILE=$(CC) -MMD $(INC) -c $(CCFLAGS) LINK=$(CC) $(LLDFLAGS) -Isrc $(LIBS) LIB=build/ @@ -71,12 +70,11 @@ SRCS := $(COMMON_SRC) $(SERVER_SRC) $(PROXY_SRC) OBJS := $(COMMON_OBJ) $(SERVER_OBJ) $(PROXY_OBJ) -all: build/flexnbd build/flexnbd-proxy doc +all: build/flexnbd build/flexnbd-proxy #doc build/%.o: %.c mkdir -p $(dir $@) $(COMPILE) $< -o $@ - $(SAVEDEP) $< > build/$*.d objs: $(OBJS) @@ -91,16 +89,13 @@ proxy: build/flexnbd-proxy CHECK_SRC := $(wildcard tests/unit/*.c) -CHECK_OBJ := $(CHECK_SRC:tests/unit/%.c=build/tests/%.o) +CHECK_OBJ := $(CHECK_SRC:tests/unit/%.c=build/%.o) # Why can't we reuse the build/%.o rule above? Not sure. -build/tests/%.o: tests/unit/%.c - mkdir -p $(dir $@) - $(COMPILE) $< -o $@ - $(SAVEDEP) $< > build/tests/$*.d -CHECK_BINS := $(CHECK_OBJ:build/tests/%.o=build/tests/%) -build/tests/%: build/tests/%.o $(OBJS) - $(LINK) $^ -o $@ -lcheck +CHECK_BINS := $(CHECK_SRC:tests/unit/%.c=build/%) + +build/check_%: build/check_%.o + $(LINK) $^ -o $@ $(COMMON_OBJ) -lcheck check_objs: $(CHECK_OBJ) From d9651a038c1444e8e48764d9699d62ea9053bb2f Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Fri, 30 Sep 2016 16:31:47 +0100 Subject: [PATCH 2/4] Makefile: don't include *.d's before 'all' Include any .d file from the build directory, and do that after all the other targets Signed-off-by: Michel Pollet --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2095ced..d41d081 100644 --- a/Makefile +++ b/Makefile @@ -55,9 +55,6 @@ LINK=$(CC) $(LLDFLAGS) -Isrc $(LIBS) LIB=build/ -EXISTING_OBJS := $(wildcard build/*.o) --include $(EXISTING_OBJS:.o=.d) - COMMON_SRC := $(wildcard src/common/*.c) SERVER_SRC := $(wildcard src/server/*.c) PROXY_SRC := $(wildcard src/proxy/*.c) @@ -112,7 +109,6 @@ build/flexnbd-proxy.1: README.proxy.txt %.1.gz: %.1 gzip -c -f $< > $@ - server-man: build/flexnbd.1.gz proxy-man: build/flexnbd-proxy.1.gz @@ -127,3 +123,6 @@ clean: .PHONY: clean objs check_objs all server proxy check_bins check server-man proxy-man doc + +# Include extra dependencies at the end, NOT before 'all' +-include $(wildcard build/*.d) From ed3995303f6f78c89a66759259897d2164633b0c Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 5 Oct 2016 10:41:23 +0100 Subject: [PATCH 3/4] Reinstate doc to all --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d41d081..4b2102a 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ SRCS := $(COMMON_SRC) $(SERVER_SRC) $(PROXY_SRC) OBJS := $(COMMON_OBJ) $(SERVER_OBJ) $(PROXY_OBJ) -all: build/flexnbd build/flexnbd-proxy #doc +all: build/flexnbd build/flexnbd-proxy doc build/%.o: %.c mkdir -p $(dir $@) From 679fa6dbf85caba7540419e1f77381b0b740c407 Mon Sep 17 00:00:00 2001 From: "James F. Carter" Date: Wed, 5 Oct 2016 11:54:09 +0100 Subject: [PATCH 4/4] force binary encoding in a ruby2.1-compatible way --- tests/acceptance/proxy_tests.rb | 2 +- tests/acceptance/test_serve_mode.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/proxy_tests.rb b/tests/acceptance/proxy_tests.rb index e4030a4..37b5a9d 100644 --- a/tests/acceptance/proxy_tests.rb +++ b/tests/acceptance/proxy_tests.rb @@ -4,7 +4,7 @@ require 'flexnbd/fake_dest' module ProxyTests def b - String.new("\xFF", encoding: "BINARY") + "\xFF".b end def with_proxied_client( override_size = nil ) diff --git a/tests/acceptance/test_serve_mode.rb b/tests/acceptance/test_serve_mode.rb index bbf6025..6cf383b 100644 --- a/tests/acceptance/test_serve_mode.rb +++ b/tests/acceptance/test_serve_mode.rb @@ -6,7 +6,7 @@ class TestServeMode < Test::Unit::TestCase def setup super - @b = String.new("\xFF", encoding: "BINARY") + @b = "\xFF".b @env = Environment.new @env.writefile1( "0" ) @env.serve1