Source

yatce / Makefile

Full commit
##   yatce
##   Copyright (C) 2009   kuenishi+yatce@gmail.com

##     This program is free software: you can redistribute it and/or modify
##     it under the terms of the GNU 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 General Public License for more details.

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

TARGET=c_src/erl_tc_driver.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


all: $(TARGET) beam

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

c_src/Makefile: 
## on Mac
#	sed -e 's/__INCLUDE__/MacOS\.mk/'  c_src/Makefile.in > $@
## on Ubuntu / Debian
	sed -e 's/__INCLUDE__/Ubuntu\.mk/'  c_src/Makefile.in > $@
## on CentOS, other linux which erts directly installed in /usr/local
#	sed -e 's/__INCLUDE__/CentOS\.mk/'  c_src/Makefile.in > $@

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

t: $(TARGET) beam
	@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 -pa ${ROOT}/ebin
	@echo "automated test done. see test/log/index.html."

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