Commits

Paul Jones  committed 1e0ea7c

Build a client package; add a goal to execute the client from the Makefile

  • Participants
  • Parent commits e80664c
  • Branches bug22237

Comments (0)

Files changed (2)

 PACKAGE=rabbitmq-bql
 DEPS=rabbitmq-server rabbitmq-erlang-client erlang-rfc4627
+CLIENT_DEPS=rabbit_common amqp_client
 GENERATED_SOURCES=command_lexer command_parser
 EXTRA_PACKAGE_DIRS=scripts
 TEST_APPS=amqp_client rabbitmq_bql
 TEST_COMMANDS=command_parser_test:test() bql_test:test() amq_interface_test:test() bql_client_test:test()
 START_RABBIT_IN_TESTS=true
+CLIENT_PACKAGE=rabbitmq-bql-client.zip
+EXTRA_PACKAGE_ARTIFACTS=$(CLIENT_PACKAGE)
 
 include ../include.mk
 
 
 src/command_parser.erl: ebin/leex.beam src/command_parser.yrl
 	$(ERL) -I -pa ebin -noshell -eval '{ok, _} = yecc:file("$(SOURCE_DIR)/$(PARSER_NAME)"), halt().'
+
+CLIENT_PACKAGE_DIR=build/client
+$(DIST_DIR)/$(CLIENT_PACKAGE): $(TARGETS)
+	rm -rf $(CLIENT_PACKAGE_DIR)
+	mkdir -p $(DIST_DIR)
+	mkdir -p $(CLIENT_PACKAGE_DIR)/ebin
+	cp $(EBIN_DIR)/* $(foreach DEP_NAME, $(CLIENT_DEPS), $(PRIV_DEPS_DIR)/$(DEP_NAME)/ebin/*) $(CLIENT_PACKAGE_DIR)/ebin
+	cp scripts/* $(CLIENT_PACKAGE_DIR)
+	
+	(cd $(CLIENT_PACKAGE_DIR); zip -r ../../$@ *)
+	
+run_client: $(DIST_DIR)/$(CLIENT_PACKAGE)
+	(cd $(CLIENT_PACKAGE_DIR); ./bql)
 RLWRAP=`which rlwrap`
 
 exec $RLWRAP erl \
-    -pa "`dirname $0`/../ebin" \
-    -pa "`dirname $0`/../build/deps/amqp_client/ebin" \
-    -pa "`dirname $0`/../build/deps/rabbit_common/ebin" \
-    -pa "`dirname $0`/../build/deps/rfc4627_jsonrpc/ebin" \
+    -pa "`dirname $0`/ebin" \
     -noshell \
     -hidden \
     -sname amqpbql$$ \