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

#TARGET=c_src/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: 
	@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)"
	@echo "  make clean (make c) - clean all"
	@echo ""
	@echo "notice: depending on OS, you'd edit thid Makefile. see README.txt for details."
	@echo "        and you should tell erlc/erl the right path to erl_interface, libei_st.a"

b: build
build: $(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: test
test: $(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."

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