Orb/lib/flm/doxygen.flm
changeset 3 d8fccb2cd802
child 4 468f4c8d3d5b
equal deleted inserted replaced
2:932c358ece3e 3:d8fccb2cd802
       
     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 # The groupin8 macro allows us to construct a via file, 8 objects at a time
       
    16 # to avoid limits on argument lengths and sizes on Windows.
       
    17 # It expands to a list of commands, each of which is on a separate line.
       
    18 # This causes the shell to be invoked once for each line but each line should
       
    19 # be shorter than the maximum allowed by windows.
       
    20 define groupin8
       
    21 	# NOTE: echo wierdness with -e means that we have to use ocatal escape code \0134\n (or \0134\0012)
       
    22 	# If we use "\\\n" make discards the '\\' char. If we use "\\ \n" then we get a spurious space
       
    23 	# after the '\' line continuation character (which consigns the line continuation character to
       
    24 	# oblivion). So we use \0134 and that gives us a '\' immediatly followed by a newline.
       
    25 	$(if $1,@echo -e -n $(foreach L,$(wordlist 1,8,$1),"$(L) \0134\n")>>$(OUTPUTPATH)/$(DOXY_FILE),)
       
    26 	$(if $1,$(call groupin8,$(wordlist 9,$(words $1),$1)),@true)
       
    27 endef
       
    28 
       
    29 #Print version and generated dox file in log file
       
    30 $(info Using Doxygen Extension Version: 0.1)
       
    31 $(info DOXYFILE: $(OUTPUTPATH)/$(DOXY_FILE))
       
    32 
       
    33 #definition that generates a doxygen configuration file and runs doxygen on it
       
    34 define generatedoxconfig
       
    35 ALL:: $(OUTPUTPATH)/$(DOXY_FILE).done
       
    36 
       
    37 # Run doxygen on the dox file. Indicate doxygen was run by creating an empty .done file
       
    38 # Also runs the Orb python plug-ins which post-process the XML.
       
    39 $(OUTPUTPATH)/$(DOXY_FILE).done: $(OUTPUTPATH)/$(DOXY_FILE)
       
    40 	$(call startrule,rundoxygen) \
       
    41 	$(SBS_DOXYGEN) $(OUTPUTPATH)/$(DOXY_FILE) &&  \
       
    42 	$(GNUTOUCH) $(OUTPUTPATH)/$(DOXY_FILE).done && \
       
    43 	$(GNUCP) -r -u $(OUTPUTPATH)/dox/dita $(EPOCROOT)/epoc32/release/doxygen \
       
    44 	$(call endrule,rundoxygen)
       
    45 
       
    46 #Generate the doxygen configuration file from a template
       
    47 #cpp is run on the PROUDCT_INLCLUDE hrh file to output all defines. 
       
    48 #The cpp output piped to several SED regular expressions to create doxygen compatible defines to the TMP_HRH_DEFINES_FILE file
       
    49 #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
       
    50 #sed is used to  replace placeholders in the doxygen configuration template doxtemplate.txt with Raptor variables to produce TMP_DOXY_FILE
       
    51 #TMP_DOXY_FILE is concatonated to HRH_DEFINES_FILE (last line in TMP_DOXY_FILE is "PREDEFINED =")
       
    52 $(OUTPUTPATH)/$(DOXY_FILE): $(PROJECT_META)
       
    53 	# Capture #define statements in .hrh file
       
    54 	$(GNUCP) $(FLMHOME)/doxtemplate.txt $(OUTPUTPATH)/$(DOXY_FILE)
       
    55 	$(GNUCHMOD) 777 $(OUTPUTPATH)/$(DOXY_FILE)
       
    56 	# Add to PREDEFINED, this must be done first
       
    57 	$(call groupin8, $(DEFINES))
       
    58 	@echo -e "" >>$(OUTPUTPATH)/$(DOXY_FILE)
       
    59 	# The rest can be done in any order
       
    60 	# First the one-liners Note: echo does not use -n as we want the newline
       
    61 	@echo -e "PROJECT_NAME = $(TARGET)" >>$(OUTPUTPATH)/$(DOXY_FILE)
       
    62 	@echo -e "OUTPUT_DIRECTORY = $(OUTPUTPATH)/dox" >>$(OUTPUTPATH)/$(DOXY_FILE)
       
    63 	@echo -e "WARN_LOGFILE = $(OUTPUTPATH)/warning.log" >>$(OUTPUTPATH)/$(DOXY_FILE)
       
    64 	# Next INPUT i.e. source files
       
    65 	@echo -e -n "INPUT = " >>$(OUTPUTPATH)/$(DOXY_FILE)
       
    66 	$(call groupin8, $(SOURCE))
       
    67 	@echo -e "" >>$(OUTPUTPATH)/$(DOXY_FILE)
       
    68 	@echo -e -n "INCLUDE_PATH = " >>$(OUTPUTPATH)/$(DOXY_FILE)
       
    69 	$(call groupin8, $(INCLUDES))
       
    70 endef
       
    71 
       
    72 # Deduce whether we should be performing a build with standard CPP characteristics
       
    73 # This operates differently per-OS release, although OE TARGETTYPEs always build with standard CPP traits
       
    74 ifeq ($(OPEN_ENVIRONMENT),1)
       
    75   STDCPP_BUILD:=1
       
    76 endif
       
    77 
       
    78 ifeq ($(SUPPORTS_STDCPP_NEWLIB),1)
       
    79   ifeq ($(NOSTDCPP),1)
       
    80     STDCPP_BUILD:=
       
    81   else
       
    82     ifeq ($(STDCPP),1)
       
    83       STDCPP_BUILD:=1
       
    84     endif
       
    85   endif
       
    86 endif
       
    87   
       
    88 ifeq ($(STDCPP_BUILD),1)
       
    89   CDEFS:=$(CDEFS) $(STDCPP_DEF)
       
    90   SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(STDCPP_INCLUDE)
       
    91 endif
       
    92 
       
    93 CDEFS:=$(CDEFS) $(TARGET_DEFS)
       
    94 SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(TARGET_INCLUDES)
       
    95 
       
    96 # include paths
       
    97 UINCLUDE:=$(patsubst %,$(OPT.USERINCLUDE)%,$(USERINCLUDE))
       
    98 SINCLUDE:=$(patsubst %,$(OPT.SYSINCLUDE)%,$(SYSTEMINCLUDE))
       
    99 PINCLUDE:=$(OPT.PREINCLUDE)$(PRODUCT_INCLUDE)
       
   100 INCLUDES:=$(UINCLUDE) $(OPT.SPLITINCLUDE) $(SINCLUDE) $(PINCLUDE)
       
   101 #combination of all macros made available by Raptor
       
   102 DEFINES:=$(call makemacrodef,$(OPT.DEFINE),$(CDEFS) $(TARGET_MACRO)) 
       
   103 
       
   104 #Debug info
       
   105 $(info SBS_DOXYGEN: $(SBS_DOXYGEN))
       
   106 $(info GNUTOUCH: $(GNUTOUCH))
       
   107 $(info OUTPUTPATH: $(OUTPUTPATH))
       
   108 $(info CDEFS: $(CDEFS))
       
   109 $(info OPT.PREINCLUDE :$(OPT.PREINCLUDE))
       
   110 $(info OPT.SPLITINCLUDE :$(OPT.SPLITINCLUDE))
       
   111 $(info OPT.SYSINCLUDE :$(OPT.SYSINCLUDE))
       
   112 $(info OPT.USERINCLUDE :$(OPT.USERINCLUDE))
       
   113 $(info SYSTEMINCLUDE :$(SYSTEMINCLUDE))
       
   114 $(info DEFINES : $(DEFINES))
       
   115 $(info INCLUDES : $(INCLUDES))
       
   116 $(info EXPORTHEADERS : $(EXPORTHEADERS))
       
   117 $(info PRODUCT_INCLUDE: $(PRODUCT_INCLUDE))
       
   118 $(info TARGETTYPE: $(TARGETTYPE))
       
   119 $(info COMPONENT_NAME: $(COMPONENT_NAME))
       
   120 $(info CAPABILITY: $(CAPABILITY))
       
   121 
       
   122 #Variables specific to generatedoxconfig
       
   123 TMP_DOXY_FILE:=config.dox.tmp
       
   124 DOXY_FILE:=config.dox
       
   125 TMP_HRH_DEFINES_FILE:=hrhdefines.txt.tmp
       
   126 HRH_DEFINES_FILE:=hrhdefines.txt
       
   127 $(eval $(generatedoxconfig))
       
   128 
       
   129 
       
   130 # make the output directories while reading makefile - some build engines prefer this
       
   131 $(call makepath,$(OUTPUTPATH))
       
   132 $(call makepath,$(EPOCROOT)/epoc32/release/doxygen)
       
   133 
       
   134 ## Clean up - problem here - how do we know what docs to remove?  Anyhow removing the marker (.done) file will at least
       
   135 ## ensure that we regenerate documentation when needed even if we don't actually get rid of old docs.
       
   136 $(eval $(call GenerateStandardCleanTarget,$(OUTPUTPATH)/$(DOXY_FILE) $(OUTPUTPATH)/$(DOXY_FILE).done,$(OUTPUTPATH),))
       
   137 
       
   138