comparison Makefile.in @ 1095:bed675db3aff

Dynamic linking of the runtime system
author Adam Chlipala <adamc@hcoop.net>
date Sun, 27 Dec 2009 13:18:32 -0500
parents db52c32dbe42
children 72670131dace
comparison
equal deleted inserted replaced
1094:db52c32dbe42 1095:bed675db3aff
3 INCLUDE := @INCLUDE@ 3 INCLUDE := @INCLUDE@
4 SITELISP := @SITELISP@ 4 SITELISP := @SITELISP@
5 5
6 LIB_UR := $(LIB)/ur 6 LIB_UR := $(LIB)/ur
7 LIB_C := $(LIB)/c 7 LIB_C := $(LIB)/c
8 LIB_JS := $(LIB)/js 8 LIB_JS := $(LIB)/js
9
10 LD_MAJOR := 1
11 LD_MINOR := 0
9 12
10 all: smlnj mlton c 13 all: smlnj mlton c
11 14
12 .PHONY: all smlnj mlton c clean install package 15 .PHONY: all smlnj mlton c clean install package
13 16
14 smlnj: src/urweb.cm 17 smlnj: src/urweb.cm
15 mlton: bin/urweb 18 mlton: bin/urweb
16 19
17 OBJS := urweb request queue http cgi fastcgi memmem 20 OBJS := memmem urweb request queue http cgi fastcgi
18 c: $(OBJS:%=lib/c/%.o) 21 SOS := urweb urweb_http urweb_cgi urweb_fastcgi
22 c: $(OBJS:%=lib/c/%.o) $(SOS:%=lib/c/lib%.so.$(LD_MAJOR).$(LD_MINOR))
19 23
20 clean: 24 clean:
21 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \ 25 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \
22 src/urweb.cm src/urweb.mlb \ 26 src/urweb.cm src/urweb.mlb \
23 lib/c/*.o 27 lib/c/*.o lib/c/*.so.*
24 rm -rf .cm src/.cm 28 rm -rf .cm src/.cm
29
30 lib/c/%.do: src/c/%.c include/*.h
31 gcc -fPIC -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS)
25 32
26 lib/c/%.o: src/c/%.c include/*.h 33 lib/c/%.o: src/c/%.c include/*.h
27 gcc -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS) 34 gcc -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS)
35
36 URWEB_OS := memmem urweb queue request
37 lib/c/liburweb.so.$(LD_MAJOR).$(LD_MINOR): $(URWEB_OS:%=lib/c/%.do)
38 gcc -shared -Wl,-soname,liburweb.so.$(LD_MAJOR) -o $@ $^
39
40 lib/c/liburweb_%.so.$(LD_MAJOR).$(LD_MINOR): lib/c/%.do
41 gcc -shared -Wl,-soname,liburweb_$*.so.$(LD_MAJOR) -o $@ $^
28 42
29 src/urweb.cm: src/prefix.cm src/sources 43 src/urweb.cm: src/prefix.cm src/sources
30 cat src/prefix.cm src/sources \ 44 cat src/prefix.cm src/sources \
31 >src/urweb.cm 45 >src/urweb.cm
32 46
68 mkdir -p $(LIB_UR) 82 mkdir -p $(LIB_UR)
69 cp lib/ur/*.urs $(LIB_UR)/ 83 cp lib/ur/*.urs $(LIB_UR)/
70 cp lib/ur/*.ur $(LIB_UR)/ 84 cp lib/ur/*.ur $(LIB_UR)/
71 mkdir -p $(LIB_C) 85 mkdir -p $(LIB_C)
72 cp lib/c/*.o $(LIB_C)/ 86 cp lib/c/*.o $(LIB_C)/
87 cp lib/c/*.so.$(LD_MAJOR).$(LD_MINOR) $(LIB_C)/
73 mkdir -p $(LIB_JS) 88 mkdir -p $(LIB_JS)
74 cp lib/js/*.js $(LIB_JS)/ 89 cp lib/js/*.js $(LIB_JS)/
75 mkdir -p $(INCLUDE) 90 mkdir -p $(INCLUDE)
76 cp include/*.h $(INCLUDE)/ 91 cp include/*.h $(INCLUDE)/
77 mkdir -p $(SITELISP) 92 mkdir -p $(SITELISP)
78 cp src/elisp/*.el $(SITELISP)/ 93 cp src/elisp/*.el $(SITELISP)/
94 ldconfig $(LIB_C)
95 ln -sf $(LIB_C)/liburweb.so.$(LD_MAJOR) $(LIB_C)/liburweb.so
96 ln -sf $(LIB_C)/liburweb_http.so.$(LD_MAJOR) $(LIB_C)/liburweb_http.so
97 ln -sf $(LIB_C)/liburweb_cgi.so.$(LD_MAJOR) $(LIB_C)/liburweb_cgi.so
98 ln -sf $(LIB_C)/liburweb_fastcgi.so.$(LD_MAJOR) $(LIB_C)/liburweb_fastcgi.so
79 99
80 package: 100 package:
81 hg archive -t tgz -X tests /tmp/urweb.tgz 101 hg archive -t tgz -X tests /tmp/urweb.tgz