comparison Makefile.in @ 1130:67d875c8ac71

Using libtool to build and install liburweb*
author Adam Chlipala <adamc@hcoop.net>
date Tue, 26 Jan 2010 09:04:55 -0500
parents 2f53e0deffb3
children 94e83c5533d2
comparison
equal deleted inserted replaced
1129:4f3a1aa3b66d 1130:67d875c8ac71
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 9
10 LD_MAJOR := 1 10 LIB_VERSION := 1:0
11 LD_MINOR := 0
12 11
13 all: smlnj mlton c 12 all: smlnj mlton c
14 13
15 .PHONY: all smlnj mlton c clean install package 14 .PHONY: all smlnj mlton c clean install package
16 15
17 smlnj: src/urweb.cm 16 smlnj: src/urweb.cm
18 mlton: bin/urweb 17 mlton: bin/urweb
19 18
20 OBJS := memmem mhash urweb request queue http cgi fastcgi 19 OBJS := memmem mhash urweb request queue http cgi fastcgi
21 SOS := urweb urweb_http urweb_cgi urweb_fastcgi 20 SOS := urweb urweb_http urweb_cgi urweb_fastcgi
22 c: $(OBJS:%=lib/c/%.o) $(SOS:%=lib/c/lib%.so.$(LD_MAJOR).$(LD_MINOR)) 21 c: $(OBJS:%=lib/c/%.lo) $(SOS:%=lib/c/lib%.la)
23 22
24 clean: 23 clean:
25 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \ 24 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \
26 src/urweb.cm src/urweb.mlb \ 25 src/urweb.cm src/urweb.mlb \
27 lib/c/*.o lib/c/*.so.* 26 lib/c/*.o lib/c/*.so.*
28 rm -rf .cm src/.cm 27 rm -rf .cm src/.cm
29 28
30 lib/c/%.do: src/c/%.c include/*.h 29 lib/c/%.lo: src/c/%.c include/*.h
31 gcc -fPIC -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS) 30 libtool --mode=compile gcc -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS)
32 31
33 lib/c/%.o: src/c/%.c include/*.h 32 LIBARGS := -rpath $(LIB)/.. -version-info $(LIB_VERSION)
34 gcc -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS)
35 33
36 URWEB_OS := memmem urweb queue request mhash 34 URWEB_OS := memmem urweb queue request mhash
37 lib/c/liburweb.so.$(LD_MAJOR).$(LD_MINOR): $(URWEB_OS:%=lib/c/%.do) 35 lib/c/liburweb.la: $(URWEB_OS:%=lib/c/%.lo)
38 gcc -shared -Wl,-soname,liburweb.so.$(LD_MAJOR) -o $@ $^ 36 libtool --mode=link gcc -o $@ $^ $(LIBARGS)
39 37
40 lib/c/liburweb_%.so.$(LD_MAJOR).$(LD_MINOR): lib/c/%.do 38 lib/c/liburweb_%.la: lib/c/%.lo
41 gcc -shared -Wl,-soname,liburweb_$*.so.$(LD_MAJOR) -o $@ $^ 39 libtool --mode=link gcc -o $@ $^ $(LIBARGS)
42 40
43 src/urweb.cm: src/prefix.cm src/sources 41 src/urweb.cm: src/prefix.cm src/sources
44 cat src/prefix.cm src/sources \ 42 cat src/prefix.cm src/sources \
45 >src/urweb.cm 43 >src/urweb.cm
46 44
82 mkdir -p $(LIB_UR) 80 mkdir -p $(LIB_UR)
83 cp lib/ur/*.urs $(LIB_UR)/ 81 cp lib/ur/*.urs $(LIB_UR)/
84 cp lib/ur/*.ur $(LIB_UR)/ 82 cp lib/ur/*.ur $(LIB_UR)/
85 mkdir -p $(LIB_C) 83 mkdir -p $(LIB_C)
86 cp lib/c/*.o $(LIB_C)/ 84 cp lib/c/*.o $(LIB_C)/
87 cp lib/c/*.so.$(LD_MAJOR).$(LD_MINOR) $(LIB)/..
88 mkdir -p $(LIB_JS) 85 mkdir -p $(LIB_JS)
89 cp lib/js/*.js $(LIB_JS)/ 86 cp lib/js/*.js $(LIB_JS)/
90 mkdir -p $(INCLUDE) 87 mkdir -p $(INCLUDE)
91 cp include/*.h $(INCLUDE)/ 88 cp include/*.h $(INCLUDE)/
92 mkdir -p $(SITELISP) 89 mkdir -p $(SITELISP)
93 cp src/elisp/*.el $(SITELISP)/ 90 cp src/elisp/*.el $(SITELISP)/
94 ln -sf liburweb.so.$(LD_MAJOR) $(LIB)/../liburweb.so 91 libtool --silent --mode=install install -c lib/c/liburweb.la $(LIB)/../liburweb.la
95 ln -sf liburweb_http.so.$(LD_MAJOR) $(LIB)/../liburweb_http.so 92 libtool --silent --mode=install install -c lib/c/liburweb_http.la $(LIB)/../liburweb_http.la
96 ln -sf liburweb_cgi.so.$(LD_MAJOR) $(LIB)/../liburweb_cgi.so 93 libtool --silent --mode=install install -c lib/c/liburweb_cgi.la $(LIB)/../liburweb_cgi.la
97 ln -sf liburweb_fastcgi.so.$(LD_MAJOR) $(LIB)/../liburweb_fastcgi.so 94 libtool --silent --mode=install install -c lib/c/liburweb_fastcgi.la $(LIB)/../liburweb_fastcgi.la
98 ldconfig
99 95
100 package: 96 package:
101 hg archive -t tgz -X tests /tmp/urweb.tgz 97 hg archive -t tgz -X tests /tmp/urweb.tgz