Added Makefile rule to build tz_index.hrl.

This commit is contained in:
David Hull 2014-01-09 16:11:18 -08:00
parent fd54c471a7
commit 4ad81b03fd
2 changed files with 13 additions and 2 deletions

View file

@ -1,2 +1,9 @@
all: all: include/tz_index.hrl
./rebar compile ./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

6
src/ibuild.erl Normal file → Executable file
View file

@ -1,6 +1,6 @@
-module(ibuild). -module(ibuild).
-export([build_index/0]). -export([build_index/0, main/1]).
-include("tz_database.hrl"). -include("tz_database.hrl").
@ -22,3 +22,7 @@ build_index() ->
I = lists:foldl(F, dict:new(), ?tz_database), I = lists:foldl(F, dict:new(), ?tz_database),
{ok, File} = file:open("tz_index.hrl", [write]), {ok, File} = file:open("tz_index.hrl", [write]),
io:fwrite(File, "-define(tz_index, ~p).", [I]). io:fwrite(File, "-define(tz_index, ~p).", [I]).
%% So this can be run from escript:
main(_Args) ->
build_index().