forked from margnus1/kid-mud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (44 loc) · 1.65 KB
/
Makefile
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
####################
GROUP_NUMBER := 14
####################
ERLC := erlc
ERLC_FLAGS := -W -I include
ERL_FILES := $(wildcard src/*.erl) src/parser_grammar.erl
BEAM_FILES := $(patsubst src/%.erl,ebin/%.beam,${ERL_FILES})
comma:= ,
empty:=
space:= $(empty) $(empty)
EDOC_SRC := $(filter-out %_test.erl, $(ERL_FILES))
EDOC_SRC_LIST := [$(subst $(space),$(comma),$(patsubst src/%.erl,'src/%.erl', $(EDOC_SRC)))]
REQUIRED_DIR_NAME := pop_2012_project_group_$(GROUP_NUMBER)
PROJECT_DIR := $(notdir $(shell pwd))
USER=$(shell whoami)
ARCHIVE_NAME := $(REQUIRED_DIR_NAME)_archive_$(USER)_$(shell date "+%Y-%m-%d__%H:%M:%S")__.tar.gz
ARCHIVE_DIR := ..
all: $(BEAM_FILES)
ebin/%.beam: src/%.erl
$(ERLC) $(ERLC_FLAGS) -o ebin $<
start: all
(cd ebin && erl -eval 'foo:start(), init:stop()')
src/parser_grammar.erl: src/parser_grammar.peg
erl -noshell -pa neotoma/ebin -eval "neotoma:file(\"src/parser_grammar.peg\")" -s erlang halt
test: all
(cd ebin && erl -noinput -eval 'eunit:test({dir, "."}, [verbose]), init:stop()')
doc: $(BEAM_FILES)
erl -noshell -eval "edoc:files($(EDOC_SRC_LIST), [{dir, 'doc/html'}])" -s init stop
clean:
rm -rf .#* *.dump
rm -rf ebin/*.beam
rm -f src/parser_grammar.erl
(cd doc/html && find . -name "*" -a ! -name overview.edoc -exec rm -rf {} \;)
remove_finderinfo:
-xattr -d "com.apple.FinderInfo" src/*.erl include/*.hrl doc/* doc/html/*
archive: clean
ifeq ($(REQUIRED_DIR_NAME), $(PROJECT_DIR))
(cd $(ARCHIVE_DIR) && tar cvfz $(ARCHIVE_NAME) $(PROJECT_DIR) )
@echo
@echo NOTE: Archive created in $(ARCHIVE_DIR)/$(ARCHIVE_NAME)
@echo
else
@echo Error: Wrong directory name >$(PROJECT_DIR)<, change to >$(REQUIRED_DIR_NAME)<
endif