2009-10-17 9 views

Antwort

24

Da diese Antworten, ein neuer Standard in der Erlang-Community entstanden ist:

Rebar https://github.com/basho/rebar/

+4

Es ist zwar kein Standard, aber ein Beitrag. Erlangs Marke ist ein Standard, weil es in der Distribution enthalten ist. – tuscland

6

Hier ist das Makefile und Emakefile ich normalerweise mit make (Herkunft unbekannt).

Makefile:

ERL=erl 
APPFILE=myApp.app 

all: ebin/$(APPFILE) 
    $(ERL) -make 

ebin/$(APPFILE): src/$(APPFILE) 
    cp $< [email protected] 

Emakefile:

{"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}. 
7

Ich benutze ein Rakefile ein Emakefile aufrufen. Rakefile für Flexibilität und Emakefile für Geschwindigkeit!

Das Build-System sehr mächtig ist, siehe erl_rake auf GitHub

Dateien generiert .app, baut automatisch Versionen läuft EUnit Test. Und da es um ein Rakefile herum gebaut ist, habe ich einfach Pushing Release zu AWS hinzugefügt und führe stattdessen meine Tests mit Etap aus.

Ich habe eine alte Version für meine Github-Projekte angepasst.

+0

Ihr Github Link ist 404. –

+1

Dank Thom. Obwohl dieser Kommentar veraltet ist. Wie alle anderen benutze ich jetzt Betonstahl – cstar

15

Wir verwenden eine ähnliche Emakefile.

{"src/*", [debug_info, {outdir, "ebin"}, {i, "include"}]}. 

Ich benutze die Erlang-Make-Funktionalität, um Tests nach erfolgreicher Kompilierung auszuführen.

Makefile-Extrakt:

all: compile 

compile: 
     erlc -o ebin +debug_info erl_make.erl  
     erl -pa ./ebin -eval "erl_make:make(development)" -s init stop -noshell 

erl_make.erl

-module(erl_make). 

-export([make/1]). 

make(Mode) -> 
    case make:all([{d, Mode}]) of 
     error -> 
      error; 
     _ -> 
      test_suite:test() 
    end. 
+0

Danke für diese großartige Antwort! =) –

1

Sie können meine Makefiles überprüfen, nahm ich sie aus mochiweb oder so ähnlich. Sorry, aber Code haben einige Projekt angegebenen Teile

http://github.com/JLarky/eadc-hub/blob/master/Makefile

 
MARKDOWN_SOURCES=$(wildcard doc/*.md) 
MARKDOWN_TARGETS=$(patsubst doc/%.md,doc/html/%.html,$(MARKDOWN_SOURCES)) 

all: eadc boot deps 

eadc: ebin 
cd src && $(MAKE) 

deps: 
(cd deps/somedeps;$(MAKE);) 

docs: erlang-docs # html-docs 

erlang-docs: doc/edoc 
(cd src;$(MAKE) docs) 

html-docs: doc/html $(MARKDOWN_TARGETS) 

doc/edoc: 
mkdir -p doc/edoc 

doc/html: 
mkdir -p doc/html 

doc/html/%.html: doc/%.md 
(title=`grep '^# ' $ [email protected] ;\ 
python doc/buildtoc.py $$t ;\ 
markdown $$t >> [email protected] ;\ 
rm $$t ;\ 
cat doc/footer.html >> [email protected]) 

ebin: 
mkdir -p ebin 

clean: clean-docs 
(cd src;$(MAKE) clean) 
(cd deps/*/; $(MAKE) clean) 
$(RM) -r priv 
$(RM) ebin/*.boot ebin/*.script ebin/*crash.dump ebin/*~ src/*~ priv/*~ *~ \#*\# 

clean-docs: clean-html 
$(rm) -rf doc/edoc 

clean-html: 
rm -rf doc/html 

boot: ebin/eadc.boot 

ebin/eadc.boot: ebin/eadc.rel ebin/eadc.app 
erl -pa ebin -noshel -run eadc_utils make_script -run erlang halt 

cleandb: 
$(RM) -r ebin/Mnesia* 

http://github.com/JLarky/eadc-hub/blob/master/support/include.mk

 
## -*- makefile -*- ## Erlang 

ERL := erl 
ERLC := $(ERL)c 

INCLUDE_DIRS := ../include $(wildcard ../deps/*/include) 
EBIN_DIRS := $(wildcard ../deps/*/ebin) 
ERLC_FLAGS := -W $(INCLUDE_DIRS:../%=-I ../%) $(EBIN_DIRS:%=-pa %) 

ifndef no_debug_info 
    ERLC_FLAGS += +debug_info 
endif 

ifdef debug 
    ERLC_FLAGS += -Ddebug 
endif 

EBIN_DIR := ../ebin 
DOC_DIR := ../doc/edoc 
EMULATOR := beam 

ERL_SOURCES := $(wildcard *.erl) 
ERL_HEADERS := $(wildcard *.hrl) $(wildcard ../include/*.hrl) 
ERL_OBJECTS := $(ERL_SOURCES:%.erl=$(EBIN_DIR)/%.$(EMULATOR)) 
ERL_DOCUMENTS := $(ERL_SOURCES:%.erl=$(DOC_DIR)/%.html) 
ERL_OBJECTS_LOCAL := $(ERL_SOURCES:%.erl=./%.$(EMULATOR)) 
APP_FILES := $(wildcard *.app) 
REL_FILES := $(wildcard *.rel) 
EBIN_FILES_NO_DOCS = $(ERL_OBJECTS) $(APP_FILES:%.app=../ebin/%.app) $(REL_FILES:%.rel=../ebin/%.rel) 
EBIN_FILES = $(ERL_DOCUMENTS) $(EBIN_FILES_NO_DOCS) 

MODULES = $(ERL_SOURCES:%.erl=%) 

../ebin/%.app: %.app 
cp $ 

http://github.com/JLarky/eadc-hub/blob/master/src/Makefile

 
include ../support/include.mk 

all: $(EBIN_FILES_NO_DOCS) 

docs: $(ERL_DOCUMENTS) 
*emphasized text* 
debug: 
$(MAKE) DEBUG=-DDEBUG 

clean: 
rm -rf $(EBIN_FILES) $(PLUGINS_OBJECTS) 
4

ich mein eigenes Werkzeug vorschlagen :) Eake ...sehr ähnlich ist von Ruby-Umgebung rechen:

http://github.com/andrzejsliwa/eake

oder

http://andrzejsliwa.com/2009/05/28/eake-narzedzie-budowania-dla-erlanga-bazujace-na-rake/

Hier ist Beispiel eakefile

 
-module(eakefile). 
-compile([export_all]). 
-import(eake, [task/3, namespace/3, run_target/2, run/1]). 

execute() -> [ 

    namespace(db, "test", [ 
    task(migrate, "That is migration", fun(Params) -> 
     io:format("in migration params: ~w", [Params]), 
     run_target('db:rollback', []) 
    end), 

    task(rollback, "That is rollback", fun(_) -> 
     io:format("in rollback"), 
     run("ls") 
    end) 
    ]) 
]. 

und dies am Beispiel:

 
$ eake db:migrate 
$ eake db:migrate db:rollback 
$ eake db:migrate=[1,atom] 
$ eake db:migrate=name 
2

Verwenden Sie Sinan für Gebäude und Faxien für die Installation! Schau dir erlware.org an. Sie sind viel besser als eine Make-Datei und bieten eine einfache Verteilung. Sie sind beide in schweren aktiven Entwicklung und wird in gekennzeichnet werden: http://www.manning.com/logan/

Verwandte Themen