build/Makefile.comp
changeset 21 2a9601315dfc
child 25 9ac0a0a7da70
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: 
       
    15 #
       
    16 
       
    17 ifndef JAVA_SRC_ROOT
       
    18 $(error JAVA_SRC_ROOT variable not defined!)
       
    19 endif
       
    20 
       
    21 include $(JAVA_SRC_ROOT)/build/Makefile.defs
       
    22 
       
    23 
       
    24 .PHONY: build_clean_java build_qmake build_clean_native really_clean_native clean_qmake qmakehelp emmareport
       
    25 
       
    26 
       
    27 PRO_FILE = $(wildcard *.pro)
       
    28 ANT_FILE = $(wildcard build.xml)
       
    29 ifeq ($(PRO_FILE),)
       
    30 $(error No .pro file on COMPONENT directory $(CURDIR))
       
    31 endif
       
    32 
       
    33 clean: clean_java clean_native
       
    34 
       
    35 
       
    36 # Determine if Java needs to be built
       
    37 ifneq ($(ANT_FILE),)
       
    38 java: build_java
       
    39 clean_java: build_clean_java
       
    40 makestubs: build_makestubs
       
    41 else
       
    42 java:
       
    43 clean_java:
       
    44 makestubs:
       
    45 endif
       
    46 
       
    47 # Determine if native needs to be built
       
    48 qmake: build_qmake
       
    49 native: build_native
       
    50 clean_native: build_clean_native
       
    51 reallyclean: really_clean_native clean_generated
       
    52 
       
    53 
       
    54 # Common   ---------------------------------
       
    55 
       
    56 reallyclean: clean cleanexport
       
    57 
       
    58 test: 
       
    59 	$(PHASEINFO)
       
    60 	$(EXEC_QT)
       
    61 
       
    62 clean_configure:
       
    63 
       
    64 # Make stub files of .cpp and .h files of Java compilation (needed by qmake)
       
    65 build_makestubs:
       
    66 	$(PHASEINFO)
       
    67 ifndef SBOX_CPUTRANSPARENCY_LOG
       
    68 	$(ANT) -Dtarget.platform=$(PLATFORM) -Dtarget.cfg=debug $(ANT_PROJECT_DEFINES) export
       
    69 endif
       
    70 
       
    71 build_java:
       
    72 	$(PHASEINFO)
       
    73 ifndef SBOX_CPUTRANSPARENCY_LOG
       
    74 	$(ANT) -Dtarget.platform=$(PLATFORM) -Dtarget.cfg=$(VARIANT) $(ANT_PROJECT_DEFINES) $(ANT_EMMA_DEFINES)
       
    75 endif
       
    76 
       
    77 build_clean_java:
       
    78 	$(PHASEINFO)
       
    79 ifndef SBOX_CPUTRANSPARENCY_LOG
       
    80 	-$(ANT) -Dtarget.platform=$(PLATFORM) -Dtarget.cfg=$(VARIANT) $(ANT_PROJECT_DEFINES) clean
       
    81 endif
       
    82 
       
    83 # Say "QT-=gui core" here, as removing it in omj.prf (CONFIG += omj through .pro file) does
       
    84 # not work for "default_post" step.
       
    85 qmakehelp:
       
    86 	$(call PHASEINFO,qmake)
       
    87 	$(QMAKE) "PROJECT_DEFINES=$(PROJECT_DEFINES)"
       
    88 
       
    89 emmareport:
       
    90 ifndef SBOX_CPUTRANSPARENCY_LOG
       
    91 	$(ANT) -f $(JAVA_SRC_ROOT)/build/emmautilities.xml -Dset.emma.enabled=true emma.report
       
    92 endif
       
    93 
       
    94 # Add the pro-file to the subdirs of enclosing component. Must define the file
       
    95 # explicitly when directory (==build) is differntly named from pro-file.
       
    96 configure_qmake:
       
    97 ifdef TARGET_PRO
       
    98 	echo SUBDIRS += $(TARGET_SUB)/$(PRO_FILE) >> $(TARGET_PRO)
       
    99 endif
       
   100 
       
   101 # Symbian ----------------------------------
       
   102 ifeq ($(BUILDENV),symbian)
       
   103 
       
   104 all: qmake java native
       
   105 
       
   106 # Extract basename of current component
       
   107 BASENAME = $(basename $(PRO_FILE))
       
   108 
       
   109 # Use separate qmakefix run, so that wildcards are evaluated with 
       
   110 # latest directory content
       
   111 build_qmake: clean_qmake qmakehelp
       
   112 ifndef RD_JAVA_UI_QT
       
   113 	$(MAKE) -f $(JAVA_SRC_ROOT)/build/Makefile.comp qmakefix
       
   114 endif
       
   115 
       
   116 # Replace bld.inf completely, fix mmp (if any) and remove extra files
       
   117 # (used when QT is used only for qmake)
       
   118 qmakefix:
       
   119 	$(PHASEINFO)
       
   120 ifeq ($(filter 0 1,$(words $(wildcard $(BASENAME)_*.mmp))),)
       
   121 	$(error Old generated files left on build directory. Please run "make -f subsystem.mk clean_generated" on root directory, and rebuild)
       
   122 endif
       
   123 	$(call RMFILES,Makefile* $(BASENAME)_*.pkg bld.inf*)
       
   124 ifeq ($(wildcard $(BASENAME)_*.mmp),)
       
   125 	$(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/bld.inf) > bld.inf
       
   126 else
       
   127 	python $(JAVA_SRC_ROOT)/build/buildutils/fixmmp.py --tmp-dirs --datetime --header $(JAVA_SRC_ROOT)/build/templates/generated_header.txt $(wildcard $(BASENAME)_*.mmp) $(wildcard $(BASENAME)_*.mmp) && \
       
   128 	$(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/bld.inf) > bld.inf && \
       
   129 	echo PRJ_MMPFILES >> bld.inf && \
       
   130 	echo $(wildcard $(BASENAME)_*.mmp) >> bld.inf
       
   131 endif
       
   132 ifneq ($(wildcard exports.inf),)
       
   133 	echo #include "exports.inf" >> bld.inf
       
   134 endif
       
   135 
       
   136 javareleasables:
       
   137 ifneq ($(ANT_FILE),)
       
   138 	$(ANT) -q -Dtarget.platform=$(PLATFORM) -Dtarget.cfg=$(VARIANT) $(ANT_PROJECT_DEFINES) releasables > $(DEVNULL)
       
   139 	$(call CATCOMMAND,java_releasables_$(PLATFORM)_$(VARIANT).tmp)
       
   140 	$(call RMFILE,java_releasables_$(PLATFORM)_$(VARIANT).tmp)
       
   141 endif
       
   142 
       
   143 # Remove all generated build files
       
   144 clean_generated: FORCE
       
   145 	$(PHASEINFO)
       
   146 ifdef RD_JAVA_UI_QT
       
   147 	-$(call IFEXIST,Makefile,make dodistclean)
       
   148 endif
       
   149 	-$(call RMFILES,abld.bat bld.inf* Makefile* $(BASENAME).mmp $(BASENAME)_*.mmp $(BASENAME)_*.pkg $(BASENAME)_reg.rss eabi_stl4/*)
       
   150 	-$(call RMDIR, eabi_stl4) > $(DEVNULL) 2>&1
       
   151 
       
   152 clean_qmake:
       
   153 	-$(call RMFILES,abld.bat bld.inf* Makefile* $(BASENAME).mmp $(BASENAME)_*.mmp $(BASENAME)_*.pkg $(BASENAME)_reg.rss eabi_stl4/*)
       
   154 
       
   155 # Symbian SBS ------------------------------
       
   156 ifdef USESBS
       
   157 
       
   158 export: 
       
   159 	$(PHASEINFO)
       
   160 	$(SBS) -c $(PLATFORM)_$(CFG) EXPORT
       
   161 
       
   162 build_native:
       
   163 	$(PHASEINFO)
       
   164 	$(SBS) -c $(PLATFORM)_$(CFG) BUILD
       
   165 
       
   166 fastbuild: export java
       
   167 	$(PHASEINFO)
       
   168 	$(SBS) -c $(PLATFORM)_$(CFG) TARGET
       
   169 
       
   170 build_clean_native:
       
   171 	$(PHASEINFO)
       
   172 	-$(SBS) -c $(PLATFORM)_$(CFG) clean
       
   173 
       
   174 really_clean_native:
       
   175 	$(PHASEINFO)
       
   176 	-$(SBS) -c $(PLATFORM)_$(CFG) reallyclean
       
   177 
       
   178 cleanexport:
       
   179 	$(PHASEINFO)
       
   180 	-$(SBS) -c $(PLATFORM)_$(CFG) CLEANEXPORT
       
   181 
       
   182 
       
   183 # Symbian ABLD MAKEFILE --------------------
       
   184 else
       
   185 
       
   186 export: 
       
   187 	$(PHASEINFO)
       
   188 	$(BLDMAKE) bldfiles $(PLATFORM)
       
   189 	$(ABLDMAKE) -f $(BUILDDIR)/EXPORT.make EXPORT
       
   190 
       
   191 cleanexport:
       
   192 	$(PHASEINFO)
       
   193 	$(ABLDMAKE) -f $(BUILDDIR)/EXPORT.make CLEANEXPORT
       
   194 
       
   195 build_native:
       
   196 	$(PHASEINFO)
       
   197 	$(BLDMAKE) bldfiles $(PLATFORM)
       
   198 	$(ABLDMAKE) -f $(BUILDDIR)/EXPORT.make EXPORT
       
   199 	$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make MAKEFILE $(VERBOSE)
       
   200 	$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make LIBRARY $(VERBOSE)
       
   201 	$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make RESOURCE CFG=$(CFG) $(VERBOSE)
       
   202 	$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make TARGET CFG=$(CFG) $(VERBOSE)
       
   203 	$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make FINAL CFG=$(CFG) $(VERBOSE)
       
   204 
       
   205 fastbuild: export java
       
   206 	$(PHASEINFO)
       
   207 	$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make TARGET CFG=$(CFG) $(VERBOSE)
       
   208 
       
   209 build_clean_native:
       
   210 	$(PHASEINFO)
       
   211 	-$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make CLEAN CFG=$(CFG) $(VERBOSE)
       
   212 
       
   213 really_clean_native:
       
   214 	$(PHASEINFO)
       
   215 	$(BLDMAKE) bldfiles $(PLATFORM)
       
   216 	$(ABLDMAKE) -f $(BUILDDIR)/$(PLATFORM).make MAKEFILE $(VERBOSE) NO_DEPENDENCIES=-nd
       
   217 	-abld reallyclean $(PLATFORM) $(CFG)
       
   218 	-$(BLDMAKE) clean
       
   219 
       
   220 endif
       
   221 
       
   222 
       
   223 # Linux ------------------------------------
       
   224 else
       
   225 
       
   226 all: export java qmake native
       
   227 
       
   228 EXPORTCMD = python ${JAVA_SRC_ROOT}/build/buildutils/export.py -DJAVA_SRC_ROOT=$(JAVA_SRC_ROOT) -DJAVA_BIN_ROOT=$(JAVA_BIN_ROOT) $(addprefix -D,$(PROJECT_DEFINES))
       
   229 
       
   230 export: 
       
   231 	$(EXPORTCMD) BUILD exports.inf
       
   232 
       
   233 cleanexport:
       
   234 	$(EXPORTCMD) CLEAN exports.inf
       
   235 
       
   236 build_makemake: qmake
       
   237 
       
   238 build_qmake: qmakehelp
       
   239 
       
   240 build_native:	
       
   241 	$(PHASEINFO)
       
   242 	make
       
   243 
       
   244 build_clean_native:
       
   245 	-make clean
       
   246 
       
   247 really_clean_native: 
       
   248 	-make distclean
       
   249 
       
   250 clean_generated:
       
   251 	-rm Makefile
       
   252 
       
   253 endif