public
Description: Simple hello world example. Use this project as a template.
Homepage:
Clone URL: git://github.com/cadar/hello-lfe.git
hello-lfe / Makefile
100644 41 lines (33 sloc) 1.578 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
MAIN=hello
LFE_EBIN=${HOME}/lfe/ebin/
ERL_LOAD='code:load_file(lfe_comp).'
ERL_COMP='File=hd(init:get_plain_arguments()), try lfe_comp:file(File,[report,{outdir,"."}]) of {ok,_Module} -> halt(0); error -> halt(1); All -> io:format("./~s:1: ~p~n",[File,All]) catch X:Y -> io:format("./~s:1: Catch outside of compiler: ~p ~p ~n",[File,X,Y]) end, halt(1).'
 
all: ${MAIN}.beam start
 
%.beam : %.lfe
@echo Recompile: $<
@erl -pa ${LFE_EBIN} -noshell -eval $(ERL_LOAD) -eval $(ERL_COMP) -extra $<
 
start: ${MAIN}.beam
@erl -noshell -pa ${LFE_EBIN} -eval 'code:load_file(${MAIN}).' -eval '${MAIN}:start().' -s erlang halt
 
clean:
@rm -f *.beam *.dump *.out *.err
 
# syntax-check works only on main file.
# Solution: Work in main, Iron out to sub files. :(
check-syntax:
@erl -noshell -pa ${LFE_EBIN} \
-eval 'code:load_file(lfe_comp).' \
-eval 'File=hd(init:get_plain_arguments()), \
try lfe_comp:file(File) of \
{ok,_Module} -> halt(0); \
error -> halt(0); \
All -> io:format("./~s:1: ~p (All)~n",[File,All]) \
catch X:Y -> io:format("./~s:1: Makefile catch: ~p ~p~n", [File,X,Y]) end, \
halt(0).' \
-extra ${MAIN}_flymake.lfe 2> compile.err | sed 's/:none:/:1:/' | tee compile.out
rm ${MAIN}_flymake.beam
 
 
help:
@echo ";; Copy to .emacs, then restart."
@echo "(when (load \"flymake\" t)"
@echo " (setq flymake-log-level 3)"
@echo " (add-hook 'find-file-hook 'flymake-find-file-hook)"
@echo " (add-to-list 'flymake-allowed-file-name-masks"
@echo " '(\"\\\\\.lfe\\\\\'\" flymake-simple-make-init)))"