Skip to content
Browse files

Boilerplate

git-svn-id: http://dev.brendonh.org/svn/veracity/trunk@2 9d18217e-6996-4b5f-b398-a6959e6ab315
  • Loading branch information...
1 parent f8b7332 commit 47817be4ff387620ea56de05102bd4bb2be595b3 @brendonh committed Dec 25, 2008
Showing with 149 additions and 0 deletions.
  1. +63 −0 veracity/Makefile
  2. +11 −0 veracity/ebin/veracity.app
  3. +34 −0 veracity/src/veracity_app.erl
  4. +36 −0 veracity/src/veracity_sup.erl
  5. +5 −0 veracity/veracity.config
View
63 veracity/Makefile
@@ -0,0 +1,63 @@
+PKG_NAME = veracity
+PKG_PREFIX = veracity
+
+SRC_DIR = src
+EBIN_DIR = ebin
+INCLUDE_DIR = include
+TESTS_DIR = tests
+
+SOURCES = $(wildcard $(SRC_DIR)/*.erl)
+TESTS = $(wildcard $(TESTS_DIR)/*.erl)
+INCLUDES = $(wildcard $(INCLUDE_DIR)/*.hrl)
+TARGETS = $(patsubst $(SRC_DIR)/%.erl, $(EBIN_DIR)/%.beam,$(SOURCES))
+
+ERLC_INCLUDES = -I $(INCLUDE_DIR)
+ERLC_EBINS = $(EBIN_DIR)
+
+ERLC = erlc
+ERLC_OPTS = $(ERLC_INCLUDES) -o $(EBIN_DIR) -Wall -v +debug_info
+
+ERLC_ASN_OPTS = -bber_bin +optimize +compact_bit_string -Wall -v +debug_info
+ERLC_ASN = $(ERLC) $(ERLC_ASN_OPTS)
+
+REL_VSN=1
+RELEASE_NAME=$(PKG_NAME)-$(REL_VSN)
+
+ERL_CMD=erl \
+ -boot start_sasl \
+ -config $(PKG_NAME) \
+ +W w \
+ -pa $(ERLC_EBINS)
+
+all: $(TARGETS)
+
+run_prereqs: all
+
+$(RELEASE_NAME).boot: $(RELEASE_NAME).rel
+ env ERL_LIBS=.. erl -s systools make_script $(RELEASE_NAME) local -s init stop
+
+run: run_prereqs
+ $(ERL_CMD) -sname $(PKG_NAME) -s $(PKG_PREFIX)_app
+
+daemon: run_prereqs
+ $(ERL_CMD) -detached -sname $(PKG_NAME) -s $(PKG_PREFIX)_app >> $(PKG_NAME).log 2>&1
+
+boot: run_prereqs $(RELEASE_NAME).boot
+ erl -pa ebin -boot $(RELEASE_NAME) -config $(PKG_NAME)
+
+release: $(RELEASE_NAME).rel
+ env ERL_LIBS=.. erl -s systools make_script $(RELEASE_NAME) -s init stop
+
+stop:
+ erl_call -a '$(PKG_NAME)_app stop_and_halt []' -sname $(PKG_NAME)
+
+clean: cleanlog
+ rm -f $(TARGETS)
+ rm -f $(EBIN_DIR)/*.beam
+ rm -f $(RELEASE_NAME).boot $(RELEASE_NAME).script
+
+cleanlog:
+ rm -f $(PKG_NAME).log auth.log report.log sasl_err.log erl_crash.dump
+
+$(EBIN_DIR)/%.beam: $(SRC_DIR)/%.erl $(INCLUDES)
+ $(ERLC) $(ERLC_OPTS) $<
View
11 veracity/ebin/veracity.app
@@ -0,0 +1,11 @@
+{application, veracity,
+ [{description, "Veracity"},
+ {id, "Veracity"},
+ {vsn, "0.0.1"},
+ {modules, []},
+ {registered, []},
+ {applications, [kernel, stdlib]},
+ {mod, {veracity_app, []}},
+ {env, []}
+]}.
+
View
34 veracity/src/veracity_app.erl
@@ -0,0 +1,34 @@
+%%%-------------------------------------------------------------------
+%%% File : veracity_app.erl
+%%% Author : Brendon Hogger <brendonh@lightblue>
+%%% Description : IRC!
+%%%
+%%% Created : 25 Dec 2008 by Brendon Hogger <brendonh@lightblue>
+%%%-------------------------------------------------------------------
+-module(veracity_app).
+
+-behaviour(application).
+
+%% Application callbacks
+-export([start/2, stop/1]).
+
+%% API
+-export([start/0]).
+
+
+%%====================================================================
+%% Application callbacks
+%%====================================================================
+start(_Type, StartArgs) ->
+ veracity_sup:start_link(StartArgs).
+
+start() ->
+ application:start(veracity).
+
+stop(_State) ->
+ ok.
+
+
+%%====================================================================
+%% Internal functions
+%%====================================================================
View
36 veracity/src/veracity_sup.erl
@@ -0,0 +1,36 @@
+%%%-------------------------------------------------------------------
+%%% File : veracity_sup.erl
+%%% Author : Brendon Hogger <brendonh@lightblue>
+%%% Description :
+%%%
+%%% Created : 25 Dec 2008 by Brendon Hogger <brendonh@lightblue>
+%%%-------------------------------------------------------------------
+-module(veracity_sup).
+
+-behaviour(supervisor).
+
+%% API
+-export([start_link/1]).
+
+%% Supervisor callbacks
+-export([init/1]).
+
+-define(SERVER, ?MODULE).
+
+%%====================================================================
+%% API functions
+%%====================================================================
+start_link(Args) ->
+ supervisor:start_link({local, ?SERVER}, ?MODULE, Args).
+
+
+%%====================================================================
+%% Supervisor callbacks
+%%====================================================================
+init(_Args) ->
+ {ok,{{one_for_one,0,1}, []}}.
+
+
+%%====================================================================
+%% Internal functions
+%%====================================================================
View
5 veracity/veracity.config
@@ -0,0 +1,5 @@
+[
+ {sasl, [
+ {sasl_error_logger, {file, "sasl_err.log"}}
+ ]}
+].

0 comments on commit 47817be

Please sign in to comment.
Something went wrong with that request. Please try again.