annotate Makefile.in @ 1117:31ef567fa772

Clear script_header in uw_reset()
author Adam Chlipala <adamc@hcoop.net>
date Tue, 05 Jan 2010 13:30:27 -0500
parents c9137606733a
children 2f53e0deffb3
rev   line source
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@1095 10 LD_MAJOR := 1
adamc@1095 11 LD_MINOR := 0
adamc@378 12
adamc@378 13 all: smlnj mlton c
adamc@378 14
adamc@427 15 .PHONY: all smlnj mlton c clean install package
adamc@378 16
adamc@378 17 smlnj: src/urweb.cm
adamc@378 18 mlton: bin/urweb
adamc@855 19
adamc@1104 20 OBJS := memmem mhash urweb request queue http cgi fastcgi
adamc@1095 21 SOS := urweb urweb_http urweb_cgi urweb_fastcgi
adamc@1095 22 c: $(OBJS:%=lib/c/%.o) $(SOS:%=lib/c/lib%.so.$(LD_MAJOR).$(LD_MINOR))
adamc@378 23
adamc@378 24 clean:
adamc@378 25 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \
adamc@378 26 src/urweb.cm src/urweb.mlb \
adamc@1095 27 lib/c/*.o lib/c/*.so.*
adamc@378 28 rm -rf .cm src/.cm
adamc@378 29
adamc@1095 30 lib/c/%.do: src/c/%.c include/*.h
adamc@1095 31 gcc -fPIC -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS)
adamc@1095 32
adamc@853 33 lib/c/%.o: src/c/%.c include/*.h
adamc@1094 34 gcc -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS)
adamc@378 35
adamc@1104 36 URWEB_OS := memmem urweb queue request mhash
adamc@1095 37 lib/c/liburweb.so.$(LD_MAJOR).$(LD_MINOR): $(URWEB_OS:%=lib/c/%.do)
adamc@1095 38 gcc -shared -Wl,-soname,liburweb.so.$(LD_MAJOR) -o $@ $^
adamc@1095 39
adamc@1095 40 lib/c/liburweb_%.so.$(LD_MAJOR).$(LD_MINOR): lib/c/%.do
adamc@1095 41 gcc -shared -Wl,-soname,liburweb_$*.so.$(LD_MAJOR) -o $@ $^
adamc@1095 42
adamc@378 43 src/urweb.cm: src/prefix.cm src/sources
adamc@378 44 cat src/prefix.cm src/sources \
adamc@378 45 >src/urweb.cm
adamc@378 46
adamc@378 47 src/urweb.mlb: src/prefix.mlb src/sources src/suffix.mlb
adamc@378 48 cat src/prefix.mlb src/sources src/suffix.mlb \
adamc@431 49 | sed 's/^\(.*\).grm$$/\1.mlton.grm.sig:\1.mlton.grm.sml/; y/:/\n/' \
adamc@378 50 | sed 's/^\(.*\).lex$$/\1.mlton.lex.sml/' \
adamc@791 51 >$@
adamc@378 52
adamc@378 53 %.mlton.lex: %.lex
adamc@378 54 cp $< $@
adamc@378 55 %.mlton.grm: %.grm
adamc@378 56 cp $< $@
adamc@378 57
adamc@378 58 %.mlton.lex.sml: %.mlton.lex
adamc@378 59 mllex $<
adamc@378 60
adamc@378 61 %.mlton.grm.sig %.mlton.grm.sml: %.mlton.grm
adamc@378 62 mlyacc $<
adamc@378 63
adamc@378 64 MLTON := mlton
adamc@378 65
adamc@378 66 ifdef DEBUG
adamc@378 67 MLTON += -const 'Exn.keepHistory true'
adamc@378 68 endif
adamc@378 69
adamc@507 70 ifdef PROFILE
adamc@507 71 MLTON += -profile $(PROFILE)
adamc@507 72 endif
adamc@507 73
adamc@791 74 bin/urweb: src/compiler.mlb src/urweb.mlb src/*.sig src/*.sml \
adamc@378 75 src/urweb.mlton.lex.sml \
adamc@378 76 src/urweb.mlton.grm.sig src/urweb.mlton.grm.sml
adamc@791 77 $(MLTON) -output $@ src/compiler.mlb
adamc@378 78
adamc@378 79 install:
adamc@430 80 mkdir -p $(BIN)
adamc@378 81 cp bin/urweb $(BIN)/
adamc@378 82 mkdir -p $(LIB_UR)
adamc@602 83 cp lib/ur/*.urs $(LIB_UR)/
adamc@602 84 cp lib/ur/*.ur $(LIB_UR)/
adamc@378 85 mkdir -p $(LIB_C)
adamc@602 86 cp lib/c/*.o $(LIB_C)/
adamc@1106 87 cp lib/c/*.so.$(LD_MAJOR).$(LD_MINOR) $(LIB)/..
adamc@569 88 mkdir -p $(LIB_JS)
adamc@602 89 cp lib/js/*.js $(LIB_JS)/
adamc@378 90 mkdir -p $(INCLUDE)
adamc@378 91 cp include/*.h $(INCLUDE)/
adamc@378 92 mkdir -p $(SITELISP)
adamc@378 93 cp src/elisp/*.el $(SITELISP)/
adamc@1106 94 ln -sf liburweb.so.$(LD_MAJOR) $(LIB)/../liburweb.so
adamc@1106 95 ln -sf liburweb_http.so.$(LD_MAJOR) $(LIB)/../liburweb_http.so
adamc@1106 96 ln -sf liburweb_cgi.so.$(LD_MAJOR) $(LIB)/../liburweb_cgi.so
adamc@1106 97 ln -sf /liburweb_fastcgi.so.$(LD_MAJOR) $(LIB)/../liburweb_fastcgi.so
adamc@1106 98 ldconfig
adamc@427 99
adamc@427 100 package:
adamc@427 101 hg archive -t tgz -X tests /tmp/urweb.tgz