Orb/lib/flm/doxygen.flm
changeset 0 42188c7ea2d9
child 1 82f11024044a
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 # Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved.
       
     2 # This component and the accompanying materials are made available under the terms of the License 
       
     3 # "Eclipse Public License v1.0" which accompanies this distribution, 
       
     4 # and is available at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     5 #
       
     6 # Initial Contributors:
       
     7 # Nokia Corporation - initial contribution.
       
     8 #
       
     9 # Contributors:
       
    10 #
       
    11 # Description:
       
    12 # An FLM, for creating a Doxygen configuration file and running Doxygen on that file
       
    13 # to generate documentation.
       
    14 
       
    15 
       
    16 #Print version and generated dox file in log file
       
    17 $(info Using Doxygen Extension Version: 0.1)
       
    18 $(info DOXYFILE: $(OUTPUTPATH)/$(DOXY_FILE))
       
    19 
       
    20 #definition that generates a doxygen configuration file and runs doxygen on it
       
    21 define generatedoxconfig
       
    22 ALL:: $(OUTPUTPATH)/$(DOXY_FILE).done
       
    23 
       
    24 # Run doxygen on the dox file. Indicate doxygen was run by creating an empty .done file
       
    25 # Also runs the Orb python plug-ins which post-process the XML.
       
    26 $(OUTPUTPATH)/$(DOXY_FILE).done: $(OUTPUTPATH)/$(DOXY_FILE) $(OUTPUTPATH)/meta.xml
       
    27 	$(call startrule,rundoxygen) \
       
    28 	$(SBS_DOXYGEN) $(OUTPUTPATH)/$(DOXY_FILE) &&  \
       
    29 	$(GNUTOUCH) $(OUTPUTPATH)/$(DOXY_FILE).done && \
       
    30 	$(SBS_PYTHON) "$(SBS_HOME)/python/doxygen/mapfilter.py" $(OUTPUTPATH)/dox/dita/$(TARGET).ditamap $(OUTPUTPATH)/meta.xml && \
       
    31 	$(SBS_PYTHON) "$(SBS_HOME)/python/doxygen/linkinserter.py" $(OUTPUTPATH)/dox/dita && \
       
    32 	$(GNUCP) -r $(OUTPUTPATH)/dox/dita $(EPOCROOT)/epoc32/release/doxygen \
       
    33 	$(call endrule,rundoxygen)
       
    34 
       
    35 # Create a meta.xml file which lists all of the project exports (header files exported by this target to epoc32)
       
    36 $(OUTPUTPATH)/meta.xml: $(PROJECT_META)
       
    37 	echo "<exports>" > $(OUTPUTPATH)/meta.xml && \
       
    38 	echo -e "$(foreach header,$(EXPORTHEADERS),<header>$(header)</header>\n)" >> $(OUTPUTPATH)/meta.xml && \
       
    39 	echo "</exports>" >> $(OUTPUTPATH)/meta.xml
       
    40 	
       
    41 #Generate the doxygen configuration file from a template
       
    42 #cpp is run on the PROUDCT_INLCLUDE hrh file to output all defines. 
       
    43 #The cpp output piped to several SED regular expressions to create doxygen compatible defines to the TMP_HRH_DEFINES_FILE file
       
    44 #The list is newline delimited so the tr command is used to remove all new lines and replace them with a space and this is output to HRH_DEFINES_FILE
       
    45 #sed is used to  replace placeholders in the doxygen configuration template doxtemplate.txt with Raptor variables to produce TMP_DOXY_FILE
       
    46 #TMP_DOXY_FILE is concatonated to HRH_DEFINES_FILE (last line in TMP_DOXY_FILE is "PREDEFINED =")
       
    47 $(OUTPUTPATH)/$(DOXY_FILE): $(PROJECT_META)
       
    48 	$(call startrule,generatedoxconfig) \
       
    49 	$(GNUCPP) -E -dD $(PRODUCT_INCLUDE) | $(GNUSED) -r "s|#define  *([^ ]+\(.*\))  *([^ ]+)|\1=\"\2\"|;s|#define  *([^ ]+) *$$$$|\1|;s|#define  *([^ ]+)  *([^ ]+)|\1=\"\2\"|;s|^# .*||" > $(OUTPUTPATH)/$(TMP_HRH_DEFINES_FILE) && \
       
    50 	$(GNUTR) -s "\r\n" " " < $(OUTPUTPATH)/$(TMP_HRH_DEFINES_FILE) > $(OUTPUTPATH)/$(HRH_DEFINES_FILE) && \
       
    51 	$(GNUSED) "s|##OUTPUTPATH##|$(OUTPUTPATH)|g;s|##SOURCE##|$(SOURCE)|g;s|##INCLUDES##|$(INCLUDES)|g;s|##DEFINES##|$(DEFINES)|g;s|##PROJECT_NAME##|$(TARGET)|g" < $(FLMHOME)/doxtemplate.txt >$(OUTPUTPATH)/$(TMP_DOXY_FILE) && \
       
    52 	$(GNUCAT) $(OUTPUTPATH)/$(TMP_DOXY_FILE) $(OUTPUTPATH)/$(HRH_DEFINES_FILE) >$(OUTPUTPATH)/$(DOXY_FILE) \
       
    53 	$(call endrule,generatedoxconfig)
       
    54 
       
    55 endef
       
    56 
       
    57 # Deduce whether we should be performing a build with standard CPP characteristics
       
    58 # This operates differently per-OS release, although OE TARGETTYPEs always build with standard CPP traits
       
    59 ifeq ($(OPEN_ENVIRONMENT),1)
       
    60   STDCPP_BUILD:=1
       
    61 endif
       
    62 
       
    63 ifeq ($(SUPPORTS_STDCPP_NEWLIB),1)
       
    64   ifeq ($(NOSTDCPP),1)
       
    65     STDCPP_BUILD:=
       
    66   else
       
    67     ifeq ($(STDCPP),1)
       
    68       STDCPP_BUILD:=1
       
    69     endif
       
    70   endif
       
    71 endif
       
    72   
       
    73 ifeq ($(STDCPP_BUILD),1)
       
    74   CDEFS:=$(CDEFS) $(STDCPP_DEF)
       
    75   SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(STDCPP_INCLUDE)
       
    76 endif
       
    77 
       
    78 CDEFS:=$(CDEFS) $(TARGET_DEFS)
       
    79 SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(TARGET_INCLUDES)
       
    80 
       
    81 # include paths
       
    82 UINCLUDE:=$(patsubst %,$(OPT.USERINCLUDE)%,$(USERINCLUDE))
       
    83 SINCLUDE:=$(patsubst %,$(OPT.SYSINCLUDE)%,$(SYSTEMINCLUDE))
       
    84 PINCLUDE:=$(OPT.PREINCLUDE)$(PRODUCT_INCLUDE)
       
    85 INCLUDES:=$(UINCLUDE) $(OPT.SPLITINCLUDE) $(SINCLUDE) $(PINCLUDE)
       
    86 #combination of all macros made available by Raptor
       
    87 DEFINES:=$(call makemacrodef,$(OPT.DEFINE),$(CDEFS) $(TARGET_MACRO)) 
       
    88 
       
    89 #Debug info
       
    90 $(info SBS_DOXYGEN: $(SBS_DOXYGEN))
       
    91 $(info GNUTOUCH: $(GNUTOUCH))
       
    92 $(info OUTPUTPATH: $(OUTPUTPATH))
       
    93 $(info CDEFS: $(CDEFS))
       
    94 $(info OPT.PREINCLUDE :$(OPT.PREINCLUDE))
       
    95 $(info OPT.SPLITINCLUDE :$(OPT.SPLITINCLUDE))
       
    96 $(info OPT.SYSINCLUDE :$(OPT.SYSINCLUDE))
       
    97 $(info OPT.USERINCLUDE :$(OPT.USERINCLUDE))
       
    98 $(info SYSTEMINCLUDE :$(SYSTEMINCLUDE))
       
    99 $(info DEFINES : $(DEFINES))
       
   100 $(info INCLUDES : $(INCLUDES))
       
   101 $(info EXPORTHEADERS : $(EXPORTHEADERS))
       
   102 $(info PRODUCT_INCLUDE: $(PRODUCT_INCLUDE))
       
   103 $(info TARGETTYPE: $(TARGETTYPE))
       
   104 $(info COMPONENT_NAME: $(COMPONENT_NAME))
       
   105 $(info CAPABILITY: $(CAPABILITY))
       
   106 
       
   107 #Variables specific to generatedoxconfig
       
   108 TMP_DOXY_FILE:=config.dox.tmp
       
   109 DOXY_FILE:=config.dox
       
   110 TMP_HRH_DEFINES_FILE:=hrhdefines.txt.tmp
       
   111 HRH_DEFINES_FILE:=hrhdefines.txt
       
   112 $(eval $(generatedoxconfig))
       
   113 
       
   114 # make the output directories while reading makefile - some build engines prefer this
       
   115 $(call makepath,$(OUTPUTPATH))
       
   116 $(call makepath,$(EPOCROOT)/epoc32/release/doxygen)
       
   117 
       
   118 ## Clean up - problem here - how do we know what docs to remove?  Anyhow removing the marker (.done) file will at least
       
   119 ## ensure that we regenerate documentation when needed even if we don't actually get rid of old docs.
       
   120 $(eval $(call GenerateStandardCleanTarget,$(OUTPUTPATH)/$(DOXY_FILE) $(OUTPUTPATH)/$(DOXY_FILE).done,$(OUTPUTPATH),))
       
   121 
       
   122