example of makefile
Luke Gorrie
luke@REDACTED
Fri Nov 30 13:51:36 CET 2001
Salvador Alcaraz Carrasco <salcaraz@REDACTED> writes:
> Please, could you send me a example of makefile for compile serveral
> erlang files and .hrl files (with dependencies).
>
> For example:
>
> file1.hrl
>
> and
>
> file2.erl and file3.erl (these files depending of file1.hrl).
>
> and beam file: myfile.beam
I tried to make a generic one recently:
ERLDIR := /usr/local/lib/erlang
OBJDIR := ../ebin
ERLC_FLAGS := -o $(OBJDIR)
SRC := $(wildcard *.erl)
HEADERS := $(wildcard *.hrl)
EOBJS := $(SRC:%.erl=$(OBJDIR)/%.beam)
all: $(EOBJS)
## play it safe: rebuild all when header changes
$(OBJDIR)/%.beam: %.erl $(HEADERS)
erlc $(ERLC_FLAGS) $<
clean:
rm $(EOBJS)
Improvements welcome, it'd be nice to have a "plug and play" safe
makefile. This one should probably automatically depend on
../include/*.hrl and other stuff too no doubt.
-Luke
More information about the erlang-questions
mailing list