annotate Makefile.in @ 557:0d3db8d6a586

Building an application
author Adam Chlipala <adamc@hcoop.net>
date Tue, 09 Dec 2008 11:57:17 -0500
parents ca95f9e4d45f
children 6daa59a55c43
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@378 8
adamc@378 9 all: smlnj mlton c
adamc@378 10
adamc@427 11 .PHONY: all smlnj mlton c clean install package
adamc@378 12
adamc@378 13 smlnj: src/urweb.cm
adamc@378 14 mlton: bin/urweb
adamc@378 15 c: clib/urweb.o clib/driver.o
adamc@378 16
adamc@378 17 clean:
adamc@378 18 rm -f src/*.mlton.grm.* src/*.mlton.lex.* \
adamc@378 19 src/urweb.cm src/urweb.mlb \
adamc@378 20 clib/*.o
adamc@378 21 rm -rf .cm src/.cm
adamc@378 22
adamc@378 23 clib/urweb.o: src/c/urweb.c
adamc@502 24 gcc -O3 -I include -c src/c/urweb.c -o clib/urweb.o $(CFLAGS)
adamc@378 25
adamc@378 26 clib/driver.o: src/c/driver.c
adamc@502 27 gcc -O3 -I include -c src/c/driver.c -o clib/driver.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@378 37 >src/urweb.mlb
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@378 60 bin/urweb: 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@378 63 $(MLTON) -output $@ src/urweb.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@378 69 cp lib/*.urs $(LIB_UR)/
adamc@378 70 cp lib/*.ur $(LIB_UR)/
adamc@378 71 mkdir -p $(LIB_C)
adamc@378 72 cp clib/*.o $(LIB_C)/
adamc@378 73 mkdir -p $(INCLUDE)
adamc@378 74 cp include/*.h $(INCLUDE)/
adamc@378 75 mkdir -p $(SITELISP)
adamc@378 76 cp src/elisp/*.el $(SITELISP)/
adamc@427 77
adamc@427 78 package:
adamc@427 79 hg archive -t tgz -X tests /tmp/urweb.tgz