aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-10-31 10:33:21 +0100
committerLoïc Hoguin <[email protected]>2013-10-31 10:33:21 +0100
commit1797b412baa694e489b18732408e146f7c09f59d (patch)
tree928d49d3dfadac2b257f2a5218625f08d076a03f /Makefile
parent85b695c177da63f8b2651c88f8bc43ee511c4509 (diff)
downloadcowlib-1797b412baa694e489b18732408e146f7c09f59d.tar.gz
cowlib-1797b412baa694e489b18732408e146f7c09f59d.tar.bz2
cowlib-1797b412baa694e489b18732408e146f7c09f59d.zip
Add the cow_mimetypes module for identifying mimetypes from ext
The module is partly generated from the big Apache mimetypes file.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 19 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 29a2f7e..d731acf 100644
--- a/Makefile
+++ b/Makefile
@@ -4,3 +4,22 @@ PROJECT = cowlib
CT_SUITES = eunit
include erlang.mk
+
+GEN_URL = http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+GEN_SRC = src/cow_mimetypes.erl.src
+GEN_OUT = src/cow_mimetypes.erl
+
+gen:
+ $(gen_verbose) cat $(GEN_SRC) \
+ | head -n `grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
+ > $(GEN_OUT)
+ $(gen_verbose) wget -qO - $(GEN_URL) \
+ | grep -v ^# \
+ | awk '{for (i=2; i<=NF; i++) if ($$i != "") \
+ print "all_ext(<<\"" $$i "\">>) -> <<\"" $$1 "\">>;"}' \
+ | sort \
+ | uniq -w 25 \
+ >> $(GEN_OUT)
+ $(gen_verbose) cat $(GEN_SRC) \
+ | tail -n +`grep -n "%% GENERATED" $(GEN_SRC) | cut -d : -f 1` \
+ >> $(GEN_OUT)