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@569
|
8 LIB_JS := $(LIB)/js
|
adamc@378
|
9
|
adamc@378
|
10 all: smlnj mlton c
|
adamc@378
|
11
|
adamc@427
|
12 .PHONY: all smlnj mlton c clean install package
|
adamc@378
|
13
|
adamc@378
|
14 smlnj: src/urweb.cm
|
adamc@378
|
15 mlton: bin/urweb
|
adamc@855
|
16
|
adamc@859
|
17 OBJS := urweb request queue http cgi fastcgi
|
adamc@855
|
18 c: $(OBJS:%=lib/c/%.o)
|
adamc@378
|
19
|
adamc@378
|
20 clean:
|
adamc@378
|
21 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \
|
adamc@378
|
22 src/urweb.cm src/urweb.mlb \
|
adamc@602
|
23 lib/c/*.o
|
adamc@378
|
24 rm -rf .cm src/.cm
|
adamc@378
|
25
|
adamc@853
|
26 lib/c/%.o: src/c/%.c include/*.h
|
adamc@853
|
27 gcc -O3 -I include -c $< -o $@ $(CFLAGS)
|
adamc@378
|
28
|
adamc@378
|
29 src/urweb.cm: src/prefix.cm src/sources
|
adamc@378
|
30 cat src/prefix.cm src/sources \
|
adamc@378
|
31 >src/urweb.cm
|
adamc@378
|
32
|
adamc@378
|
33 src/urweb.mlb: src/prefix.mlb src/sources src/suffix.mlb
|
adamc@378
|
34 cat src/prefix.mlb src/sources src/suffix.mlb \
|
adamc@431
|
35 | sed 's/^\(.*\).grm$$/\1.mlton.grm.sig:\1.mlton.grm.sml/; y/:/\n/' \
|
adamc@378
|
36 | sed 's/^\(.*\).lex$$/\1.mlton.lex.sml/' \
|
adamc@791
|
37 >$@
|
adamc@378
|
38
|
adamc@378
|
39 %.mlton.lex: %.lex
|
adamc@378
|
40 cp $< $@
|
adamc@378
|
41 %.mlton.grm: %.grm
|
adamc@378
|
42 cp $< $@
|
adamc@378
|
43
|
adamc@378
|
44 %.mlton.lex.sml: %.mlton.lex
|
adamc@378
|
45 mllex $<
|
adamc@378
|
46
|
adamc@378
|
47 %.mlton.grm.sig %.mlton.grm.sml: %.mlton.grm
|
adamc@378
|
48 mlyacc $<
|
adamc@378
|
49
|
adamc@378
|
50 MLTON := mlton
|
adamc@378
|
51
|
adamc@378
|
52 ifdef DEBUG
|
adamc@378
|
53 MLTON += -const 'Exn.keepHistory true'
|
adamc@378
|
54 endif
|
adamc@378
|
55
|
adamc@507
|
56 ifdef PROFILE
|
adamc@507
|
57 MLTON += -profile $(PROFILE)
|
adamc@507
|
58 endif
|
adamc@507
|
59
|
adamc@791
|
60 bin/urweb: src/compiler.mlb src/urweb.mlb src/*.sig src/*.sml \
|
adamc@378
|
61 src/urweb.mlton.lex.sml \
|
adamc@378
|
62 src/urweb.mlton.grm.sig src/urweb.mlton.grm.sml
|
adamc@791
|
63 $(MLTON) -output $@ src/compiler.mlb
|
adamc@378
|
64
|
adamc@378
|
65 install:
|
adamc@430
|
66 mkdir -p $(BIN)
|
adamc@378
|
67 cp bin/urweb $(BIN)/
|
adamc@378
|
68 mkdir -p $(LIB_UR)
|
adamc@602
|
69 cp lib/ur/*.urs $(LIB_UR)/
|
adamc@602
|
70 cp lib/ur/*.ur $(LIB_UR)/
|
adamc@378
|
71 mkdir -p $(LIB_C)
|
adamc@602
|
72 cp lib/c/*.o $(LIB_C)/
|
adamc@569
|
73 mkdir -p $(LIB_JS)
|
adamc@602
|
74 cp lib/js/*.js $(LIB_JS)/
|
adamc@378
|
75 mkdir -p $(INCLUDE)
|
adamc@378
|
76 cp include/*.h $(INCLUDE)/
|
adamc@378
|
77 mkdir -p $(SITELISP)
|
adamc@378
|
78 cp src/elisp/*.el $(SITELISP)/
|
adamc@427
|
79
|
adamc@427
|
80 package:
|
adamc@427
|
81 hg archive -t tgz -X tests /tmp/urweb.tgz
|