Commit 735cb8da authored by François Bobot's avatar François Bobot

[SRC] add the file for the compilation of website

parent baa08dc0
_build
/topfind_header.ml
PKG tyxml
B _build
S .
\ No newline at end of file
# --------------------------------------------------------------------------
# --- Build
# --------------------------------------------------------------------------
.PHONY: all build install uninstall clean
all: generate
clean:
rm -fr build *~
ocamlbuild -clean
# --------------------------------------------------------------------------
# --- Compilation
# --------------------------------------------------------------------------
PREFIX?=/usr/local
PACKAGES=tyxml
FLAGS= \
-cflags -w,PSUZL+7,-warn-error,PSUZL+7 \
-use-ocamlfind -tag debug \
$(addprefix -package ,$(PACKAGES))
ifeq ($(DEVEL),YES)
FLAGS+=-tag bin_annot
endif
PAGE=$(subst .page.ml,,$(wildcard *.page.ml))
generate: $(addprefix ../www/, $(addsuffix .html,$(PAGE)))
HEADER=topfind_header.ml
../www/%.html: %.page.ml $(HEADER) utils
@echo "Generating $*.html"
@echo "#1 \"$*.page.ml\"" | cat $(HEADER) - $< | ocaml -I _build -stdin $< > $@.tmp
@mv $@.tmp $@
$(HEADER): Makefile
@echo "Generate header for topfind"
@echo "#use \"topfind\";;" > $@.tmp
@$(foreach pkg, $(PACKAGES), echo "#require \"$(pkg)\";;" >> $@.tmp;)
@echo "#load \"utils.cma\";;" >> $@.tmp
@mv $@.tmp $@
utils: force
@echo "Compiling common library"
@ocamlbuild $(FLAGS) utils.cma
#force allows to always run the rules that depends on it
.PHONY: force
open Html5.M
let page ~title:t b =
let html =
html
(head (title (pcdata t)) [meta ~a:[a_charset "utf-8"] ()])
(body b) in
Html5.P.print ~output:print_string html
open Html5.M
open Generate
let () = Generate.page ~title:"Toto" [
p [pcdata "C'est ça!"]
]
Generate
\ No newline at end of file
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Toto</title><meta charset="utf-8" /></head><body><p>C'est ça!</p></body></html>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment