example of makefile

Christopher Williams <>
Fri Nov 30 11:15:23 CET 2001


Hi,
You can always download the source code from:
http://www.erlang.org/download.html and fetch a Makefile from there.

Included are 2 files. One is a generic make script "erlang" and the
other is a
is a Makefile (The generic make script "erlang" is included in the
Makefile).
Both scripts have comments on what environment variables you have to set 
to run them.

These scripts is what my project uses to compile our code on a Solaris
platform.
//Chris
Salvador Alcaraz Carrasco wrote:
> 
> 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
> 
> Thank you very much, from Spain
> 
> __________________________________________________________________________
> Salvador Alcaraz Carrasco                   http://www.umh.es
> Division de Ingenieria Telematica           http://obelix.umh.es
> Dpto. Fisica y Arquitectura de Computadores 
> Universidad Miguel Hernandez                
> Avda. del ferrocarril, s/n                  Telf. +34 96 665 8495
> Elche, Alicante (Spain)
> __________________________________________________________________________

-- 
====================================================================
Christopher Williams Phone:    +353 902 31365 
Ericsson Systems     ECN:      83021365
Expertise Limited,   Mob:      +353 87 64 888 04
Athlone,             Fax:      +353 902 31304
Co.Westmeath,	     http://nosc.eei.ericsson.se/pdu_access/Lynx
Ireland              
====================================================================
-------------- next part --------------
#######################################################################
# Generic make script for compiling erlang code                       #
# The environment variable $ERLHOME has to be set to where erlang/OTP #
# is installed                                                        #
# Compiles the code into a ebin dir. relative to the source dir.      #
# (../ebin)                                                           #
####################################################################### 
#Compiles the code into a ebin dir. relative to the source dir. 
EBIN = ../ebin
ERL = erl
GEN = beam
ERLC_EMULATOR = erl -boot start_clean
PATH= .:$(ERLHOME)/bin:/bin:/usr/bin:/usr/local/bin
TARGETS = $(SOURCE:%.erl=$(EBIN)/%.beam)

CODE = $(SOURCE:%.erl=$(EBIN)/%.beam) 

$(EBIN)/%.beam: %.erl
	$(ERLHOME)/bin/erlc  -W -b beam -o $(EBIN) $(EFLAGS) $(WAIT) $<

 

all: $(TARGETS)
 

   
clean:
	\rm -f $(CODE) 


realclean: clean
	\rm -f \.* *~ *\% #*  *.beam




-------------- next part --------------
#######################################################################
# Template of for compiling erlang files                              #
# The environment variable  $TOOLSHOME home has to be set to where    #  
# the generic make script is installed (erlang).                      #
#######################################################################
# code to compile
SOURCE =dummy1.erl \
	dummy2.erl

#Where include files are stored ".hrl"
EFLAGS = -I../include \
	 -I../dummy1/include

#######################################################################
# Do not edit below this line                                         #
#######################################################################
#Include following generic make script
include $(TOOLSHOME)/erlang



More information about the erlang-questions mailing list