Source

yatce / Makefile

Full commit
##   yatce
##   Copyright (C) 2009   UENISHI Kota <kuenishi+yatce@gmail.com>

##     This program is free software: you can redistribute it and/or modify
##     it under the terms of the GNU Lesser General Public License as published by
##     the Free Software Foundation, either version 3 of the License, or
##     (at your option) any later version.

##     This program is distributed in the hope that it will be useful,
##     but WITHOUT ANY WARRANTY; without even the implied warranty of
##     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##     GNU Lesser General Public License for more details.

##     You should have received a copy of the GNU Lesser General Public License
##     along with this program.  If not, see <http://www.gnu.org/licenses/>.

include vsn.mk

TARGET2=ebin/erl_tc_driver.so
TARGET=c_src/libyatce.so
#BEAMS=tcadb.beam
ifndef ROOT
  ROOT=$(shell pwd)
endif

COMMON_TEST_LIB = $(shell erl -noshell -eval 'io:format("~s~n", [code:lib_dir(common_test)]).' -s init stop)
#TEST_SERVER_LIB = $(shell erl -noshell -eval 'io:format("~s~n", [code:lib_dir(test_server)]).' -s init stop)
RUN_TEST_CMD = $(COMMON_TEST_LIB)/priv/bin/run_test

ifeq ($(shell uname),Linux)
	ARCH = linux
#	LDFLAGS = $(LDFLAGS_COMMON) -shared
else
	ARCH = macosx
#	LDFLAGS = $(LDFLAGS_COMMON) -dynamic -bundle -undefined suppress -flat_namespace
endif



all: build
	@echo "this is yatce $(YATCE_VSN)."
	@echo "usage:"
	@echo "  make build (make b) - build all source code into *.beam/*.so"
	@echo "  make test  (make t) - basic automated test. all operations will be checked."
	@echo "  make perf  (make p) - performance test (not supported yet)"
	@echo "  make clean (make c) - clean all"

b: build
build: so beam

so:
	cd c_src && make
beam:
	cd src && erl -make -smp -Wall

##$(TARGET): # c_src/Makefile
##	cd c_src && make

t: test
test: build
	@echo "testing in ${ROOT} .."
	@mkdir -p test/log
	sh ${RUN_TEST_CMD}  -dir ${ROOT}/test -logdir ${ROOT}/test/log \
	  -I ${ROOT}/include -I ${ROOT}/src \
	  -cover ${ROOT}/test/yatce.coverspec  -pa ${ROOT}/ebin
	@echo "automated test done. see test/log/index.html."

c: clean
clean:
	cd c_src && make clean
	@rm -rf ebin/*.beam


NUM_THREAD=4
NUM_REPEAT=65536
p: perf
perf: build test/log
	@echo "performance test with ${NUM_THREAD} concurrency for ${NUM_REPEAT} reputation: "
#	@erl +Ktrue +A 8 -pa ${ROOT}/ebin -noshell -eval 'performer:start("c_src", ${NUM_THREAD}, ${NUM_REPEAT}).' -s init stop
	erl +Ktrue +A 8 -pa ${ROOT}/ebin -noshell -eval "supervisor:start_link({local,perf_sup},perf_sup, ['/tmp/sup_test.tch',  ${NUM_THREAD}])." #-s init stop
##    {ok,Pid}=supervisor:start({local, ?SERVER_NAME}, perf_sup,['/tmp/sup_test.tch', 1]),