Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 280 lines (220 sloc) 8.563 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279

REBAR?=./rebar

OTPREL=$(shell erl -noshell -eval 'io:format(erlang:system_info(otp_release)), halt().')
PLT=$(HOME)/.dialyzer_plt.$(OTPREL)

ERLDIRS?=./deps
ERLEUNITDIRS=`find $(ERLDIRS) -name .eunit -print | xargs echo` .eunit
ERLQCDIRS=`find $(ERLDIRS) -name .qc -print | xargs echo` .qc

DIALYZE_IGNORE_WARN?=dialyze-ignore-warnings.txt
DIALYZE_NOSPEC_IGNORE_WARN?=dialyze-nospec-ignore-warnings.txt

#TBD DIALYZER_OPTS?=-Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspecs
DIALYZER_OPTS?=-Wunmatched_returns -Werror_handling -Wunderspecs
DIALYZER_NOSPEC_OPTS?=-Wno_undefined_callbacks

dialyzer=dialyzer -q --plt $(PLT) $(DIALYZER_OPTS) -r $(ERLDIRS)
dialyzer-nospec=dialyzer -q --plt $(PLT) --no_spec $(DIALYZER_NOSPEC_OPTS) -r $(ERLDIRS)
dialyzer-eunit=dialyzer -q --plt $(PLT) $(DIALYZER_OPTS) -r $(ERLEUNITDIRS)
dialyzer-eunit-nospec=dialyzer -q --plt $(PLT) --no_spec $(DIALYZER_NOSPEC_OPTS) -r $(ERLEUNITDIRS)
dialyzer-qc=dialyzer -q --plt $(PLT) $(DIALYZER_OPTS) -r $(ERLQCDIRS)
dialyzer-qc-nospec=dialyzer -q --plt $(PLT) --no_spec $(DIALYZER_NOSPEC_OPTS) -r $(ERLQCDIRS)

ifeq ($(shell uname -s),Darwin)
ifeq ($(shell uname -m),x86_64)
otp_configure_flags= --enable-darwin-64bit
else
otp_configure_flags= --enable-darwin-universal
endif
else
otp_configure_flags=
endif

.PHONY: all clean deps compile xref doc test eunit eqc eqcmini proper triq \
compile-for-eunit compile-for-eqc compile-for-eqcmini compile-for-proper compile-for-triq \
ctags etags \
dialyze dialyze-nospec \
update-dialyzer-baseline update-dialyzer-nospec-baseline \
dialyze-eunit dialyze-eunit-nospec \
dialyze-eqc dialyze-eqc-nospec \
dialyze-eqcmini dialyze-eqcmini-nospec \
dialyze-proper dialyze-proper-nospec \
dialyze-triq dialyze-triq-nospec \
build-plt check-plt \
otp_make_release_tests otp_run_release_tests

all: compile

deps:
$(REBAR) get-deps

clean:
$(REBAR) clean
@rm -f TAGS

compile:
$(REBAR) compile

xref:
$(REBAR) xref

