Moved tasks from Rake to Make
The rake file was obsolete, apart from one invocation of ruby in a shell!
This commit is contained in:
21
Makefile
21
Makefile
@@ -67,7 +67,9 @@ SRCS := $(COMMON_SRC) $(SERVER_SRC) $(PROXY_SRC)
|
|||||||
OBJS := $(COMMON_OBJ) $(SERVER_OBJ) $(PROXY_OBJ)
|
OBJS := $(COMMON_OBJ) $(SERVER_OBJ) $(PROXY_OBJ)
|
||||||
|
|
||||||
|
|
||||||
all: build/flexnbd build/flexnbd-proxy doc
|
all: build doc
|
||||||
|
|
||||||
|
build: server proxy
|
||||||
|
|
||||||
build/%.o: %.c
|
build/%.o: %.c
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
@@ -82,8 +84,8 @@ build/flexnbd-proxy: $(COMMON_OBJ) $(PROXY_OBJ) build/proxy-main.o
|
|||||||
$(LINK) $^ -o $@
|
$(LINK) $^ -o $@
|
||||||
|
|
||||||
server: build/flexnbd
|
server: build/flexnbd
|
||||||
proxy: build/flexnbd-proxy
|
|
||||||
|
|
||||||
|
proxy: build/flexnbd-proxy
|
||||||
|
|
||||||
CHECK_SRC := $(wildcard tests/unit/*.c)
|
CHECK_SRC := $(wildcard tests/unit/*.c)
|
||||||
CHECK_OBJ := $(CHECK_SRC:tests/unit/%.c=build/%.o)
|
CHECK_OBJ := $(CHECK_SRC:tests/unit/%.c=build/%.o)
|
||||||
@@ -97,22 +99,27 @@ build/check_%: build/check_%.o
|
|||||||
check_objs: $(CHECK_OBJ)
|
check_objs: $(CHECK_OBJ)
|
||||||
|
|
||||||
check_bins: $(CHECK_BINS)
|
check_bins: $(CHECK_BINS)
|
||||||
|
|
||||||
check: $(CHECK_BINS)
|
check: $(CHECK_BINS)
|
||||||
for bin in $^; do $$bin; done
|
for bin in $^; do $$bin; done
|
||||||
|
|
||||||
|
acceptance:
|
||||||
|
cd tests/acceptance && RUBYOPT='-I.' ruby nbd_scenarios -v
|
||||||
|
|
||||||
|
test: check acceptance
|
||||||
|
|
||||||
build/flexnbd.1: README.txt
|
build/flexnbd.1: README.txt
|
||||||
a2x --destination-dir build --format manpage $<
|
a2x --destination-dir build --format manpage $<
|
||||||
|
|
||||||
build/flexnbd-proxy.1: README.proxy.txt
|
build/flexnbd-proxy.1: README.proxy.txt
|
||||||
a2x --destination-dir build --format manpage $<
|
a2x --destination-dir build --format manpage $<
|
||||||
|
|
||||||
# If we don't pipe to file, gzip clobbers the original, causing make
|
# If we don't pipe to file, gzip clobbers the original, causing make
|
||||||
# to rebuild each time
|
# to rebuild each time
|
||||||
%.1.gz: %.1
|
%.1.gz: %.1
|
||||||
gzip -c -f $< > $@
|
gzip -c -f $< > $@
|
||||||
|
|
||||||
server-man: build/flexnbd.1.gz
|
doc: build/flexnbd.1.gz build/flexnbd-proxy.1.gz
|
||||||
proxy-man: build/flexnbd-proxy.1.gz
|
|
||||||
|
|
||||||
doc: server-man proxy-man
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -p $(INSTALLDIR)
|
mkdir -p $(INSTALLDIR)
|
||||||
@@ -122,7 +129,7 @@ clean:
|
|||||||
rm -rf build/*
|
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 extra dependencies at the end, NOT before 'all'
|
||||||
-include $(wildcard build/*.d)
|
-include $(wildcard build/*.d)
|
||||||
|
60
Rakefile
60
Rakefile
@@ -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"
|
|
Reference in New Issue
Block a user