forked from benoitc/hackney_lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (60 loc) · 1.46 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
REBAR?=./rebar
all: build
dev: devbuild
doc: dev
$(REBAR) -C rebar_dev.config doc
clean:
$(REBAR) clean
distclean: clean
@rm -rf deps
build: deps
$(REBAR) compile
deps:
$(REBAR) get-deps
test:
$(REBAR) skip_deps=true eunit
# development
#
devclean:
$(REBAR) -C rebar_dev.config clean
devbuild: devdeps
$(REBAR) -C rebar_dev.config compile
devdeps:
$(REBAR) -C rebar_dev.config get-deps
# Mimetypes module generator.
GEN_URL = http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
GEN_FILE = mime.types
GEN_SRC = src/hackney_mimetypes.erl.src
GEN_OUT = src/hackney_mimetypes.erl
gen:
@wget -qO $(GEN_FILE) $(GEN_URL)
@cat $(GEN_SRC) \
| head -n `grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
> $(GEN_OUT)
@cat $(GEN_FILE) \
| grep -v ^# \
| awk '{for (i=2; i<=NF; i++) if ($$i != "") { \
print "extensions(<<\"" $$i "\">>) -> <<\"" $$1 "\">>;"}}' \
| sort \
| uniq -w 25 \
>> $(GEN_OUT)
@echo "extensions(_) -> <<\"application/octet-stream\">>." >> $(GEN_OUT)
@echo "" >> $(GEN_OUT)
@cat $(GEN_FILE) \
| grep -v ^# \
| awk '{\
printf("mimetypes(<<\"%s\">>) -> [", $$1); \
for (i=2; i<=NF; i++) \
if ($$i != "") { \
if (i >= 3){printf(",")} \
printf("<<\"%s\">>", $$i) \
}\
print "];" \
}' \
| sort \
>> $(GEN_OUT)
@echo "mimetypes(_) -> [<<>>]." >> $(GEN_OUT)
@cat $(GEN_SRC) \
| tail -n +`grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
>> $(GEN_OUT)
.PHONY: doc deps test