annotate erlang/erldc/Makefile @ 2:a27ef6fdc275

- assume dyncall dir is next to maintainers'
author cslag
date Thu, 31 Dec 2015 20:20:18 +0100
parents 0cfcc391201f
children 079718588eb6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 # ERLANG_INC is used for -I, below, so add paths where it might be on linux, freebsd, etc.
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 ERLANG_INC=-I /usr/lib64/erlang/usr/include -I /usr/local/lib/erlang/usr/include
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 DYNCALL_SRC_PATH=../../../dyncall
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 # Be sure to 'make clean' after changing the version
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 VERSION=0.1
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 OUTPUTS = priv/erldc.so ebin/dyncall.beam ebin/erldc.app
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 # Used by install target. Default empty DESTDIR is for a real install to root filesystem (/).
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 # Override DESTDIR for testing or for a staged install
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 DESTDIR=
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 ERLANG_INST_DIR=/usr/lib64/erlang
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 all: $(OUTPUTS)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 priv/erldc.so: c_src/dyncallnif.c
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 [ -d priv ] || mkdir priv
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 cc -o $@ -fPIC -shared \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 $(ERLANG_INC) -I $(DYNCALL_SRC_PATH) \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 $(DYNCALL_SRC_PATH)/dyncall/*.o \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 c_src/dyncallnif.c
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 priv/erldc_testtargets.so: c_src/erldctesttargets.c
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 [ -d priv ] || mkdir priv
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 cc -o $@ -shared -fPIC c_src/erldctesttargets.c
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 ebin/dyncall.beam: src/dyncall.erl
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 erlc +debug_info -o ebin src/dyncall.erl
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 ebin/erldc.app: src/erldc.app.src
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 sed -e 's/---VERSION---/$(VERSION)/' src/erldc.app.src >$@
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 # Dialyzer, credit to erlang.mk
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 -Wunmatched_returns # -Wunderspecs
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 build-plt:
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 rm -f test/*.beam
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 dialyzer --build_plt --output_plt dyncall.plt \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 --apps erts kernel stdlib .
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 dialyze: $(OUTPUTS)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 dialyzer --src src --plt dyncall.plt --no_native $(DIALYZER_OPTS)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 tests: $(OUTPUTS) priv/erldc_testtargets.so
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 mkdir -p log
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 # Add priv to runtime ld path so we get test targets
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 export LD_LIBRARY_PATH=$$(pwd)/priv:${LD_LIBRARY_PATH}; \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 ct_run -pa ebin -logdir log \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 -suite linkload_SUITE call_SUITE \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 misc_SUITE callf_SUITE
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 rm -f test/*.beam
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 clean:
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 rm -rf priv ebin/* test/*.beam log
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 # Convention appears to be install binaries and source, but not tests or build-related things
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 install: $(OUTPUTS)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 appdir=$(DESTDIR)$(ERLANG_INST_DIR)/lib/erldc-$(VERSION); \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 install -d $$appdir $$appdir/ebin $$appdir/priv $$appdir/src $$appdir/c_src $$appdir/include; \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 install README.txt $$appdir; \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 install src/*.erl $$appdir/src; \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 install include/*.hrl $$appdir/include; \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 install c_src/*.c $$appdir/c_src; \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 install ebin/* $$appdir/ebin; \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 install priv/erldc.so $$appdir/priv
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 uninstall:
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 appdir=$(DESTDIR)$(ERLANG_INST_DIR)/lib/erldc-$(VERSION); \
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 rm -rf $$appdir
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 .PHONY: clean all tests build-plt dialyze install uninstall