Skip to content

Commit

Permalink
Added Makefile rule to build tz_index.hrl.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hull committed Jan 11, 2014
1 parent fd54c47 commit 4ad81b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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

6 changes: 5 additions & 1 deletion src/ibuild.erl
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-module(ibuild).

-export([build_index/0]).
-export([build_index/0, main/1]).

-include("tz_database.hrl").

Expand All @@ -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().

0 comments on commit 4ad81b0

Please sign in to comment.