diff --git a/Makefile b/Makefile index b0362c8..d898c6b 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,45 @@ -PROJECT=getopt -ERL=erl -ERLC=erlc -I include -v -o ebin -SOURCES=src/*.erl -EPATH=-pa ebin -DOC_OPTS={dir, \"doc\"}, {includes, [\"include\"]}, {source_path, [\"include\", \"src\"]} +APPLICATION := getopt -all: - @mkdir -p ebin - @$(ERL) $(EPATH) -make +ERL := erl +EPATH := -pa ebin +TEST_EPATH := -pa .eunit -run: all - $(ERL) -sname "$(PROJECT)" $(EPATH) +DIALYZER=dialyzer +DIALYZER_OPTS=-Wno_return -Wrace_conditions -Wunderspecs -Wbehaviours +PLT_FILE=.getopt_plt +APPS=kernel stdlib -test: all - @$(ERL) -noshell $(EPATH) -s $(PROJECT)_test test -s init stop +.PHONY: all clean test -example: all - @$(ERL) -noshell $(EPATH) -s ex1 test -s init stop +all: compile -docs: all - @$(ERL) -noshell $(EPATH) \ - -eval "edoc:files(filelib:wildcard(\"$(SOURCES)\"), [$(DOC_OPTS)])" \ - -s init stop +compile: + @./rebar compile + +doc: + @./rebar doc + +plt: compile + $(DIALYZER) --build_plt --output_plt $(PLT_FILE) --apps $(APPS) ebin + +check_plt: compile + $(DIALYZER) --check_plt --plt $(PLT_FILE) --apps $(APPS) ebin + +analyze: compile + $(DIALYZER) --plt $(PLT_FILE) $(DIALYZER_OPTS) -r ebin clean: - rm -fv ebin/*.beam - rm -fv erl_crash.dump ebin/erl_crash.dump + @./rebar clean -distclean: - rm -fv ebin/*.beam - rm -fv doc/* - rm -fv erl_crash.dump ebin/erl_crash.dump +test: + @./rebar eunit + +dialyzer: + @./rebar analyze + +shell: compile + $(ERL) -sname $(APPLICATION) $(EPATH) + +testshell: test + $(ERL) -sname $(APPLICATION)_test $(TEST_EPATH) -docclean: - rm -fv doc/* diff --git a/README.markdown b/README.markdown index a4a86e1..9d497d8 100644 --- a/README.markdown +++ b/README.markdown @@ -20,7 +20,7 @@ To run the unit tests run ``make test``. To run the example module run ``make example``. -To build the (very) limited documentation run ``make docs``. +To build the (very) limited documentation run ``make doc``. Usage diff --git a/ebin/getopt.app b/ebin/getopt.app index 77be3f5..480b879 100644 --- a/ebin/getopt.app +++ b/ebin/getopt.app @@ -2,7 +2,7 @@ {application, getopt, [{description, "Options parser for Erlang"}, - {vsn, "0.1.1"}, + {vsn, "0.3.0"}, {modules, [getopt]}, {registered, []}, {applications, [kernel, stdlib]}]}. diff --git a/rebar b/rebar new file mode 100755 index 0000000..ff20272 Binary files /dev/null and b/rebar differ diff --git a/rebar.config b/rebar.config new file mode 100644 index 0000000..40fee49 --- /dev/null +++ b/rebar.config @@ -0,0 +1,2 @@ +{erl_first_files, ["src/getopt.erl"]}. +{erl_opts, [debug_info, fail_on_warning]}.