From 7ccfc1fdb1c0030e6e2105d50d76122b8f10c687 Mon Sep 17 00:00:00 2001 From: Zheng Da Date: Mon, 21 Dec 2009 03:00:41 +0100 Subject: check in mk. --- libdde_linux26/mk/doc.mk | 301 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 libdde_linux26/mk/doc.mk (limited to 'libdde_linux26/mk/doc.mk') diff --git a/libdde_linux26/mk/doc.mk b/libdde_linux26/mk/doc.mk new file mode 100644 index 00000000..2e102e3a --- /dev/null +++ b/libdde_linux26/mk/doc.mk @@ -0,0 +1,301 @@ +# -*- Makefile -*- +# +# DROPS (Dresden Realtime OPerating System) Component +# +# Makefile-Template for doc directories +# +# install.inc is used, see there for further documentation + +ifeq ($(origin _L4DIR_MK_DOC_MK),undefined) +_L4DIR_MK_DOC_MK=y + +ROLE = doc.mk + +include $(L4DIR)/mk/Makeconf +$(GENERAL_D_LO): $(L4DIR)/mk/doc.mk + +ifeq ($(IN_OBJ_DIR),) +################################################################## +# +# Empty IN_OBJ_DIR means we are in the source directory and have +# to first generate a Makefile in the build-dir. +# +################################################################## + +all install clean cleanall help:: $(OBJ_DIR)/Makefile.build + $(VERBOSE)PWD=$(OBJ_DIR) $(MAKE) -C $(OBJ_DIR) O=$(OBJ_BASE) -f Makefile.build $@ + + +$(OBJ_DIR)/Makefile.build: $(SRC_DIR)/Makefile + $(VERBOSE)install -d $(dir $@) + $(VERBOSE)echo 'IN_OBJ_DIR=1' > $@ + $(VERBOSE)echo 'L4DIR=$(L4DIR_ABS)' >> $@ + $(VERBOSE)echo 'SRC_DIR=$(SRC_DIR)' >> $@ + $(VERBOSE)echo 'OBJ_BASE=$(OBJ_BASE)' >> $@ + $(VERBOSE)echo 'PKGDIR_ABS=$(PKGDIR_ABS)' >> $@ + $(VERBOSE)echo 'vpath %.fig $(SRC_DIR)' >> $@ + $(VERBOSE)echo 'vpath %.tex $(SRC_DIR)' >> $@ + $(VERBOSE)echo 'include $(SRC_DIR)/Makefile' >> $@ + +else +################################################################### +# +# We are in the build directory and can process the documentation +# +################################################################### + +# default is to install all targets +INSTALL_TARGET_MASK ?= % + +ifneq ($(TARGET),) +# if no SRC_DOX is given, but TARGET, extract it from TARGET +ifeq ($(origin SRC_DOX),undefined) +SRC_DOX := $(filter $(addsuffix .cfg, $(TARGET)),$(wildcard *.cfg)) +ifneq ($(SRC_DOX),) +$(error SRC_DOX is undefined, but TARGET is defined. This is invalid since 04/23/2003) +endif +endif +# the same for SRC_TEX +ifeq ($(origin SRC_TEX),undefined) +SRC_TEX := $(filter $(TARGET:.ps=.tex),$(wildcard *.tex)) \ + $(filter $(TARGET:.pdf=.tex),$(wildcard *.tex)) + $(filter $(TARGET:.dvi=.tex),$(wildcard *.tex)) +ifneq ($(SRC_TEX),) +$(error SRC_TEX is undefined, but TARGET is defined. This is invalid since 04/23/2003) +endif +endif +endif + +TARGET_DOX = $(SRC_DOX:.cfg=) $(SRC_DOX_REF:.cfg=) \ + $(SRC_DOX_GUIDE:.cfg=) $(SRC_DOX_INT:.cfg=) +INSTALL_TARGET_DOX ?= $(filter $(INSTALL_TARGET_MASK), $(TARGET_DOX)) +TARGET_TEX ?= $(SRC_TEX:.tex=.ps) $(SRC_TEX:.tex=.pdf) +DEPS += $(foreach x,$(SRC_TEX:.tex=.dvi),$(dir $x).$(notdir $x).d) + +# if no TARGET is given, generate it from all types of targets +TARGET ?= $(TARGET_DOX) $(TARGET_TEX) +DEPS += $(foreach file,$(TARGET),$(dir $(file)).$(notdir $(file)).d) + +all:: $(TARGET) +$(TARGET): $(OBJ_DIR)/.general.d + +#################################################################### +# +# Doxygen specific +# +#################################################################### +DOXY_FLAGS += $(DOXY_FLAGS_$@) + +OUTPUTDIR = $(shell perl -n -e '/^\s*OUTPUT_DIRECTORY\s*=\s*(\S+)/ && print "$$1\n"' $(1)) + +# we refer to %/html sometimes. However, make fails on a rule of the form +# "% %/html:%.cfg", thus the workaround (others than static-pattern-rules +# won't work) +$(addprefix $(OBJ_DIR)/,$(addsuffix /html,$(TARGET_DOX))):$(OBJ_DIR)/%/html:$(OBJ_DIR)/% + +# We can give an internal rule for doxygen, as the directory specified +# in the config-file should be the name of the config file with the +# .cfg removed. +$(OBJ_DIR)/% $(OBJ_DIR)/%/html:$(SRC_DIR)/%.cfg + #generate the flags-file + $(VERBOSE)$(MKDIR) $@ + $(VERBOSE)$(ECHO) '@INCLUDE=$(notdir $<);$(DOXY_FLAGS);OUTPUT_DIRECTORY=$(OBJ_DIR)/$(call OUTPUTDIR,$<)' | $(TR) \; \\n >$@.flags + $(VERBOSE)cd $(SRC_DIR) && $(call MAKEDEP,doxygen) OBJ_DIR=$(OBJ_DIR) doxygen $@.flags + $(VERBOSE)( [ -r $@/latex/Makefile ] && \ + echo | PWD=$@/latex $(MAKE) -C $@/latex ) || true + $(VERBOSE)if [ -d $@ ] ; then touch $@ ; fi + +# Installation rules follow +# +# define LOCAL_INSTALLDIR prior to including install.inc, where the install- +# rules are defined. Same for INSTALLDIR. +INSTALLDIR_HTML ?= $(DROPS_STDDIR)/doc/html +INSTALLFILE_HTML ?= $(CP) -pR $(1) $(2) +INSTALLDIR_HTML_LOCAL ?= $(OBJ_BASE)/doc/html +INSTALLFILE_HTML_LOCAL ?= for f in $(wildcard $(call absfilename,$(1))); do $(LN) -sf $$f $(2); done + +INSTALLDIR = $(INSTALLDIR_HTML) +INSTALLFILE = $(INSTALLFILE_HTML) +INSTALLDIR_LOCAL = $(INSTALLDIR_HTML_LOCAL) +INSTALLFILE_LOCAL = $(INSTALLFILE_HTML_LOCAL) + +all:: $(TARGET) \ + $(addprefix $(INSTALLDIR_LOCAL)/, $(addsuffix .title, $(INSTALL_TARGET_DOX))) + +$(OBJ_DIR)/$(SRC_DOX_REF:.cfg=.title): BID_DOC_DOXTYPE=ref +$(OBJ_DIR)/$(SRC_DOX_GUIDE:.cfg=.title): BID_DOC_DOXTYPE=guide +$(OBJ_DIR)/$(SRC_DOX_INT:.cfg=.title): BID_DOC_DOXTYPE=int + +# first line: type +# second line: title that will appear at the generated index page +$(OBJ_DIR)/%.title:$(SRC_DIR)/%.cfg $(OBJ_DIR)/.general.d + $(VERBOSE)$(ECHO) $(BID_DOC_DOXTYPE)>$@ + $(VERBOSE)MAKEFLAGS= $(MAKE) -s -f $(L4DIR)/mk/makehelpers.inc -f $< \ + BID_print VAR=PROJECT_NAME >>$@ + +# Install the title file locally +# The installed title file depends on the installed doku for message reasons +$(foreach f,$(INSTALL_TARGET_DOX),$(INSTALLDIR_LOCAL)/$(f).title):$(INSTALLDIR_LOCAL)/%.title:$(OBJ_DIR)/%.title $(INSTALLDIR_LOCAL)/% + $(VERBOSE)$(call INSTALLFILE_LOCAL,$<,$@) + @$(call UPDATE_HTML_MESSAGE,$(INSTALLDIR_LOCAL)) + +# Install the docu locally, the title file will depend on +$(foreach f,$(INSTALL_TARGET_DOX),$(INSTALLDIR_LOCAL)/$(f)):$(INSTALLDIR_LOCAL)/%:$(OBJ_DIR)/% $(OBJ_DIR)/%/html + @$(INSTALL_DOC_LOCAL_MESSAGE) + $(VERBOSE)$(INSTALL) -d $@ + $(VERBOSE)$(call INSTALLFILE_LOCAL,$