diff --git a/Makefile b/Makefile index 655325a..4b2102a 100644 --- a/Makefile +++ b/Makefile @@ -50,15 +50,11 @@ 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/ -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) @@ -76,7 +72,6 @@ all: build/flexnbd build/flexnbd-proxy doc build/%.o: %.c mkdir -p $(dir $@) $(COMPILE) $< -o $@ - $(SAVEDEP) $< > build/$*.d objs: $(OBJS) @@ -91,16 +86,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) @@ -117,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 @@ -132,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) 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