############################################################ ## Makefile for the html example ## --------------------------------------------------------- ## ## Usage: ## make [target] ## ## Targets: ## favorite.byte -- build the example as ocaml byte code (default target) ## favorite.native -- build the example as native ## favorite.top -- build an interactive toplevel ## favorite.debug -- build the example with debugging symbols ## favorite.profile -- build the example with profiling instrumentation ## htdoc -- generate documentation (in doc/index.html) ## libs -- build and install ocaml library dependencies ## clean -- clean up all build related files ## ############################################################ # (just ignore this thing...) .PHONY: default all \ html.byte html.native html.top html.debug html.profile \ htdoc clean prepare findlib javalib libs # Default build target (defined below) # should probably be either 'html.native' or 'html.byte' html: html.byte # Default target for Eclipse all: html # Non-source directories (comma separated, no spaces) # Add directories that do not contain ml source files. # Fx directories with test cases (will speed up compilation) EXCL_DIRS := doc # dOvs modules for generating a toplevel and documentation # (ie, with source code in src/.ml) MODS := ast \ parser lexer \ weeding transform outline \ main ############################################################ ## YOU SHOULD NOT NEED TO EDIT ANYTHING BELOW THIS LINE ############################################################ # Directories SRC_DIR := . DOC_DIR := doc BLD_DIR := _build # Base invokation of ocamlbuild OCAMLBUILD := ocamlbuild -no-links -ocamlyacc "ocamlyacc -v" -Xs $(EXCL_DIRS) html.byte: prepare @echo "*** Building html.byte" @$(OCAMLBUILD) $(SRC_DIR)/main.byte @ln -sf $(BLD_DIR)/$(SRC_DIR)/main.byte html.byte @ln -sf html.byte html html.native: prepare @echo "*** Building html.native" @$(OCAMLBUILD) $(SRC_DIR)/main.native @ln -sf $(BLD_DIR)/$(SRC_DIR)/main.native html.native @ln -sf html.native html html.debug: prepare @echo "*** Building html.debug" @$(OCAMLBUILD) $(SRC_DIR)/main.d.byte @ln -sf _build/$(SRC_DIR)/main.d.byte html.debug html.profile: prepare @echo "*** Building html.profile" @$(OCAMLBUILD) $(SRC_DIR)/main.p.native @ln -sf _build/$(SRC_DIR)/main.p.native html.profile html.top: prepare @echo "*** Building html.top" @echo $(MODS:%=$(SRC_DIR)/%) > $(SRC_DIR)/main.mltop @$(OCAMLBUILD) $(SRC_DIR)/main.top @rm -f $(SRC_DIR)/main.mltop @ln -sf _build/$(SRC_DIR)/main.top html.top htdoc: html.byte @echo "*** Building $(DOC_DIR)" @mkdir -p $(DOC_DIR) @ocamldoc -d $(DOC_DIR) -I $(BLD_DIR)/$(SRC_DIR) \ -html $(MODS:%=$(BLD_DIR)/$(SRC_DIR)/%.ml) @echo "Open $(DOC_DIR)/index.html to browse the documentation." clean: $(OCAMLBUILD) -clean rm -rf $(DOC_DIR) rm -f html html.byte html.native html.top html.debug html.profile rm -f $(SRC_DIR)/main.mltop rm -f .ocamlinit rm -f parser.output ## Some specially generated files .ocamlinit: @echo "#directory \"$(BLD_DIR)/$(SRC_DIR)\";;" > .ocamlinit parser.output: @ln -sf $(BLD_DIR)/$(SRC_DIR)/parser.output parser.output prepare: .ocamlinit parser.output