Replaced exhaustive search with a binary lookup in watch list.
[erlang-gen_inotify.git] / Makefile
1 #!/usr/bin/make -f
2
3 #-----------------------------------------------------------------------------
4
5 ifeq ($(wildcard .*.plt),)
6 #DIALYZER_PLT = ~/.dialyzer_plt
7 else
8 DIALYZER_PLT = ~/.dialyzer_plt $(wildcard .*.plt)
9 endif
10 DIALYZER_OPTS = --no_check_plt $(if $(DIALYZER_PLT),--plts $(DIALYZER_PLT))
11
12 DIAGRAMS = $(basename $(notdir $(wildcard diagrams/*.diag)))
13 DIAGRAMS_SVG = $(foreach D,$(DIAGRAMS),doc/images/$D.svg)
14
15 #-----------------------------------------------------------------------------
16
17 PROJECT = gen_inotify
18 APP_VERSION = $(call app-version,ebin/$(PROJECT).app)
19 ERL_INSTALL_LIB_DIR = $(ERL_LIB_DIR)/$(PROJECT)-$(APP_VERSION)
20 DOCDIR = /usr/share/doc/erlang-$(PROJECT)
21 #MANDIR = /usr/share/man
22
23 ERLC_OPTS = +debug_info
24 EDOC_OPTS := {overview, "src/overview.edoc"}, \
25              {source_path, ["src", "examples"]}, \
26              todo
27 ifneq ($(devel),)
28 EDOC_OPTS := $(EDOC_OPTS), private
29 endif
30
31 include erlang.mk
32 include erlang.install.mk
33
34 C_SRC_OUTPUT_FILE = priv/gen_inotify_drv.so
35 C_SRC_TYPE = shared
36 CFLAGS += -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
37 ifneq ($(devel),)
38 CFLAGS := $(filter-out -O%,-g $(CFLAGS))
39 LDFLAGS := $(filter-out -O%,-g $(LDFLAGS))
40 endif
41
42 #-----------------------------------------------------------------------------
43
44 .PHONY: dialyzer
45 YECC_ERL_FILES = $(subst .yrl,.erl,$(subst .xrl,.erl,$(wildcard src/*.[xy]rl)))
46 ERL_SOURCE_FILES = $(filter-out $(YECC_ERL_FILES),$(wildcard src/*.erl))
47 dialyzer:
48         @echo "dialyzer $(strip $(DIALYZER_OPTS)) --src src/*.erl"
49         @dialyzer $(strip $(DIALYZER_OPTS)) --src $(ERL_SOURCE_FILES)
50
51 #-----------------------------------------------------------------------------
52
53 .PHONY: doc
54 doc: diagrams edoc
55
56 .PHONY: diagrams
57 diagrams: $(DIAGRAMS_SVG)
58
59 doc/images/%.svg: diagrams/%.diag
60         blockdiag -o $@ -T svg $<
61
62 #-----------------------------------------------------------------------------
63
64 .PHONY: install install-erlang install-doc
65
66 install: install-erlang install-doc
67
68 install-erlang: app
69         $(call install-wildcard,644,ebin/*,$(DESTDIR)$(ERL_INSTALL_LIB_DIR)/ebin)
70
71 install-doc: edoc
72         $(call install-wildcard,644,doc/*.html doc/*.png doc/*.css,$(DESTDIR)$(DOCDIR)/html)
73
74 #-----------------------------------------------------------------------------
75 # vim:ft=make