Reputation: 41
I've created an erlang application where I can use application:start(Name) to successfully start the application.
I tried to create a makefile step that uses rebar to compile, and then manually start the application. But it doesn't seem to work. Here's what I have now:
all: compile start
compile:
./rebar compile
start:
erl -s application load shoutcast -s application start shoutcast
All this does is loads up an interactive erlang shell
Upvotes: 1
Views: 671
Reputation: 612
It could be better to keep useful things in common Makefile https://github.com/virtan/erlang-makefile
Upvotes: 0
Reputation: 2173
Aplication:start(Name)
calls
Name:start/2
while the -s flag calls
Name:start() or Name:start([arg1, arg2, ...]).
So, I don't think you can successfully invoke Application in this way. Assuming you don't want to create a release and boot file, you could (I think) add a method to you application module, start/0
-module(shoutcast).
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).
%% Allow for erl -s invocation
-export([start/0]).
... Snip ...
start() ->
application:start(shoutcast).
... Snip ...
Then within your makefile
erl -s shoutcast
I'm not sure if this violates a best practice, but it should work.
Upvotes: 2