adamc@378
|
1 BIN := @BIN@
|
adamc@378
|
2 LIB := @LIB@
|
adamc@378
|
3 INCLUDE := @INCLUDE@
|
adamc@378
|
4 SITELISP := @SITELISP@
|
adamc@378
|
5
|
adamc@378
|
6 LIB_UR := $(LIB)/ur
|
adamc@378
|
7 LIB_C := $(LIB)/c
|
adamc@1095
|
8 LIB_JS := $(LIB)/js
|
adamc@1095
|
9
|
adamc@1130
|
10 LIB_VERSION := 1:0
|
adamc@378
|
11
|
adamc@378
|
12 all: smlnj mlton c
|
adamc@378
|
13
|
adamc@427
|
14 .PHONY: all smlnj mlton c clean install package
|
adamc@378
|
15
|
adamc@378
|
16 smlnj: src/urweb.cm
|
adamc@378
|
17 mlton: bin/urweb
|
adamc@855
|
18
|
adamc@1104
|
19 OBJS := memmem mhash urweb request queue http cgi fastcgi
|
adamc@1095
|
20 SOS := urweb urweb_http urweb_cgi urweb_fastcgi
|
adamc@1130
|
21 c: $(OBJS:%=lib/c/%.lo) $(SOS:%=lib/c/lib%.la)
|
adamc@378
|
22
|
adamc@378
|
23 clean:
|
adamc@378
|
24 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \
|
adamc@378
|
25 src/urweb.cm src/urweb.mlb \
|
adamc@1095
|
26 lib/c/*.o lib/c/*.so.*
|
adamc@378
|
27 rm -rf .cm src/.cm
|
adamc@378
|
28
|
adamc@1130
|
29 lib/c/%.lo: src/c/%.c include/*.h
|
adamc@1130
|
30 libtool --mode=compile gcc -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS)
|
adamc@1095
|
31
|
adamc@1130
|
32 LIBARGS := -rpath $(LIB)/.. -version-info $(LIB_VERSION)
|
adamc@378
|
33
|
adamc@1104
|
34 URWEB_OS := memmem urweb queue request mhash
|
adamc@1130
|
35 lib/c/liburweb.la: $(URWEB_OS:%=lib/c/%.lo)
|
adamc@1130
|
36 libtool --mode=link gcc -o $@ $^ $(LIBARGS)
|
adamc@1095
|
37
|
adamc@1130
|
38 lib/c/liburweb_%.la: lib/c/%.lo
|
adamc@1130
|
39 libtool --mode=link gcc -o $@ $^ $(LIBARGS)
|
adamc@1095
|
40
|
adamc@378
|
41 src/urweb.cm: src/prefix.cm src/sources
|
adamc@378
|
42 cat src/prefix.cm src/sources \
|
adamc@378
|
43 >src/urweb.cm
|
adamc@378
|
44
|
adamc@378
|
45 src/urweb.mlb: src/prefix.mlb src/sources src/suffix.mlb
|
adamc@378
|
46 cat src/prefix.mlb src/sources src/suffix.mlb \
|
adamc@431
|
47 | sed 's/^\(.*\).grm$$/\1.mlton.grm.sig:\1.mlton.grm.sml/; y/:/\n/' \
|
adamc@378
|
48 | sed 's/^\(.*\).lex$$/\1.mlton.lex.sml/' \
|
adamc@791
|
49 >$@
|
adamc@378
|
50
|
adamc@378
|
51 %.mlton.lex: %.lex
|
adamc@378
|
52 cp $< $@
|
adamc@378
|
53 %.mlton.grm: %.grm
|
adamc@378
|
54 cp $< $@
|
adamc@378
|
55
|
adamc@378
|
56 %.mlton.lex.sml: %.mlton.lex
|
adamc@378
|
57 mllex $<
|
adamc@378
|
58
|
adamc@378
|
59 %.mlton.grm.sig %.mlton.grm.sml: %.mlton.grm
|
adamc@378
|
60 mlyacc $<
|
adamc@378
|
61
|
adamc@378
|
62 MLTON := mlton
|
adamc@378
|
63
|
adamc@378
|
64 ifdef DEBUG
|
adamc@378
|
65 MLTON += -const 'Exn.keepHistory true'
|
adamc@378
|
66 endif
|
adamc@378
|
67
|
adamc@507
|
68 ifdef PROFILE
|
adamc@507
|
69 MLTON += -profile $(PROFILE)
|
adamc@507
|
70 endif
|
adamc@507
|
71
|
adamc@791
|
72 bin/urweb: src/compiler.mlb src/urweb.mlb src/*.sig src/*.sml \
|
adamc@378
|
73 src/urweb.mlton.lex.sml \
|
adamc@378
|
74 src/urweb.mlton.grm.sig src/urweb.mlton.grm.sml
|
adamc@791
|
75 $(MLTON) -output $@ src/compiler.mlb
|
adamc@378
|
76
|
adamc@378
|
77 install:
|
adamc@430
|
78 mkdir -p $(BIN)
|
adamc@378
|
79 cp bin/urweb $(BIN)/
|
adamc@378
|
80 mkdir -p $(LIB_UR)
|
adamc@602
|
81 cp lib/ur/*.urs $(LIB_UR)/
|
adamc@602
|
82 cp lib/ur/*.ur $(LIB_UR)/
|
adamc@378
|
83 mkdir -p $(LIB_C)
|
adamc@602
|
84 cp lib/c/*.o $(LIB_C)/
|
adamc@569
|
85 mkdir -p $(LIB_JS)
|
adamc@602
|
86 cp lib/js/*.js $(LIB_JS)/
|
adamc@378
|
87 mkdir -p $(INCLUDE)
|
adamc@378
|
88 cp include/*.h $(INCLUDE)/
|
adamc@378
|
89 mkdir -p $(SITELISP)
|
adamc@378
|
90 cp src/elisp/*.el $(SITELISP)/
|
adamc@1130
|
91 libtool --silent --mode=install install -c lib/c/liburweb.la $(LIB)/../liburweb.la
|
adamc@1130
|
92 libtool --silent --mode=install install -c lib/c/liburweb_http.la $(LIB)/../liburweb_http.la
|
adamc@1130
|
93 libtool --silent --mode=install install -c lib/c/liburweb_cgi.la $(LIB)/../liburweb_cgi.la
|
adamc@1130
|
94 libtool --silent --mode=install install -c lib/c/liburweb_fastcgi.la $(LIB)/../liburweb_fastcgi.la
|
adamc@1131
|
95 libtool --silent --finish $(LIB)/../liburweb.la
|
adamc@1131
|
96 libtool --silent --finish $(LIB)/../liburweb_http.la
|
adamc@1131
|
97 libtool --silent --finish $(LIB)/../liburweb_cgi.la
|
adamc@1131
|
98 libtool --silent --finish $(LIB)/../liburweb_fastcgi.la
|
adamc@427
|
99
|
adamc@427
|
100 package:
|
adamc@427
|
101 hg archive -t tgz -X tests /tmp/urweb.tgz
|