Skip to content

Commit

Permalink
[enhance] manpages: improved Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Ye committed Oct 26, 2012
1 parent 4b18bac commit bd5e582
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ distrib: $(MYOCAMLBUILD)
.PHONY: manpages
manpages: $(MYOCAMLBUILD)
ifndef NO_MANPAGES
$(MAKE) -C $(OPALANG_DIR)/tools/manpages OCAMLBUILD="$(OCAMLBUILD)" BLDDIR=../../$(BUILD_DIR)
$(MAKE) -f $(OPALANG_DIR)/tools/manpages/Makefile
else
@echo "Not building manpages"
endif
Expand Down
30 changes: 15 additions & 15 deletions tools/manpages/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
# build the list of target binaries to be documented:
# bin/* and lib/opa/bin/* together with inclusions and exclusions
# --
BLDDIR ?= ../../_build
BUILD_DIR ?= _build
OCAMLBUILD ?= bld

BINDIR=$(BLDDIR)/bin
BINDIR=$(BUILD_DIR)/bin
EXCLUDE=opa-bin mlstate_platform genproto ocamlbase.top ppdebug-opa ppjs
INCLUDE=opa
BINS=$(INCLUDE) $(filter-out $(EXCLUDE), $(notdir $(wildcard $(BLDDIR)/bin/* $(BLDDIR)/lib/opa/bin/*)))
BINS=$(INCLUDE) $(filter-out $(EXCLUDE), $(notdir $(wildcard $(BUILD_DIR)/bin/* $(BUILD_DIR)/lib/opa/bin/*)))

TARGETDIR=$(BLDDIR)/man/man1
TARGETDIR=$(BUILD_DIR)/man/man1
TARGETS=$(addprefix $(TARGETDIR)/, $(addsuffix .1, $(BINS)))

all: $(TARGETS)
Expand All @@ -37,35 +37,35 @@ $(TARGETDIR)/%.1: %.man
# --
# second run specific manpage generation programs
# --
$(BLDDIR)/compiler/opa/gen_opa_manpage.native: ../../compiler/opa/gen_opa_manpage.ml
cd ../..; $(OCAMLBUILD) compiler/opa/gen_opa_manpage.native
$(BUILD_DIR)/$(OPALANG_DIR)/compiler/opa/gen_opa_manpage.native: $(OPALANG_DIR)/compiler/opa/gen_opa_manpage.ml
$(OCAMLBUILD) $(OPALANG_DIR)/compiler/opa/gen_opa_manpage.native

$(TARGETDIR)/opa.1: $(BLDDIR)/compiler/opa/gen_opa_manpage.native
$(TARGETDIR)/opa.1: $(BUILD_DIR)/$(OPALANG_DIR)/compiler/opa/gen_opa_manpage.native
@mkdir -p $(TARGETDIR)
$< > $@
gzip -f --best $@

$(BLDDIR)/compiler/opatop/gen_opatop_manpage.native: ../../compiler/opatop/gen_opatop_manpage.ml
cd ../..; $(OCAMLBUILD) compiler/opatop/gen_opatop_manpage.native
$(BUILD_DIR)/$(OPALANG_DIR)/compiler/opatop/gen_opatop_manpage.native: $(OPALANG_DIR)/compiler/opatop/gen_opatop_manpage.ml
$(OCAMLBUILD) $(OPALANG_DIR)/compiler/opatop/gen_opatop_manpage.native

$(TARGETDIR)/opatop.1: $(BLDDIR)/compiler/opatop/gen_opatop_manpage.native
$(TARGETDIR)/opatop.1: $(BUILD_DIR)/$(OPALANG_DIR)/compiler/opatop/gen_opatop_manpage.native
@mkdir -p $(TARGETDIR)
$< > $@
gzip -f --best $@

# --
# third run our hackish conversion tool help->manpage
# --
GENMAN=$(BLDDIR)/tools/manpages/genman.native
GENMAN=$(BUILD_DIR)/$(OPALANG_DIR)/tools/manpages/genman.native

$(GENMAN): genman.ml
cd ../..; $(OCAMLBUILD) -cflags "-w -14" tools/manpages/genman.native
$(GENMAN): $(OPALANG_DIR)/tools/manpages/genman.ml
$(OCAMLBUILD) -cflags "-w -14" $(OPALANG_DIR)/tools/manpages/genman.native

$(TARGETDIR)/%.help: $(BLDDIR)/bin/%
$(TARGETDIR)/%.help: $(BUILD_DIR)/bin/%
@mkdir -p $(TARGETDIR)
$< --help >$@ 2>&1 ||true

$(TARGETDIR)/%.help: $(BLDDIR)/lib/opa/bin/%
$(TARGETDIR)/%.help: $(BUILD_DIR)/lib/opa/bin/%
@mkdir -p $(TARGETDIR)
$< --help >$@ 2>&1 ||true

Expand Down

0 comments on commit bd5e582

Please sign in to comment.