## Copyright 2002 DUMPLETON SOFTWARE CONSULTING PTY LIMITED ## ## This module serves as an example of how to generate documentation ## from header files using the classinfo tools. The module appear ## complicated, but it is because the generated documentation files ## may not have the same basename as the original header file and ## it is possible for one header file to generate multiple output ## files for the same target documentation type. ## This module doesn't yet address the issue of installing what is ## generated, with output always going into the makeit subdirectory. ## The best course of action would be "install" targets in this module ## to copy files elsewhere. vpath %.h $(SRCDIR) $(SRCDIRS) vpath %.hxx $(SRCDIR) $(SRCDIRS) vpath %.hpp $(SRCDIR) $(SRCDIRS) vpath %.hh $(SRCDIR) $(SRCDIRS) vpath %.sh $(SRCDIR) $(SRCDIRS) # Target structure. .PHONY : build-documentation .PHONY : build-documentation.setup .PHONY : build-documentation.subdirs .PHONY : build-documentation.target .PHONY : build-documentation.always build-documentation : build-documentation.setup build-documentation : build-documentation.subdirs build-documentation : build-documentation.target build-documentation : build-documentation.always build-documentation.setup :: makeit.setup build-documentation.subdirs :: build-documentation.setup ifneq "$(SUBDIRS)" "" ifneq "$(filter navigate_all_variants,$(MAKEIT_OPTIONS))" "" @$(foreach var,$(VARIANTS),$(foreach dir,$(SUBDIRS), \ $(MAKE) -C $(dir) VARIANT=$(var) build-documentation \ || $(FAILACTION);)) else @$(foreach dir,$(SUBDIRS), \ $(MAKE) -C $(dir) build-documentation || $(FAILACTION);) endif endif build-documentation.target :: build-documentation.setup build-documentation.always :: build-documentation.setup # Location of tools. ifeq "$(CLASS2INFO)" "" override CLASS2INFO := $(OSE_HOME)/bin/class2info endif ifeq "$(INFO2MAN)" "" override INFO2MAN := $(OSE_HOME)/bin/info2man endif ifeq "$(INFO2HTML)" "" override INFO2HTML := $(OSE_HOME)/bin/info2html endif ifeq "$(INFO2MML)" "" override INFO2MML := $(OSE_HOME)/bin/info2mml endif # Calculate input header files. _classinfo_headers_SRC1 := $(filter-out $(EXCLUDE),$(filter %.h,$(SRCFILES))) _classinfo_headers_SRC2 := $(filter-out $(EXCLUDE),$(filter %.hxx,$(SRCFILES))) _classinfo_headers_SRC3 := $(filter-out $(EXCLUDE),$(filter %.hpp,$(SRCFILES))) _classinfo_headers_SRC4 := $(filter-out $(EXCLUDE),$(filter %.hh,$(SRCFILES))) _classinfo_scripts_SRC1 := $(filter-out $(EXCLUDE),$(filter %.sh,$(SRCFILES))) _classinfo_headers_SRC_STEMS1 := $(basename $(_classinfo_headers_SRC1)) _classinfo_headers_SRC_STEMS2 := $(basename $(_classinfo_headers_SRC2)) _classinfo_headers_SRC_STEMS3 := $(basename $(_classinfo_headers_SRC3)) _classinfo_headers_SRC_STEMS4 := $(basename $(_classinfo_headers_SRC4)) _classinfo_scripts_SRC_STEMS1 := $(basename $(_classinfo_scripts_SRC1)) _classinfo_headers_SRC_STEMS := \ $(_classinfo_headers_SRC_STEMS1) \ $(_classinfo_headers_SRC_STEMS2) \ $(_classinfo_headers_SRC_STEMS3) \ $(_classinfo_headers_SRC_STEMS4) _classinfo_scripts_SRC_STEMS = $(_classinfo_scripts_SRC_STEMS1) _classinfo_headers_INTERMEDIATE := \ $(patsubst %,$(MK)/%.ci,$(_classinfo_headers_SRC_STEMS)) _classinfo_scripts_INTERMEDIATE := \ $(patsubst %,$(MK)/%.ci,$(_classinfo_scripts_SRC_STEMS)) # Rules for generation of classinfo files. $(patsubst %,$(MK)/%.ci,$(_classinfo_headers_SRC_STEMS1)) : $(MK)/%.ci : %.h $(CLASS2INFO) -output $(MK) $< $(patsubst %,$(MK)/%.ci,$(_classinfo_headers_SRC_STEMS2)) : $(MK)/%.ci : %.hxx $(CLASS2INFO) -output $(MK) $< $(patsubst %,$(MK)/%.ci,$(_classinfo_headers_SRC_STEMS3)) : $(MK)/%.ci : %.hpp $(CLASS2INFO) -output $(MK) $< $(patsubst %,$(MK)/%.ci,$(_classinfo_headers_SRC_STEMS4)) : $(MK)/%.ci : %.hh $(CLASS2INFO) -output $(MK) $< $(patsubst %,$(MK)/%.ci,$(_classinfo_scripts_SRC_STEMS1)) : $(MK)/%.ci : %.sh $(CLASS2INFO) -output $(MK) $< # Rules for UNIX style manual pages. ifneq "$(filter man,$(CLASSINFO_OPTIONS))" "" ifneq "$(_classinfo_headers_INTERMEDIATE)" "" classinfo.always :: $(MK)/info2man.headers $(MK)/info2man.headers : $(_classinfo_headers_INTERMEDIATE) $(INFO2MAN) -ext 3 -output $(MK) $(INFO2MAN_FLAGS) $? @touch $@ endif ifneq "$(_classinfo_scripts_INTERMEDIATE)" "" classinfo.always :: $(MK)/info2man.scripts $(MK)/info2man.scripts : $(_classinfo_scripts_INTERMEDIATE) $(INFO2MAN) -ext 1 -output $(MK) $(INFO2MAN_FLAGS) $? @touch $@ endif endif # Rules for HTML documentation. ifneq "$(filter html,$(CLASSINFO_OPTIONS))" "" ifneq "$(_classinfo_headers_INTERMEDIATE)" "" classinfo.always :: $(MK)/info2html.headers2 $(MK)/info2html.headers1 : $(_classinfo_headers_INTERMEDIATE) $(INFO2HTML) -output $(MK) $(INFO2HTML_FLAGS) $? @touch $@ RUN-INFO2HTML_HEADERS_LINK.classinfo = \ $(INFO2HTML) -link '$(MK)/*.html' -output $(MK) \ $(INFO2HTML_FLAGS) $(_classinfo_headers_INTERMEDIATE) ifneq "$(_classinfo_scripts_INTERMEDIATE)" "" $(MK)/info2html.headers2 :: $(MK)/info2html.headers1 $(MK)/info2html.scripts1 else $(MK)/info2html.headers2 :: $(MK)/info2html.headers1 endif $(RUN-INFO2HTML_HEADERS_LINK.classinfo) @touch $@ endif ifneq "$(_classinfo_scripts_INTERMEDIATE)" "" classinfo.always :: $(MK)/info2html.scripts2 $(MK)/info2html.scripts1 : $(_classinfo_scripts_INTERMEDIATE) $(INFO2HTML) -output $(MK) $(INFO2HTML_FLAGS) $? @touch $@ RUN-INFO2HTML_SCRIPTS_LINK.classinfo = \ $(INFO2HTML) -link '$(MK)/*.html' -output $(MK) \ $(INFO2HTML_FLAGS) $(_classinfo_scripts_INTERMEDIATE) ifneq "$(_classinfo_headers_INTERMEDIATE)" "" $(MK)/info2html.scripts2 :: $(MK)/info2html.scripts1 $(MK)/info2html.headers1 else $(MK)/info2html.scripts2 :: $(MK)/info2html.scripts1 endif $(RUN-INFO2HTML_SCRIPTS_LINK.classinfo) @touch $@ endif endif # Rules for MML documentation. ifneq "$(filter mml,$(CLASSINFO_OPTIONS))" "" ifneq "$(_classinfo_headers_INTERMEDIATE)" "" classinfo.always :: $(MK)/info2mml.headers $(MK)/info2mml.headers : $(_classinfo_headers_INTERMEDIATE) $(INFO2MML) -output $(MK) $(INFO2MML_FLAGS) $? @touch $@ endif ifneq "$(_classinfo_scripts_INTERMEDIATE)" "" classinfo.always :: $(MK)/info2mml.scripts $(MK)/info2mml.scripts : $(_classinfo_scripts_INTERMEDIATE) $(INFO2MML) -output $(MK) $(INFO2MML_FLAGS) $? @touch $@ endif endif # Cleanup generated files. mostlyclean.target :: $(RM) $(MK)/info2*.scripts* $(RM) $(MK)/info2*.headers* $(RM) $(MK)/*.ci