From 4ad81b03fd72d0a846046c7888d14db7c602688d Mon Sep 17 00:00:00 2001 From: David Hull Date: Thu, 9 Jan 2014 16:11:18 -0800 Subject: [PATCH] Added Makefile rule to build tz_index.hrl. --- Makefile | 9 ++++++++- src/ibuild.erl | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/ibuild.erl 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().