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