adamc@378: BIN := @BIN@ adamc@378: LIB := @LIB@ adamc@378: INCLUDE := @INCLUDE@ adamc@378: SITELISP := @SITELISP@ adamc@378: adamc@378: LIB_UR := $(LIB)/ur adamc@378: LIB_C := $(LIB)/c adamc@1095: LIB_JS := $(LIB)/js adamc@1095: adamc@1095: LD_MAJOR := 1 adamc@1095: LD_MINOR := 0 adamc@378: adamc@378: all: smlnj mlton c adamc@378: adamc@427: .PHONY: all smlnj mlton c clean install package adamc@378: adamc@378: smlnj: src/urweb.cm adamc@378: mlton: bin/urweb adamc@855: adamc@1104: OBJS := memmem mhash urweb request queue http cgi fastcgi adamc@1095: SOS := urweb urweb_http urweb_cgi urweb_fastcgi adamc@1095: c: $(OBJS:%=lib/c/%.o) $(SOS:%=lib/c/lib%.so.$(LD_MAJOR).$(LD_MINOR)) adamc@378: adamc@378: clean: adamc@378: rm -f src/*.mlton.grm.* src/*.mlton.lex.* \ adamc@378: src/urweb.cm src/urweb.mlb \ adamc@1095: lib/c/*.o lib/c/*.so.* adamc@378: rm -rf .cm src/.cm adamc@378: adamc@1095: lib/c/%.do: src/c/%.c include/*.h adamc@1095: gcc -fPIC -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS) adamc@1095: adamc@853: lib/c/%.o: src/c/%.c include/*.h adamc@1094: gcc -Wimplicit -O3 -I include -c $< -o $@ $(CFLAGS) adamc@378: adamc@1104: URWEB_OS := memmem urweb queue request mhash adamc@1095: lib/c/liburweb.so.$(LD_MAJOR).$(LD_MINOR): $(URWEB_OS:%=lib/c/%.do) adamc@1095: gcc -shared -Wl,-soname,liburweb.so.$(LD_MAJOR) -o $@ $^ adamc@1095: adamc@1095: lib/c/liburweb_%.so.$(LD_MAJOR).$(LD_MINOR): lib/c/%.do adamc@1095: gcc -shared -Wl,-soname,liburweb_$*.so.$(LD_MAJOR) -o $@ $^ adamc@1095: adamc@378: src/urweb.cm: src/prefix.cm src/sources adamc@378: cat src/prefix.cm src/sources \ adamc@378: >src/urweb.cm adamc@378: adamc@378: src/urweb.mlb: src/prefix.mlb src/sources src/suffix.mlb adamc@378: cat src/prefix.mlb src/sources src/suffix.mlb \ adamc@431: | sed 's/^\(.*\).grm$$/\1.mlton.grm.sig:\1.mlton.grm.sml/; y/:/\n/' \ adamc@378: | sed 's/^\(.*\).lex$$/\1.mlton.lex.sml/' \ adamc@791: >$@ adamc@378: adamc@378: %.mlton.lex: %.lex adamc@378: cp $< $@ adamc@378: %.mlton.grm: %.grm adamc@378: cp $< $@ adamc@378: adamc@378: %.mlton.lex.sml: %.mlton.lex adamc@378: mllex $< adamc@378: adamc@378: %.mlton.grm.sig %.mlton.grm.sml: %.mlton.grm adamc@378: mlyacc $< adamc@378: adamc@378: MLTON := mlton adamc@378: adamc@378: ifdef DEBUG adamc@378: MLTON += -const 'Exn.keepHistory true' adamc@378: endif adamc@378: adamc@507: ifdef PROFILE adamc@507: MLTON += -profile $(PROFILE) adamc@507: endif adamc@507: adamc@791: bin/urweb: src/compiler.mlb src/urweb.mlb src/*.sig src/*.sml \ adamc@378: src/urweb.mlton.lex.sml \ adamc@378: src/urweb.mlton.grm.sig src/urweb.mlton.grm.sml adamc@791: $(MLTON) -output $@ src/compiler.mlb adamc@378: adamc@378: install: adamc@430: mkdir -p $(BIN) adamc@378: cp bin/urweb $(BIN)/ adamc@378: mkdir -p $(LIB_UR) adamc@602: cp lib/ur/*.urs $(LIB_UR)/ adamc@602: cp lib/ur/*.ur $(LIB_UR)/ adamc@378: mkdir -p $(LIB_C) adamc@602: cp lib/c/*.o $(LIB_C)/ adamc@1106: cp lib/c/*.so.$(LD_MAJOR).$(LD_MINOR) $(LIB)/.. adamc@569: mkdir -p $(LIB_JS) adamc@602: cp lib/js/*.js $(LIB_JS)/ adamc@378: mkdir -p $(INCLUDE) adamc@378: cp include/*.h $(INCLUDE)/ adamc@378: mkdir -p $(SITELISP) adamc@378: cp src/elisp/*.el $(SITELISP)/ adamc@1106: ln -sf liburweb.so.$(LD_MAJOR) $(LIB)/../liburweb.so adamc@1106: ln -sf liburweb_http.so.$(LD_MAJOR) $(LIB)/../liburweb_http.so adamc@1106: ln -sf liburweb_cgi.so.$(LD_MAJOR) $(LIB)/../liburweb_cgi.so adamc@1124: ln -sf liburweb_fastcgi.so.$(LD_MAJOR) $(LIB)/../liburweb_fastcgi.so adamc@1106: ldconfig adamc@427: adamc@427: package: adamc@427: hg archive -t tgz -X tests /tmp/urweb.tgz