doc:
@rm -rf README.md doc/edoc-info doc/*.md
$(REBAR) -C rebar.config.doc get-deps compile
$(REBAR) -C rebar.config.doc doc

test: eunit

eunit: compile-for-eunit
$(REBAR) eunit

eqc: compile-for-eqc
$(REBAR) eqc

eqcmini: compile-for-eqcmini
$(REBAR) eqc

proper: compile-for-proper
@echo "rebar does not implement a 'proper' command" && false

triq: compile-for-triq
$(REBAR) triq

compile-for-eunit:
$(REBAR) compile eunit compile_only=true

compile-for-eqc:
$(REBAR) -D QC -D QC_EQC compile eqc compile_only=true

compile-for-eqcmini:
$(REBAR) -D QC -D QC_EQCMINI compile eqc compile_only=true

compile-for-proper:
$(REBAR) -D QC -D QC_PROPER compile eqc compile_only=true

compile-for-triq:
$(REBAR) -D QC -D QC_TRIQ compile triq compile_only=true

#
# tags
#

ctags:
find $(ERLDIRS) -name "*.[he]rl" -print | fgrep -v .eunit | fgrep -v .qc | ctags -
find $(ERLDIRS) -name "*.app.src" -print | fgrep -v .eunit | fgrep -v .qc | ctags -a -
find $(ERLDIRS) -name "*.config" -print | fgrep -v .eunit | fgrep -v .qc | ctags -a -
find $(ERLDIRS) -name "*.[ch]" -print | fgrep -v .eunit | fgrep -v .qc | ctags -a -
find $(ERLDIRS) -name "*.cc" -print | fgrep -v .eunit | fgrep -v .qc | ctags -a -
find $(ERLDIRS) -name "*.con" -print | fgrep -v .eunit | fgrep -v .qc | ctags -a -

etags:
find $(ERLDIRS) -name "*.[he]rl" -print | fgrep -v .eunit | fgrep -v .qc | etags -
find $(ERLDIRS) -name "*.app.src" -print | fgrep -v .eunit | fgrep -v .qc | etags -a -
find $(ERLDIRS) -name "*.config" -print | fgrep -v .eunit | fgrep -v .qc | etags -a -
find $(ERLDIRS) -name "*.[ch]" -print | fgrep -v .eunit | fgrep -v .qc | etags -a -
find $(ERLDIRS) -name "*.cc" -print | fgrep -v .eunit | fgrep -v .qc | etags -a -
find $(ERLDIRS) -name "*.con" -print | fgrep -v .eunit | fgrep -v .qc | etags -a -

#
# dialyzer
#

dialyze: build-plt clean compile
-$(dialyzer) | grep -v '^ *$$' | tee $(DIALYZE_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_IGNORE_WARN)

dialyze-nospec: build-plt clean compile
-$(dialyzer-nospec) | grep -v '^ *$$' | tee $(DIALYZE_NOSPEC_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_NOSPEC_IGNORE_WARN)

update-dialyzer-baseline: dialyze
mv -f $(DIALYZE_IGNORE_WARN).log $(DIALYZE_IGNORE_WARN)

update-dialyzer-nospec-baseline: dialyze-nospec
mv -f $(DIALYZE_NOSPEC_IGNORE_WARN).log $(DIALYZE_NOSPEC_IGNORE_WARN)

dialyze-eunit: build-plt clean compile-for-eunit
-$(dialyzer-eunit) | grep -v '^ *$$' | tee $(DIALYZE_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_IGNORE_WARN)

dialyze-eunit-nospec: build-plt clean compile-for-eunit
-$(dialyzer-eunit-nospec) | grep -v '^ *$$' | tee $(DIALYZE_NOSPEC_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_NOSPEC_IGNORE_WARN)

dialyze-eqc: build-plt clean compile-for-eqc
-$(dialyzer-qc) | grep -v '^ *$$' | tee $(DIALYZE_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_IGNORE_WARN)

dialyze-eqc-nospec: build-plt clean compile-for-eqc
-$(dialyzer-qc-nospec) | grep -v '^ *$$' | tee $(DIALYZE_NOSPEC_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_NOSPEC_IGNORE_WARN)

dialyze-eqcmini: build-plt clean compile-for-eqcmini
-$(dialyzer-qc) | grep -v '^ *$$' | tee $(DIALYZE_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_IGNORE_WARN)

dialyze-eqcmini-nospec: build-plt clean compile-for-eqcmini
-$(dialyzer-qc-nospec) | grep -v '^ *$$' | tee $(DIALYZE_NOSPEC_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_NOSPEC_IGNORE_WARN)

dialyze-proper: build-plt clean compile-for-proper
-$(dialyzer-qc) | grep -v '^ *$$' | tee $(DIALYZE_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_IGNORE_WARN)

dialyze-proper-nospec: build-plt clean compile-for-proper
-$(dialyzer-qc-nospec) | grep -v '^ *$$' | tee $(DIALYZE_NOSPEC_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_NOSPEC_IGNORE_WARN)

dialyze-triq: build-plt clean compile-for-triq
-$(dialyzer-qc) | grep -v '^ *$$' | tee $(DIALYZE_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_IGNORE_WARN)

dialyze-triq-nospec: build-plt clean compile-for-triq
-$(dialyzer-qc-nospec) | grep -v '^ *$$' | tee $(DIALYZE_NOSPEC_IGNORE_WARN).log | fgrep -v -f $(DIALYZE_NOSPEC_IGNORE_WARN)

#
# dialyzer PLT
#

build-plt: $(PLT)

check-plt: $(PLT)
dialyzer -q --plt $(PLT) --check_plt

$(PLT):
-dialyzer -q --build_plt --output_plt $(PLT) --apps \
asn1 \
compiler \
crypto \
dialyzer \
diameter \
edoc \
erts \
et \
eunit \
gs \
hipe \
inets \
kernel \
mnesia \
observer \
parsetools \
public_key \
runtime_tools \
sasl \
ssl \
stdlib \
syntax_tools \
tools \
webtool \
xmerl

#
# rebar
#

# $ rm -rf rebar rebar.git
# $ make -f rebar.mk rebar
rebar: rebar.git
(source ~/.kerl/installations/r14b04/activate && cd $(CURDIR)/rebar.git && make clean && make && cp -f rebar ..)
$(REBAR) -V
echo git commit -m \"Update rebar \(`./rebar -V | cut -d ' ' -f 6`\)\" rebar

rebar.git:
rm -rf $(CURDIR)/rebar
git clone git://github.com/norton/rebar.git rebar.git

#
# Erlang/OTP
#

otp: otp.git
make -C $(CURDIR)/otp.git install

otp.git:
rm -rf $(CURDIR)/otp
mkdir -p $(CURDIR)/otp
git clone git://github.com/erlang/otp.git otp.git
(cd $(CURDIR)/otp.git && \
git co master && \
./otp_build autoconf && \
./configure \
--disable-hipe \
--enable-debug \
--enable-kernel-poll \
--enable-threads \
--enable-dynamic-ssl-lib \
--enable-shared-zlib \
--enable-smp-support \
$(otp_configure_flags) \
--prefix=$(CURDIR)/otp)
make -C $(CURDIR)/otp.git 2> make.log-master-stderr.txt | tee make.log-master-stdout.txt

otp-debug: otp.git
env ERL_TOP=$(CURDIR)/otp.git make -C otp.git/erts/emulator debug FLAVOR=smp

otp-valgrind: otp.git
env ERL_TOP=$(CURDIR)/otp.git make -C otp.git/erts/emulator valgrind FLAVOR=smp

cerl-debug: otp.git
env ERL_TOP=$(CURDIR)/otp.git otp.git/bin/cerl -debug

cerl-valgrind: otp.git
env ERL_TOP=$(CURDIR)/otp.git otp.git/bin/cerl -valgrind

## See https://github.com/erlang/otp/wiki/Running-tests for details
otp_make_release_tests: otp.git
rm -rf otp.git/release/tests
env ERL_TOP=$(CURDIR)/otp.git ERL_LIBS=$(CURDIR)/otp.git/lib \
make -C otp.git release_tests

otp_run_release_tests: otp_make_release_tests
@echo ""
@echo "** Warning killing all local beam, beam.smp, and epmd programs **"
@echo ""
sleep 10
killall -q -9 beam || true
killall -q -9 beam.smp || true
killall -q -9 epmd || true
@echo ""
@echo "** Open '$(CURDIR)/otp.git/release/tests/test_server/index.html' in your browser**"
@echo ""
sleep 10
(cd $(CURDIR)/otp.git/release/tests/test_server && \
env ERL_TOP=$(CURDIR)/otp.git ERL_LIBS=$(CURDIR)/otp.git/lib \
$(CURDIR)/otp.git/bin/erl \
-s ts install \
-s ts run \
-s erlang halt)
Something went wrong with that request. Please try again.