1APP=eredis 2 3PRE17 := $(shell ERL_FLAGS="" erl -eval 'io:format("~s~n", [case re:run(erlang:system_info(otp_release), "^R") of nomatch -> ""; _ -> pre17 end]), halt().' -noshell) 4 5.PHONY: all compile clean Emakefile 6 7all: compile 8 9compile: ebin/$(APP).app Emakefile 10 erl -noinput -eval 'up_to_date = make:all()' -s erlang halt 11 12clean: 13 rm -f -- ebin/*.beam Emakefile ebin/$(APP).app 14 15ebin/$(APP).app: src/$(APP).app.src 16 mkdir -p ebin 17 cp -f -- $< $@ 18 19ifdef DEBUG 20EXTRA_OPTS:=debug_info, 21endif 22 23ifdef TEST 24EXTRA_OPTS:=$(EXTRA_OPTS) {d,'TEST', true}, 25endif 26 27ifndef PRE17 28EXTRA_OPTS:=$(EXTRA_OPTS) {d,namespaced_types}, 29endif 30 31Emakefile: Emakefile.src 32 sed "s/{{EXTRA_OPTS}}/$(EXTRA_OPTS)/" $< > $@ 33 34