Permalink
Browse files

Updated the buildsystem

Makefiles no longer have hard-coded paths and instead rely on `erl
-eval` to grab the necessary directory paths.

sqlite:create_cmd() now uses code:priv_lib(sqlite) to figure out where
sqlite_port is located.

Had to rename the test/sqlite_test_SUITE.erl module to get `make doc`
working.
  • Loading branch information...
davisp committed May 31, 2009
1 parent 9ab70fc commit e3db712b9c0c95344f00723b497b2589c19deacc
Showing with 27 additions and 7 deletions.
  1. +4 −0 .gitignore
  2. +19 −4 Makefile
  3. +2 −1 priv/Makefile
  4. +1 −1 src/sqlite.erl
  5. +1 −1 src/test/sqlite_test_SUITE.erl
View
@@ -0,0 +1,4 @@
+doc/
+ebin/
+priv/*.o
+*.plt
View
@@ -1,15 +1,30 @@
-ERL=erl
-OTP_TOP=/opt/local/lib/erlang/lib
-PLT_SRC=$(OTP_TOP)/kernel-2.12.4/ebin $(OTP_TOP)/stdlib-1.15.4/ebin/ $(OTP_TOP)/crypto-1.5.2.1/ebin $(OTP_TOP)/compiler-4.5.4/ebin $(OTP_TOP)/hipe-3.6.8/ebin/ $(OTP_TOP)/syntax_tools-1.5.5/ebin $(OTP_TOP)/hipe-3.6.8/ebin ebin
+VERSION=1.0.0
+
+ERL=$(shell which erl)
+ERLC=$(shell which erlc)
+BASE_PROG='io:format("~s~n", [code:lib_dir()])'
+BASE=$(shell erl -eval $(BASE_PROG) -s init stop -noshell)
+
+DEPS="[kernel, stdlib, crypto, compiler, syntax_tools, hipe]"
+PROG='lists:foreach(fun(M) -> io:format("~s", [code:lib_dir(M)]) end)'
+PATHS=`erl -eval '$(PROG)' -s init stop -noshell`
+
+INSTALL_DEST=$(BASE)/sqlite-$(VERSION)
all: compile docs
compile:
$(ERL) -make
cd priv && make
+install: compile
+ mkdir -p $(INSTALL_DEST)/ebin
+ install ebin/sqlite.beam ebin/sqlite_lib.beam $(INSTALL_DEST)/ebin
+ mkdir -p $(INSTALL_DEST)/priv
+ install priv/sqlite_port $(INSTALL_DEST)/priv
+
static:
- dialyzer --build_plt --output_plt sqlite.plt -r ebin $(PLT_SRC)
+ dialyzer --build_plt --output_plt sqlite.plt -r ebin $(PATHS)
clean:
- rm -rf ebin/*.beam doc/* sqlite.plt src/test/*.beam
View
@@ -1,4 +1,5 @@
-OTP_DIR=/opt/local/lib/erlang/lib/erl_interface-3.5.5.3
+PROG='io:format("~s~n", [code:lib_dir(erl_interface)])'
+OTP_DIR=$(shell erl -eval $(PROG) -s init stop -noshell)
LIB=-lsqlite3 -lerl_interface -lei
FLAGS=-I$(OTP_DIR)/include -L$(OTP_DIR)/lib
GCC=/usr/bin/gcc
View
@@ -442,7 +442,7 @@ code_change(_OldVsn, State, _Extra) ->
%%--------------------------------------------------------------------
create_cmd(Dbase) ->
- "sqlite_port " ++ Dbase.
+ code:priv_dir(sqlite) ++ "/sqlite_port " ++ Dbase.
exec(Port, Cmd) ->
port_command(Port, term_to_binary(Cmd)),
@@ -5,7 +5,7 @@
%%%
%%% Created : 4 Sep 2008 by Tee Teoh <tteoh@teemac.ott.cti.com>
%%%-------------------------------------------------------------------
--module(sqlite_test_SUITE).
+-module(test.sqlite_test_SUITE).
%% Note: This directive should only be used in test suites.
-compile(export_all).

0 comments on commit e3db712

Please sign in to comment.