From ea7cd64fc21246028ed3e15803753eb149d3f4fb Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 5 Oct 2016 12:36:06 +0100 Subject: [PATCH] Moved tasks from Rake to Make The rake file was obsolete, apart from one invocation of ruby in a shell! --- Makefile | 21 +++++++++++++------- Rakefile | 60 -------------------------------------------------------- 2 files changed, 14 insertions(+), 67 deletions(-) delete mode 100644 Rakefile diff --git a/Makefile b/Makefile index 4b2102a..84284ef 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,9 @@ SRCS := $(COMMON_SRC) $(SERVER_SRC) $(PROXY_SRC) OBJS := $(COMMON_OBJ) $(SERVER_OBJ) $(PROXY_OBJ) -all: build/flexnbd build/flexnbd-proxy doc +all: build doc + +build: server proxy build/%.o: %.c mkdir -p $(dir $@) @@ -82,8 +84,8 @@ build/flexnbd-proxy: $(COMMON_OBJ) $(PROXY_OBJ) build/proxy-main.o $(LINK) $^ -o $@ server: build/flexnbd -proxy: build/flexnbd-proxy +proxy: build/flexnbd-proxy CHECK_SRC := $(wildcard tests/unit/*.c) CHECK_OBJ := $(CHECK_SRC:tests/unit/%.c=build/%.o) @@ -97,22 +99,27 @@ build/check_%: build/check_%.o check_objs: $(CHECK_OBJ) check_bins: $(CHECK_BINS) + check: $(CHECK_BINS) for bin in $^; do $$bin; done +acceptance: + cd tests/acceptance && RUBYOPT='-I.' ruby nbd_scenarios -v + +test: check acceptance + build/flexnbd.1: README.txt a2x --destination-dir build --format manpage $< + build/flexnbd-proxy.1: README.proxy.txt a2x --destination-dir build --format manpage $< + # If we don't pipe to file, gzip clobbers the original, causing make # to rebuild each time %.1.gz: %.1 gzip -c -f $< > $@ -server-man: build/flexnbd.1.gz -proxy-man: build/flexnbd-proxy.1.gz - -doc: server-man proxy-man +doc: build/flexnbd.1.gz build/flexnbd-proxy.1.gz install: mkdir -p $(INSTALLDIR) @@ -122,7 +129,7 @@ clean: rm -rf build/* -.PHONY: clean objs check_objs all server proxy check_bins check server-man proxy-man doc +.PHONY: clean objs check_objs all server proxy check_bins check doc build test acceptance # Include extra dependencies at the end, NOT before 'all' -include $(wildcard build/*.d) diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 97762ab..0000000 --- a/Rakefile +++ /dev/null @@ -1,60 +0,0 @@ -# encoding: utf-8 - -def make(*targets) - sh "make #{targets.map{|t| t.to_s}.join(" ")}" -end - -def maketask( opts ) - case opts - when Symbol - maketask opts => opts - else - opts.each do |name, targets| - task( name ){make *[*targets]} - end - end -end - - -desc "Build the binary and man page" -maketask :build => [:all, :doc] - -desc "Build just the flexnbd binary" -maketask :flexnbd => [:server] -file "build/flexnbd" => :flexnbd - -desc "Build just the flexnbd-proxy binary" -maketask :flexnbd_proxy => [:proxy] -file "build/flexnbd-proxy" => :flexnbd_proxy - -desc "Build just the man page" -maketask :man => :doc - - -namespace "test" do - desc "Run all tests" - task 'run' => ["unit", "scenarios"] - - desc "Build C tests" - maketask :build => :check_bins - - desc "Run C tests" - maketask :unit => :check - - desc "Run NBD test scenarios" - task 'scenarios' => ["build/flexnbd", "build/flexnbd-proxy"] do - sh "cd tests/acceptance && RUBYOPT='-I.' ruby nbd_scenarios -v" - end -end - - -desc "Remove all build targets, binaries and temporary files" -maketask :clean - -file "debian/changelog" do - FileUtils.mkdir_p "debian" - sh "hg log --style=changelog.template > debian/changelog" -end - -desc "Generate the changelog" -task :changelog => "debian/changelog"