diff --git a/Makefile b/Makefile index 7355cdff..08ea46c0 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,10 @@ +pkg_name = aedis +pkg_version = 1.0.0 +pkg_revision = 1 +tarball_name = $(pkg_name)-$(pkg_version)-$(pkg_revision) +tarball_dir = $(pkg_name)-$(pkg_version) +prefix = /opt/$(tarball_name) +incdir = $(prefix)/include/$(pkg_name) #CXX = /opt/gcc-10.2.0/bin/g++-10.2.0 @@ -34,8 +41,9 @@ remove += $(tests) remove += $(addsuffix .o, $(examples)) remove += $(addsuffix .o, $(tests)) remove += Makefile.dep +remove += $(tarball_name).tar.gz -all: general $(examples) +all: $(tests) $(examples) Makefile.dep: -$(CXX) -MM -I./include ./examples/*.cpp ./tests/*.cpp > $@ @@ -49,10 +57,23 @@ $(tests): % : tests/%.cpp $(CXX) -o $@ $< $(CPPFLAGS) $(LDFLAGS) .PHONY: check -check: general +check: $(tests) ./general +.PHONY: install +install: + install --mode=444 -D include/aedis/* --target-directory $(incdir) + +uninstall: + rm -rf $(incdir) + .PHONY: clean clean: rm -f $(remove) +$(tarball_name).tar.gz: + git archive --format=tar.gz --prefix=$(tarball_dir)/ HEAD > $(tarball_name).tar.gz + +.PHONY: dist +dist: $(tarball_name).tar.gz + diff --git a/examples/sync_basic.cpp b/examples/sync_basic.cpp index eef22440..fff61011 100644 --- a/examples/sync_basic.cpp +++ b/examples/sync_basic.cpp @@ -16,8 +16,7 @@ int main() { try { resp::pipeline p; - p.set("Password", {"12345"}); - p.quit(); + p.subscribe("channel"); io_context ioc {1}; tcp::resolver resv(ioc); @@ -27,9 +26,9 @@ int main() std::string buffer; for (;;) { - resp::response_simple_string res; + resp::response_array res; resp::read(socket, buffer, res); - std::cout << res.result << std::endl; + print(res.result); } } catch (std::exception const& e) { std::cerr << e.what() << std::endl; diff --git a/include/aedis/version.hpp b/include/aedis/version.hpp index eeb3bc6b..725133aa 100644 --- a/include/aedis/version.hpp +++ b/include/aedis/version.hpp @@ -6,5 +6,5 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -#define AEDIS_VERSION 1 +#define AEDIS_VERSION 1.0.0