diff --git a/Makefile b/Makefile index 04d1de1..1022b4b 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,9 @@ -all: +all: include/tz_index.hrl ./rebar compile + +check: + ./rebar eunit + +include/tz_index.hrl: src/ibuild.erl include/tz_database.hrl + cd include && ln -s ../src/ibuild.erl && escript ibuild.erl; EV=$$?; rm ibuild.erl; exit $$EV + diff --git a/src/ibuild.erl b/src/ibuild.erl old mode 100644 new mode 100755 index ab1f1fa..3334c1d --- a/src/ibuild.erl +++ b/src/ibuild.erl @@ -1,6 +1,6 @@ -module(ibuild). --export([build_index/0]). +-export([build_index/0, main/1]). -include("tz_database.hrl"). @@ -22,3 +22,7 @@ build_index() -> I = lists:foldl(F, dict:new(), ?tz_database), {ok, File} = file:open("tz_index.hrl", [write]), io:fwrite(File, "-define(tz_index, ~p).", [I]). + +%% So this can be run from escript: +main(_Args) -> + build_index().