diff options
Diffstat (limited to 'qmake')
25 files changed, 4815 insertions, 88 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 7634021..c7f4dc4 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -9,7 +9,8 @@ LFLAGS = @QMAKE_LFLAGS@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ mingw_make.o option.o winmakefile.o projectgenerator.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ - borland_bmake.o msvc_dsp.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o + borland_bmake.o msvc_dsp.o msvc_vcproj.o msvc_nmake.o msvc_objectmodel.o \ + symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o #qt code QOBJS=qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ @@ -30,7 +31,7 @@ QOBJS=qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ qscriptgrammar.o qscriptlexer.o qscriptclassdata.o \ qscriptparser.o qscriptprettypretty.o qscriptsyntaxchecker.o \ qscriptvalue.o qscriptvalueimpl.o qscriptvalueiterator.o \ - qscriptvalueiteratorimpl.o \ + qscriptvalueiteratorimpl.o qxmlstream.o qxmlutils.o \ qscriptclass.o qscriptclasspropertyiterator.o \ qscriptengineagent.o qscriptcontextinfo.o qscriptstring.o \ $(QTOBJS) @@ -44,6 +45,8 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge generators/mac/pbuilder_pbx.cpp generators/mac/xmloutput.cpp generators/metamakefile.cpp \ generators/makefiledeps.cpp option.cpp generators/win32/mingw_make.cpp generators/makefile.cpp \ generators/win32/msvc_objectmodel.cpp generators/win32/msvc_nmake.cpp generators/win32/borland_bmake.cpp \ + generators/symbian/symmake.cpp generators/symbian/initprojectdeploy_symbian.cpp \ + generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \ $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp \ @@ -83,16 +86,18 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/src/script/qscriptsyntaxchecker.cpp $(SOURCE_PATH)/src/script/qscriptvalueimpl.cpp \ $(SOURCE_PATH)/src/script/qscriptvalue.cpp $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp \ $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp \ + $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp \ + $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp \ $(SOURCE_PATH)/src/script/qscriptclass.cpp $(SOURCE_PATH)/src/script/qscriptclasspropertyiterator.cpp \ $(SOURCE_PATH)/src/script/qscriptengineagent.cpp $(SOURCE_PATH)/src/script/qscriptcontextinfo.cpp \ $(SOURCE_PATH)/src/script/qscriptstring.cpp \ $(QTSRCS) -CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac \ +CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ - -I$(SOURCE_PATH)/src/script -DQT_NO_PCRE \ - -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \ + -I$(SOURCE_PATH)/src/script -I$(BUILD_PATH)/src/corelib/xml \ + -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL \ -DQT_NO_COMPRESS -I$(QMAKESPEC) -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT \ -DQT_NO_GEOM_VARIANT $(OPENSOURCE_CXXFLAGS) @@ -292,6 +297,18 @@ pbuilder_pbx.o: generators/mac/pbuilder_pbx.cpp msvc_dsp.o: generators/win32/msvc_dsp.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/win32/msvc_dsp.cpp +symmake.o: generators/symbian/symmake.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/symmake.cpp + +symmake_abld.o: generators/symbian/symmake_abld.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/symmake_abld.cpp + +symmake_sbsv2.o: generators/symbian/symmake_sbsv2.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/symmake_sbsv2.cpp + +initprojectdeploy_symbian.o: generators/symbian/initprojectdeploy_symbian.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp + projectgenerator.o: generators/projectgenerator.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp @@ -394,6 +411,12 @@ qscriptvalueiterator.o: $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp qscriptvalueiteratorimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp +qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + +qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp + qscriptclass.o: $(SOURCE_PATH)/src/script/qscriptclass.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptclass.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 53130aa..54c2872 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -28,11 +28,12 @@ CFLAGS = /Zc:wchar_t- CFLAGS = -c -Fo$@ \ -W3 -nologo -O2 \ - -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac \ + -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian \ -I$(BUILD_PATH)\include -I$(BUILD_PATH)\include\QtCore \ -I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ -I$(BUILD_PATH)\include\QtScript \ + -I$(BUILD_PATH)\src\corelib\xml \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL \ -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \ @@ -54,7 +55,7 @@ BCB = $(MAKEDIR)\.. CXX = bcc32 CFLAGS = -c -o$@ \ -tWR -w -w-hid -w-use -O1 \ - -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac \ + -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian \ -I$(BUILD_PATH)\include -I$(BUILD_PATH)\include\QtCore \ -I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ @@ -74,7 +75,8 @@ OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw option.obj winmakefile.obj projectgenerator.obj property.obj meta.obj \ makefiledeps.obj metamakefile.obj xmloutput.obj pbuilder_pbx.obj \ borland_bmake.obj msvc_nmake.obj msvc_dsp.obj msvc_vcproj.obj \ - msvc_objectmodel.obj + msvc_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \ + symmake_abld.obj symmake_sbsv2.obj !IFDEF QMAKE_OPENSOURCE_EDITION CFLAGS = $(CFLAGS) -DQMAKE_OPENSOURCE_EDITION @@ -158,7 +160,9 @@ QTOBJS= \ qscriptvalue.obj \ qscriptvalueimpl.obj \ qscriptvalueiterator.obj \ - qscriptvalueiteratorimpl.obj + qscriptvalueiteratorimpl.obj \ + qxmlstream.obj \ + qxmlutils.obj first all: qmake.exe @@ -225,6 +229,10 @@ clean:: -del msvc_dsp.obj -del msvc_vcproj.obj -del msvc_objectmodel.obj + -del symmake.obj + -del symmake_abld.obj + -del symmake_sbsv2.obj + -del initprojectdeploy_symbian.obj -del pbuilder_pbx.obj -del qnumeric.obj \ -del qscriptasm.obj \ @@ -265,6 +273,8 @@ clean:: -del qscriptvalueimpl.obj \ -del qscriptvalueiterator.obj \ -del qscriptvalueiteratorimpl.obj + -del qxmlstream.obj + -del qxmlutils.obj -del vc60.pdb -del vc70.pdb -del qmake.pdb @@ -444,8 +454,21 @@ msvc_vcproj.obj: $(SOURCE_PATH)/qmake/generators/win32/msvc_vcproj.cpp msvc_objectmodel.obj: $(SOURCE_PATH)/qmake/generators/win32/msvc_objectmodel.cpp $(CXX) $(CXXFLAGS) generators/win32/msvc_objectmodel.cpp +symmake.obj: $(SOURCE_PATH)/qmake/generators/symbian/symmake.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake.cpp + +symmake_abld.obj: $(SOURCE_PATH)/qmake/generators/symbian/symmake_abld.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_abld.cpp + +symmake_sbsv2.obj: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_sbsv2.cpp + +initprojectdeploy_symbian.obj: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp + $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp + md5.obj: $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\3rdparty\md5\md5.cpp + project.obj: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp @@ -589,3 +612,9 @@ qscriptvalueiterator.obj: $(SOURCE_PATH)\src\script\qscriptvalueiterator.cpp qscriptvalueiteratorimpl.obj: $(SOURCE_PATH)\src\script\qscriptvalueiteratorimpl.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptvalueiteratorimpl.cpp + +qxmlstream.obj: $(SOURCE_PATH)\src\corelib\xml\qxmlstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\xml\qxmlstream.cpp + +qxmlutils.obj: $(SOURCE_PATH)\src\corelib\xml\qxmlutils.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\xml\qxmlutils.cpp diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 229a456..dd65145 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -15,14 +15,17 @@ CXX = g++ CFLAGS = -c -o$@ -O \ -I. -Igenerators -Igenerators/unix \ -Igenerators/win32 -Igenerators/mac \ + -Igenerators/symbian \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ -I$(BUILD_PATH)/include/QtScript \ + -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ - -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM + -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ + -DQT_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) LFLAGS = LIBS = -lole32 -luuid @@ -35,7 +38,8 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ option.o winmakefile.o projectgenerator.o property.o meta.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \ - msvc_objectmodel.o + msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ + symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION CFLAGS += -DQMAKE_OPENSOURCE_EDITION @@ -119,7 +123,9 @@ QTOBJS= \ qscriptvalue.o \ qscriptvalueimpl.o \ qscriptvalueiterator.o \ - qscriptvalueiteratorimpl.o + qscriptvalueiteratorimpl.o \ + qxmlstream.o \ + qxmlutils.o qmake.exe: $(OBJS) $(QTOBJS) @@ -294,6 +300,18 @@ msvc_vcproj.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_vcproj.cpp msvc_objectmodel.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_objectmodel.cpp $(CXX) $(CXXFLAGS) generators/win32/msvc_objectmodel.cpp +symmake.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake.cpp + +symmake_abld.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_abld.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_abld.cpp + +symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_sbsv2.cpp + +initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp + $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp @@ -437,3 +455,9 @@ qscriptvalueiterator.o: $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp qscriptvalueiteratorimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp + +qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + +qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index 3f1b1df..646815b 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -15,14 +15,17 @@ CXX = g++ CFLAGS = -c -o$@ -O \ -I. -Igenerators -Igenerators/unix \ -Igenerators/win32 -Igenerators/mac \ + -Igenerators/symbian \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ -I$(BUILD_PATH)/include/QtScript \ + -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/mkspecs/win32-g++ \ -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP \ - -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM + -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ + -DQT_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) LFLAGS = LIBS = -lole32 -luuid @@ -35,7 +38,8 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ option.o winmakefile.o projectgenerator.o property.o meta.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \ - msvc_objectmodel.o + msvc_objectmodel.o symmake.o initprojectdeploy_symbian.o \ + symmake_abld.o symmake_sbsv2.o ifdef QMAKE_OPENSOURCE_EDITION CFLAGS += -DQMAKE_OPENSOURCE_EDITION @@ -119,7 +123,9 @@ QTOBJS= \ qscriptvalue.o \ qscriptvalueimpl.o \ qscriptvalueiterator.o \ - qscriptvalueiteratorimpl.o + qscriptvalueiteratorimpl.o \ + qxmlstream.o \ + qxmlutils.o qmake.exe: $(OBJS) $(QTOBJS) $(LINKQMAKE) @@ -293,6 +299,18 @@ msvc_vcproj.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_vcproj.cpp msvc_objectmodel.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_objectmodel.cpp $(CXX) $(CXXFLAGS) generators/win32/msvc_objectmodel.cpp +symmake.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake.cpp + +symmake_abld.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_abld.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_abld.cpp + +symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_sbsv2.cpp + +initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp + $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp @@ -436,3 +454,9 @@ qscriptvalueiterator.o: $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp qscriptvalueiteratorimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp + +qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + +qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp diff --git a/qmake/Makefile.win32-mwc b/qmake/Makefile.win32-mwc new file mode 100644 index 0000000..08b6c49 --- /dev/null +++ b/qmake/Makefile.win32-mwc @@ -0,0 +1,469 @@ +ifeq "$(SOURCE_PATH)" "" +SOURCE_PATH = .. +endif + +# cmd version + +ifeq "$(BUILD_PATH)" "" +BUILD_PATH = .. +endif + + +# specific stuff for Metroworks compiler + +CXX = mwccsym2 +CFLAGS = -gccinc \ + -w on -w nonotused -w nonotinlined -w noimplicit -w nopadding -w noemptydecl \ + -w nounusedexpr -w nopossible -c -o $@ -O \ + -I. -Igenerators -Igenerators\unix \ + -Igenerators\win32 -Igenerators\mac \ + -Igenerators\symbian \ + -I$(BUILD_PATH)\include -I$(BUILD_PATH)\include\QtCore \ + -I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \ + -I$(BUILD_PATH)\src\corelib\global \ + -I$(SOURCE_PATH)\mkspecs\win32-mwc \ + -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PCRE \ + -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DHAVE_QCONFIG_CPP \ + -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \ + -DQT_NO_LIBRARY -I$(BUILD_PATH)\include\QtScript \ + -I$(SOURCE_PATH)\corelib\xml -DQT_BOOTSTRAPPED + +CXXFLAGS = $(CFLAGS) +LFLAGS = -heapcommit 1024 -heapreserve 102400 +LIBS = -ladvapi32.lib +LINKQMAKE = mwccsym2 $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS) +ADDCLEAN = + + +# qmake code +OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ + option.o winmakefile.o projectgenerator.o property.o meta.o \ + makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ + borland_bmake.o msvc_nmake.o msvc_dsp.o msvc_vcproj.o \ + msvc_objectmodel.o initprojectdeploy_symbian.o qpopen.o \ + symmake.o symmake_abld.o symmake_sbsv2.o + +ifdef QMAKE_OPENSOURCE_EDITION +CFLAGS += -DQMAKE_OPENSOURCE_EDITION +endif + +# qt code +QTOBJS= \ + qbitarray.o \ + qbuffer.o \ + qbytearray.o \ + qcryptographichash.o \ + qvsnprintf.o \ + qbytearraymatcher.o \ + qconfig.o \ + qdatetime.o \ + qdir.o \ + qdiriterator.o \ + qfile.o \ + qtemporaryfile.o \ + qfileinfo.o \ + qabstractfileengine.o \ + qfsfileengine.o \ + qfsfileengine_iterator.o \ + qfsfileengine_win.o \ + qfsfileengine_iterator_win.o \ + qglobal.o \ + qhash.o \ + qiodevice.o \ + qlibraryinfo.o \ + qlistdata.o \ + qlinkedlist.o \ + qlocale.o \ + qmalloc.o \ + qmap.o \ + qregexp.o \ + qstring.o \ + qstringlist.o \ + qtextstream.o \ + quuid.o \ + qvector.o \ + qurl.o \ + qsettings.o \ + qsettings_win.o \ + qvariant.o \ + qmetatype.o \ + qnumeric.o \ + qscriptasm.o \ + qscriptast.o \ + qscriptastvisitor.o \ + qscriptcompiler.o \ + qscriptecmaarray.o \ + qscriptecmaboolean.o \ + qscriptecmacore.o \ + qscriptecmadate.o \ + qscriptecmafunction.o \ + qscriptecmaglobal.o \ + qscriptecmamath.o \ + qscriptecmanumber.o \ + qscriptecmaobject.o \ + qscriptecmaregexp.o \ + qscriptecmastring.o \ + qscriptecmaerror.o \ + qscriptcontext_p.o \ + qscriptengine.o \ + qscriptengine_p.o \ + qscriptengineagent.o \ + qscriptextenumeration.o \ + qscriptextvariant.o \ + qscriptcontext.o \ + qscriptcontextinfo.o \ + qscriptfunction.o \ + qscriptgrammar.o \ + qscriptlexer.o \ + qscriptclassdata.o \ + qscriptparser.o \ + qscriptprettypretty.o \ + qscriptsyntaxchecker.o \ + qscriptclass.o \ + qscriptclasspropertyiterator.o \ + qscriptstring.o \ + qscriptvalue.o \ + qscriptvalueimpl.o \ + qscriptvalueiterator.o \ + qscriptvalueiteratorimpl.o \ + qxmlstream.o \ + qxmlutils.o + + +qmake.exe: $(OBJS) $(QTOBJS) + $(LINKQMAKE) + -copy qmake.exe $(BUILD_PATH)\bin\qmake.exe + +Makefile: Makefile.win32-mwc + @echo "Out of date, please rerun configure" + +clean:: + -del $(OBJS) $(QTOBJS) $(ADDCLEAN) + +distclean:: clean + -del qmake.exe + -del $(BUILD_PATH)\bin\qmake.exe + +.c.o: + $(CXX) $(CFLAGS) $< + +.cpp.o: + $(CXX) $(CXXFLAGS) $< + +qconfig.o: $(BUILD_PATH)/src/corelib/global/qconfig.cpp + $(CXX) $(CXXFLAGS) $(BUILD_PATH)/src/corelib/global/qconfig.cpp + +qsettings_win.o: $(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp + +qsettings.o: $(SOURCE_PATH)/src/corelib/io/qsettings.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qsettings.cpp + +qvariant.o: $(SOURCE_PATH)/src/corelib/kernel/qvariant.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qvariant.cpp + +qurl.o: $(SOURCE_PATH)/src/corelib/io/qurl.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qurl.cpp + +qtextstream.o: $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp + +qdatastream.o: $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp + +qiodevice.o: $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp + +qlibraryinfo.o: $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp + +qnumeric.o: $(SOURCE_PATH)/src/corelib/global/qnumeric.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qnumeric.cpp + +qmalloc.o: $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp + +qglobal.o: $(SOURCE_PATH)/src/corelib/global/qglobal.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qglobal.cpp + +qhash.o: $(SOURCE_PATH)/src/corelib/tools/qhash.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qhash.cpp + +qbytearray.o: $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp + +qcryptographichash.o: $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp + +qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp + +qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp + +qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp + +qlocale.o: $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp + +quuid.o: $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp + +qbuffer.o: $(SOURCE_PATH)/src/corelib/io/qbuffer.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qbuffer.cpp + +qlistdata.o: $(SOURCE_PATH)/src/corelib/tools/qlistdata.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlistdata.cpp + +qlinkedlist.o: $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp + +qfile.o: $(SOURCE_PATH)/src/corelib/io/qfile.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfile.cpp + +qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp + +qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp + +qfsfileengine_win.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_win.cpp + +qfsfileengine_iterator_win.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_win.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_win.cpp + +qfsfileengine.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp + +qfsfileengine_iterator.o: $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp + +qtextcodec.o: $(SOURCE_PATH)/src/codecs/qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/codecs/qtextcodec.cpp + +qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp + +qvector.o: $(SOURCE_PATH)/src/corelib/tools/qvector.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qvector.cpp + +qbitarray.o: $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp + +qdir.o: $(SOURCE_PATH)/src/corelib/io/qdir.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qdir.cpp + +qdiriterator.o: $(SOURCE_PATH)/src/corelib/io/qdiriterator.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qdiriterator.cpp + +qmetatype.o: $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp + +qfileinfo.o: $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp + +qdatetime.o: $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp + +qstringlist.o: $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp + +qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qmap.cpp + +makefile.o: $(SOURCE_PATH)/qmake/generators/makefile.cpp + $(CXX) $(CXXFLAGS) generators/makefile.cpp + +unixmake.o: $(SOURCE_PATH)/qmake/generators/unix/unixmake.cpp + $(CXX) $(CXXFLAGS) generators/unix/unixmake.cpp + +unixmake2.o: $(SOURCE_PATH)/qmake/generators/unix/unixmake2.cpp + $(CXX) $(CXXFLAGS) generators/unix/unixmake2.cpp + +winmakefile.o: $(SOURCE_PATH)/qmake/generators/win32/winmakefile.cpp + $(CXX) $(CXXFLAGS) generators/win32/winmakefile.cpp + +borland_bmake.o: $(SOURCE_PATH)/qmake/generators/win32/borland_bmake.cpp + $(CXX) $(CXXFLAGS) generators/win32/borland_bmake.cpp + +mingw_make.o: $(SOURCE_PATH)/qmake/generators/win32/mingw_make.cpp + $(CXX) $(CXXFLAGS) generators/win32/mingw_make.cpp + +msvc_nmake.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_nmake.cpp + $(CXX) $(CXXFLAGS) generators/win32/msvc_nmake.cpp + +msvc_dsp.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_dsp.cpp + $(CXX) $(CXXFLAGS) generators/win32/msvc_dsp.cpp + +msvc_vcproj.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_vcproj.cpp + $(CXX) $(CXXFLAGS) generators/win32/msvc_vcproj.cpp + +msvc_objectmodel.o: $(SOURCE_PATH)/qmake/generators/win32/msvc_objectmodel.cpp + $(CXX) $(CXXFLAGS) generators/win32/msvc_objectmodel.cpp + +symmake.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake.cpp + +symmake_abld.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_abld.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_abld.cpp + +symmake_sbsv2.o: $(SOURCE_PATH)/qmake/generators/symbian/symmake_sbsv2.cpp + $(CXX) $(CXXFLAGS) generators/symbian/symmake_sbsv2.cpp + +initprojectdeploy_symbian.o: $(SOURCE_PATH)/qmake/generators/symbian/initprojectdeploy_symbian.cpp + $(CXX) $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp + +qpopen.o: $(SOURCE_PATH)/qmake/qpopen.cpp $(SOURCE_PATH)/qmake/qpopen.h + $(CXX) $(CXXFLAGS) qpopen.cpp + +project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h + $(CXX) $(CXXFLAGS) project.cpp + +meta.o: $(SOURCE_PATH)/qmake/meta.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h + $(CXX) $(CXXFLAGS) meta.cpp + +main.o: $(SOURCE_PATH)/qmake/main.cpp $(SOURCE_PATH)/qmake/project.h + $(CXX) $(CXXFLAGS) main.cpp + +option.o: $(SOURCE_PATH)/qmake/option.cpp $(SOURCE_PATH)/qmake/option.h + $(CXX) $(CXXFLAGS) option.cpp + +property.o: $(SOURCE_PATH)/qmake/property.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h + $(CXX) $(CXXFLAGS) property.cpp + +projectgenerator.o: $(SOURCE_PATH)/qmake/generators/projectgenerator.cpp + $(CXX) $(CXXFLAGS) generators/projectgenerator.cpp + +pbuilder_pbx.o: $(SOURCE_PATH)/qmake/generators/mac/pbuilder_pbx.cpp + $(CXX) $(CXXFLAGS) generators/mac/pbuilder_pbx.cpp + +makefiledeps.o: $(SOURCE_PATH)/qmake/generators/makefiledeps.cpp + $(CXX) $(CXXFLAGS) generators/makefiledeps.cpp + +metamakefile.o: $(SOURCE_PATH)/qmake/generators/metamakefile.cpp + $(CXX) $(CXXFLAGS) generators/metamakefile.cpp + +xmloutput.o: $(SOURCE_PATH)/qmake/generators/xmloutput.cpp + $(CXX) $(CXXFLAGS) generators/xmloutput.cpp + +qscriptasm.o: $(SOURCE_PATH)\src\script\qscriptasm.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptasm.cpp + +qscriptast.o: $(SOURCE_PATH)\src\script\qscriptast.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptast.cpp + +qscriptastvisitor.o: $(SOURCE_PATH)\src\script\qscriptastvisitor.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptastvisitor.cpp + +qscriptcompiler.o: $(SOURCE_PATH)\src\script\qscriptcompiler.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptcompiler.cpp + +qscriptecmaarray.o: $(SOURCE_PATH)\src\script\qscriptecmaarray.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmaarray.cpp + +qscriptecmaboolean.o: $(SOURCE_PATH)/src/script/qscriptecmaboolean.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaboolean.cpp + +qscriptecmacore.o: $(SOURCE_PATH)/src/script/qscriptecmacore.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmacore.cpp + +qscriptecmadate.o: $(SOURCE_PATH)/src/script/qscriptecmadate.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmadate.cpp + +qscriptecmafunction.o: $(SOURCE_PATH)/src/script/qscriptecmafunction.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmafunction.cpp + +qscriptecmaglobal.o: $(SOURCE_PATH)/src/script/qscriptecmaglobal.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaglobal.cpp + +qscriptecmamath.o: $(SOURCE_PATH)/src/script/qscriptecmamath.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmamath.cpp + +qscriptecmanumber.o: $(SOURCE_PATH)/src/script/qscriptecmanumber.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmanumber.cpp + +qscriptecmaobject.o: $(SOURCE_PATH)/src/script/qscriptecmaobject.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaobject.cpp + +qscriptecmaregexp.o: $(SOURCE_PATH)/src/script/qscriptecmaregexp.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaregexp.cpp + +qscriptecmastring.o: $(SOURCE_PATH)/src/script/qscriptecmastring.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmastring.cpp + +qscriptecmaerror.o: $(SOURCE_PATH)/src/script/qscriptecmaerror.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaerror.cpp + +qscriptcontext_p.o: $(SOURCE_PATH)/src/script/qscriptcontext_p.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptcontext_p.cpp + +qscriptengine.o: $(SOURCE_PATH)/src/script/qscriptengine.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptengine.cpp + +qscriptengine_p.o: $(SOURCE_PATH)/src/script/qscriptengine_p.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptengine_p.cpp + +qscriptengineagent.o: $(SOURCE_PATH)/src/script/qscriptengineagent.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptengineagent.cpp + +qscriptextenumeration.o: $(SOURCE_PATH)/src/script/qscriptextenumeration.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptextenumeration.cpp + +qscriptextvariant.o: $(SOURCE_PATH)/src/script/qscriptextvariant.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptextvariant.cpp + +qscriptcontext.o: $(SOURCE_PATH)/src/script/qscriptcontext.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptcontext.cpp + +qscriptcontextinfo.o: $(SOURCE_PATH)/src/script/qscriptcontextinfo.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptcontextinfo.cpp + +qscriptfunction.o: $(SOURCE_PATH)/src/script/qscriptfunction.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptfunction.cpp + +qscriptgrammar.o: $(SOURCE_PATH)/src/script/qscriptgrammar.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptgrammar.cpp + +qscriptlexer.o: $(SOURCE_PATH)/src/script/qscriptlexer.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptlexer.cpp + +qscriptclassdata.o: $(SOURCE_PATH)/src/script/qscriptclassdata.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptclassdata.cpp + +qscriptparser.o: $(SOURCE_PATH)/src/script/qscriptparser.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptparser.cpp + +qscriptprettypretty.o: $(SOURCE_PATH)/src/script/qscriptprettypretty.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptprettypretty.cpp + +qscriptsyntaxchecker.o: $(SOURCE_PATH)/src/script/qscriptsyntaxchecker.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptsyntaxchecker.cpp + +qscriptclass.o: $(SOURCE_PATH)/src/script/qscriptclass.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptclass.cpp + +qscriptclasspropertyiterator.o: $(SOURCE_PATH)/src/script/qscriptclasspropertyiterator.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptclasspropertyiterator.cpp + +qscriptstring.o: $(SOURCE_PATH)/src/script/qscriptstring.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptstring.cpp + +qscriptvalue.o: $(SOURCE_PATH)/src/script/qscriptvalue.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalue.cpp + +qscriptvalueimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueimpl.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueimpl.cpp + +qscriptvalueiterator.o: $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp + +qscriptvalueiteratorimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp + +qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + +qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index d6bb652..5eaa39f 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -275,10 +275,12 @@ MakefileGenerator::initOutPaths() int slash = path.lastIndexOf(Option::dir_sep); if(slash != -1) { path = path.left(slash); - if(path != "." && - !mkdir(fileFixify(path, qmake_getpwd(), Option::output_dir))) - warn_msg(WarnLogic, "%s: Cannot access directory '%s'", - (*it).toLatin1().constData(), path.toLatin1().constData()); + // Make out path only if it does not contains makefile variables + if(!path.contains("${")) + if(path != "." && + !mkdir(fileFixify(path, qmake_getpwd(), Option::output_dir))) + warn_msg(WarnLogic, "%s: Cannot access directory '%s'", + (*it).toLatin1().constData(), path.toLatin1().constData()); } } } @@ -1579,8 +1581,11 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_ if(project->values(comp + ".CONFIG").indexOf("moc_verify") != -1) { if(!file.isNull()) { QMakeSourceFileInfo::addSourceFile(file, QMakeSourceFileInfo::SEEK_MOCS); - if(!mocable(file)) + if(!mocable(file)) { return false; + } else { + project->values("MOCABLES").append(file); + } } } else if(project->values(comp + ".CONFIG").indexOf("function_verify") != -1) { QString tmp_out = project->values(comp + ".output").first(); @@ -1697,6 +1702,10 @@ MakefileGenerator::writeExtraTargets(QTextStream &t) if(!cmd.isEmpty()) t << "\n\t" << cmd; t << endl << endl; + + project->values(QLatin1String("QMAKE_ET_PARSED_TARGETS.") + (*it)) << escapeDependencyPath(targ); + project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(targ)) << deps.split(" ", QString::SkipEmptyParts); + project->values(QLatin1String("QMAKE_ET_PARSED_CMD.") + (*it) + escapeDependencyPath(targ)) << cmd; } } @@ -1784,6 +1793,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) tmp_clean = tmp_out; if(tmp_clean.indexOf("${QMAKE_") == -1) { t << "\n\t" << "-$(DEL_FILE) " << tmp_clean; + if (isForSymbian()) + t << " 2> NUL"; // Eliminate unnecessary warnings wrote_clean = true; } if(!wrote_clean_cmds || !wrote_clean) { @@ -1812,7 +1823,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } } if(!cleans.isEmpty()) - t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, ""); + if (isForSymbian()) + t << valGlue(cleans, "\n\t" + del_statement, " 2> NUL\n\t" + del_statement, " 2> NUL"); + else + t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, ""); if(!wrote_clean_cmds) { for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, (*input), @@ -1839,6 +1853,17 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), tmp_out); dep_cmd = fixEnvVariables(dep_cmd); +#if defined(Q_CC_MWERKS) && defined(Q_OS_WIN32) + QPopen procPipe; + if (procPipe.init(dep_cmd.toLatin1().constData(), "r")) { + QString indeps; + while(true) { + int read_in = procPipe.fread(buff, 255); + if(!read_in) + break; + indeps += QByteArray(buff, read_in); + } +#else if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1848,6 +1873,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) indeps += QByteArray(buff, read_in); } QT_PCLOSE(proc); +#endif if(!indeps.isEmpty()) { QStringList dep_cmd_deps = indeps.replace('\n', ' ').simplified().split(' '); for(int i = 0; i < dep_cmd_deps.count(); ++i) { @@ -1887,15 +1913,28 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) if (inputs.isEmpty()) continue; - QString cmd = replaceExtraCompilerVariables(tmp_cmd, escapeFilePaths(inputs), QStringList(tmp_out)); + QString cmd; + if (isForSymbianSbsv2()) { + // In sbsv2 the command inputs and outputs need to use absolute paths + cmd = replaceExtraCompilerVariables(tmp_cmd, + fileFixify(escapeFilePaths(inputs), FileFixifyAbsolute), + fileFixify(QStringList(tmp_out), FileFixifyAbsolute)); + } else { + cmd = replaceExtraCompilerVariables(tmp_cmd, escapeFilePaths(inputs), QStringList(tmp_out)); + } + t << escapeDependencyPath(tmp_out) << ":"; + project->values(QLatin1String("QMAKE_ET_PARSED_TARGETS.") + (*it)) << escapeDependencyPath(tmp_out); // compiler.CONFIG+=explicit_dependencies means that ONLY compiler.depends gets to cause Makefile dependencies if(project->values((*it) + ".CONFIG").indexOf("explicit_dependencies") != -1) { t << " " << valList(escapeDependencyPaths(fileFixify(tmp_dep, Option::output_dir, Option::output_dir))); + project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(tmp_out)) << tmp_dep; } else { t << " " << valList(escapeDependencyPaths(inputs)) << " " << valList(escapeDependencyPaths(deps)); + project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(tmp_out)) << inputs << deps; } t << "\n\t" << cmd << endl << endl; + project->values(QLatin1String("QMAKE_ET_PARSED_CMD.") + (*it) + escapeDependencyPath(tmp_out)) << cmd; continue; } for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { @@ -1910,12 +1949,31 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } QString cmd = replaceExtraCompilerVariables(tmp_cmd, (*input), out); // NOTE: The var -> QMAKE_COMP_var replace feature is unsupported, do not use! + if (isForSymbianSbsv2()) { + // In sbsv2 the command inputs and outputs need to use absolute paths + cmd = replaceExtraCompilerVariables(tmp_cmd, + fileFixify((*input), FileFixifyAbsolute), + fileFixify(out, FileFixifyAbsolute)); + } else { + cmd = replaceExtraCompilerVariables(tmp_cmd, (*input), out); + } for(QStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3) cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); if(!tmp_dep_cmd.isEmpty() && doDepends()) { char buff[256]; QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), out); dep_cmd = fixEnvVariables(dep_cmd); +#if defined(Q_CC_MWERKS) && defined(Q_OS_WIN32) + QPopen procPipe; + if (procPipe.init(dep_cmd.toLatin1().constData(), "r")) { + QString indeps; + while(true) { + int read_in = procPipe.fread(buff, 255); + if(!read_in) + break; + indeps += QByteArray(buff, read_in); + } +#else if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1925,6 +1983,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) indeps += QByteArray(buff, read_in); } QT_PCLOSE(proc); +#endif if(!indeps.isEmpty()) { QStringList dep_cmd_deps = indeps.replace('\n', ' ').simplified().split(' '); for(int i = 0; i < dep_cmd_deps.count(); ++i) { @@ -1999,6 +2058,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } t << escapeDependencyPath(out) << ": " << valList(escapeDependencyPaths(deps)) << "\n\t" << cmd << endl << endl; + project->values(QLatin1String("QMAKE_ET_PARSED_TARGETS.") + (*it)) << escapeDependencyPath(out); + project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(out)) << deps; + project->values(QLatin1String("QMAKE_ET_PARSED_CMD.") + (*it) + escapeDependencyPath(out)) << cmd; } } t << "compiler_clean: " << clean_targets << endl << endl; @@ -2172,8 +2234,8 @@ MakefileGenerator::writeHeader(QTextStream &t) t << endl; } -void -MakefileGenerator::writeSubDirs(QTextStream &t) +QList<MakefileGenerator::SubTarget*> +MakefileGenerator::findSubDirsSubTargets() const { QList<SubTarget*> targets; { @@ -2270,6 +2332,13 @@ MakefileGenerator::writeSubDirs(QTextStream &t) } } } + return targets; +} + +void +MakefileGenerator::writeSubDirs(QTextStream &t) +{ + QList<SubTarget*> targets = findSubDirsSubTargets(); t << "first: make_default" << endl; int flags = SubTargetInstalls; if(project->isActiveConfig("ordered")) @@ -2286,39 +2355,43 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT for(QStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) t << "include " << (*qeui_it) << endl; - QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); - if(ofile.lastIndexOf(Option::dir_sep) != -1) - ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); - t << "MAKEFILE = " << ofile << endl; - /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires - * back-slashes to be turned into slashes. */ - t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "COPY = " << var("QMAKE_COPY") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; - t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; - t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; - t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; + if (!(flags & SubTargetSkipDefaultVariables)) { + QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); + if(ofile.lastIndexOf(Option::dir_sep) != -1) + ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); + t << "MAKEFILE = " << ofile << endl; + /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires + * back-slashes to be turned into slashes. */ + t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << endl; + t << "COPY = " << var("QMAKE_COPY") << endl; + t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; + t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; + t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; + t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; + t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; + t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "MOVE = " << var("QMAKE_MOVE") << endl; + t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << endl; + t << "SUBTARGETS = "; // subtargets are sub-directory + for(int target = 0; target < targets.size(); ++target) + t << " \\\n\t\t" << targets.at(target)->target; + t << endl << endl; + } writeExtraVariables(t); - t << "SUBTARGETS = "; // subtargets are sub-directory - for(int target = 0; target < targets.size(); ++target) - t << " \\\n\t\t" << targets.at(target)->target; - t << endl << endl; QStringList targetSuffixes; const QString abs_source_path = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); - targetSuffixes << "make_default" << "make_first" << "all" << "clean" << "distclean" - << QString((flags & SubTargetInstalls) ? "install_subtargets" : "install") - << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall"); + if (!(flags & SubTargetSkipDefaultTargets)) { + targetSuffixes << "make_default" << "make_first" << "all" << "clean" << "distclean" + << QString((flags & SubTargetInstalls) ? "install_subtargets" : "install") + << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall"); + } // generate target rules for(int target = 0; target < targets.size(); ++target) { @@ -2438,23 +2511,25 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT } t << endl; - if(project->values("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1) - project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all"); + if (!(flags & SubTargetSkipDefaultTargets)) { + if(project->values("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1) + project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all"); - writeMakeQmake(t); + writeMakeQmake(t); - t << "qmake_all:"; - if(!targets.isEmpty()) { - for(QList<SubTarget*>::Iterator it = targets.begin(); it != targets.end(); ++it) { - if(!(*it)->profile.isEmpty()) - t << " " << (*it)->target << "-" << "qmake_all"; + t << "qmake_all:"; + if(!targets.isEmpty()) { + for(QList<SubTarget*>::Iterator it = targets.begin(); it != targets.end(); ++it) { + if(!(*it)->profile.isEmpty()) + t << " " << (*it)->target << "-" << "qmake_all"; + } } + if(project->isEmpty("QMAKE_NOFORCE")) + t << " FORCE"; + if(project->isActiveConfig("no_empty_targets")) + t << "\n\t" << "@cd ."; + t << endl << endl; } - if(project->isEmpty("QMAKE_NOFORCE")) - t << " FORCE"; - if(project->isActiveConfig("no_empty_targets")) - t << "\n\t" << "@cd ."; - t << endl << endl; for(int s = 0; s < targetSuffixes.size(); ++s) { QString suffix = targetSuffixes.at(s); diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 79a7031..6c212d7 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -53,8 +53,12 @@ QT_BEGIN_NAMESPACE #ifdef Q_OS_WIN32 +#if defined(Q_CC_MWERKS) +#include "qpopen.h" +#else #define QT_POPEN _popen #define QT_PCLOSE _pclose +#endif #else #define QT_POPEN popen #define QT_PCLOSE pclose @@ -84,6 +88,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo QString build_args(const QString &outdir=QString()); void checkMultipleDefinition(const QString &, const QString &); +protected: //internal caches mutable QHash<QString, QMakeLocalFileName> depHeuristicsCache; mutable QHash<QString, QStringList> dependsCache; @@ -116,9 +121,12 @@ protected: enum SubTargetFlags { SubTargetInstalls=0x01, SubTargetOrdered=0x02, + SubTargetSkipDefaultVariables=0x04, + SubTargetSkipDefaultTargets=0x08, SubTargetsNoFlags=0x00 }; + QList<MakefileGenerator::SubTarget*> findSubDirsSubTargets() const; void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags); //extra compiler interface diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 7f4e914..63b0f17 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -263,8 +263,9 @@ MakefileGenerator class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator { +protected: + bool init_flag; -private: struct Subdir { Subdir() : makefile(0), indent(0) { } ~Subdir() { delete makefile; } @@ -375,6 +376,7 @@ SubdirsMetaMakefileGenerator::init() self->makefile = new BuildsMetaMakefileGenerator(project, name, false); self->makefile->init(); subs.append(self); + return true; } @@ -418,6 +420,306 @@ SubdirsMetaMakefileGenerator::~SubdirsMetaMakefileGenerator() subs.clear(); } +class SymbianSubdirsMetaMakefileGenerator : public SubdirsMetaMakefileGenerator { + +public: + SymbianSubdirsMetaMakefileGenerator(QMakeProject *p, const QString &n, bool op) : SubdirsMetaMakefileGenerator(p, n, op) { } + virtual ~SymbianSubdirsMetaMakefileGenerator(); + + virtual bool init(); + virtual bool write(const QString &); + +protected: + + static QMap<QString, QString> mmpPaths; + + static QMultiMap<QString, QString> mmpDependency; + + static QStringList getDependencyList(QString mmpFilename, int recursionDepth); + + static QStringList calculateRelativePaths(QString mmpParent, QStringList mmpChildren); + +private: + QString cleanFromSpecialCharacters(QString& str); + +}; + +QMap<QString, QString> SymbianSubdirsMetaMakefileGenerator::mmpPaths; + +QMultiMap<QString, QString> SymbianSubdirsMetaMakefileGenerator::mmpDependency; + +QStringList SymbianSubdirsMetaMakefileGenerator::getDependencyList(QString mmpFilename, int recursionDepth) { + + QStringList list; + + // printf("Entering recursion mmpFilename = %s and depth = %d \n", qPrintable(mmpFilename), recursionDepth); + + QList<QString> values = mmpDependency.values(mmpFilename); + if(recursionDepth < 0) { + // special case + // just first dependency level + list = values; + return list; + + } + if(values.size() == 0) { + + //reached recursion END condition + if(recursionDepth == 0) { + --recursionDepth; + return list; // empty list // no dependencies / return + } + else { + list.append(mmpFilename); + recursionDepth--; + return list; // leaf // return + } + } else { + recursionDepth++; + for (int i = 0; i < values.size(); ++i) { + QString current = values.at(i); + QStringList tailList = getDependencyList(current, recursionDepth); + for(int j = 0; j < tailList.size(); ++j) { + //QString path = mmpFilename + tailList.at(j); + QString path = tailList.at(j); + list.append(path); + //printf("MMPDEPENDENCY: %s\n", path.toAscii().data()); + }// for(int j = 0; j < values.size(); ++j) + //list.append(current); + } // for (int i = 0; i < values.size(); ++i) + + if(recursionDepth > 0) { + //for mmp somewhere in middle + list.append(mmpFilename); + } + recursionDepth--; + return list; + } + +} +SymbianSubdirsMetaMakefileGenerator::~SymbianSubdirsMetaMakefileGenerator() { } + +bool SymbianSubdirsMetaMakefileGenerator::write(const QString &oldpwd) { + return SubdirsMetaMakefileGenerator::write(oldpwd); +} + +QString SymbianSubdirsMetaMakefileGenerator::cleanFromSpecialCharacters(QString& str) { + QString tmp = str; + + tmp.replace(QString("/"), QString("_")); + tmp.replace(QString("\\"), QString("_")); + tmp.replace(QString("-"), QString("_")); + tmp.replace(QString(":"), QString("_")); + tmp.replace(QString("."), QString("_")); + + return tmp; +} + +bool SymbianSubdirsMetaMakefileGenerator::init() { + + if(init_flag) + return false; + + init_flag = true; + + /* + Not neccessary as it was + causing second pass through + subdir elements + + SubdirsMetaMakefileGenerator::init(); + */ + + /* + if we are here then we have template = subdirs + + so... go for it ... + */ + + Option::recursive = true; + + if(Option::recursive) { + QString old_output_dir = QDir::cleanPath(Option::output_dir); + if(!old_output_dir.endsWith('/')) + old_output_dir += '/'; + QString old_output = Option::output.fileName(); + QString oldpwd = QDir::cleanPath(qmake_getpwd()); + + if(!oldpwd.endsWith('/')) + oldpwd += '/'; + + // find the parent mmp filename + int end = oldpwd.size() - 1; + int start = oldpwd.lastIndexOf("/", end - 2); + QString parentMmpFilename = oldpwd.mid(start + 1, end - start - 1); + parentMmpFilename.prepend(oldpwd); + parentMmpFilename = parentMmpFilename.append(".mmp"); + + + const QStringList &subdirs = project->values("SUBDIRS"); + static int recurseDepth = -1; + ++recurseDepth; + for(int i = 0; i < subdirs.size(); ++i) { + Subdir *sub = new Subdir; + sub->indent = recurseDepth; + + QFileInfo subdir(subdirs.at(i)); + // childMmpFielname should be derived from subdirName + QString subdirName = subdirs.at(i); + if(!project->isEmpty(subdirs.at(i) + ".file")) + subdir = project->first(subdirs.at(i) + ".file"); + else if(!project->isEmpty(subdirs.at(i) + ".subdir")) + subdir = project->first(subdirs.at(i) + ".subdir"); + QString sub_name; + + QString childMmpFilename; + + if(subdir.isDir()) { + subdir = QFileInfo(subdir.filePath() + "/" + subdir.fileName() + Option::pro_ext); + childMmpFilename = subdir.fileName(); + // TODO: create Option::mmp_ext + childMmpFilename = subdir.absoluteFilePath(); + childMmpFilename.replace(Option::pro_ext, QString("")); + childMmpFilename.append(".mmp"); + } + else { + childMmpFilename = subdir.absoluteFilePath(); + childMmpFilename.replace(QString(".pro"), QString(".mmp")); + sub_name = childMmpFilename; + sub_name.replace(QString(".mmp"), QString("")); + sub_name.replace(0, sub_name.lastIndexOf("/") + 1, QString("")); + project->values("SHADOW_BLD_INFS").append(QString("bld.inf.") + sub_name); + } + + //handle sub project + QMakeProject *sub_proj = new QMakeProject(project->properties()); + for (int ind = 0; ind < sub->indent; ++ind) + printf(" "); + sub->input_dir = subdir.absolutePath(); + if(subdir.isRelative() && old_output_dir != oldpwd) { + sub->output_dir = old_output_dir + "/" + subdir.path(); + printf("Reading %s [%s]\n", subdir.absoluteFilePath().toLatin1().constData(), sub->output_dir.toLatin1().constData()); + } else { //what about shadow builds? + sub->output_dir = sub->input_dir; + printf("Reading %s\n", subdir.absoluteFilePath().toLatin1().constData()); + } + + // find the child mmp filename + qmake_setpwd(sub->input_dir); + + QString newpwd = qmake_getpwd(); + + Option::output_dir = sub->output_dir; + if(Option::output_dir.at(Option::output_dir.length()-1) != QLatin1Char('/')) + Option::output_dir += QLatin1Char('/'); + sub_proj->read(subdir.fileName()); + if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { + fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n", + subdir.fileName().toLatin1().constData(), + sub_proj->values("QMAKE_FAILED_REQUIREMENTS").join(" ").toLatin1().constData()); + delete sub; + delete sub_proj; + //continue; + } else { + // map mmpfile to its absolut filepath + mmpPaths.insert(childMmpFilename, newpwd); + + // update mmp files dependency map + mmpDependency.insert(parentMmpFilename, childMmpFilename); + + sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name); + if(0 && sub->makefile->type() == SUBDIRSMETATYPE) { + subs.append(sub); + } else { + const QString output_name = Option::output.fileName(); + Option::output.setFileName(sub->output_file); + sub->makefile->write(sub->output_dir); + delete sub; + qmakeClearCaches(); + sub = 0; + Option::output.setFileName(output_name); + } + } + + Option::output_dir = old_output_dir; + qmake_setpwd(oldpwd); + + } + --recurseDepth; + Option::output.setFileName(old_output); + Option::output_dir = old_output_dir; + qmake_setpwd(oldpwd); + } + + Subdir *self = new Subdir; + self->input_dir = qmake_getpwd(); + + // to fully expand find all dependencies + // do as recursion, then + // insert result + // as subdirs data in project + QString newpwd = qmake_getpwd(); + if(!newpwd.endsWith('/')) + newpwd += '/'; + int end = newpwd.size() - 1; + int start = newpwd.lastIndexOf("/", end - 2); + QString mmpFilename = newpwd.mid(start + 1, end - start - 1); + mmpFilename.prepend(newpwd); + mmpFilename = mmpFilename.append(".mmp"); + + // map mmpfile to its absolut filepath + mmpPaths.insert(mmpFilename, newpwd); + + QStringList directDependencyList = getDependencyList(mmpFilename, -1); + for(int i = 0; i < directDependencyList.size(); ++i) { + project->values("MMPFILES_DIRECT_DEPENDS").append(directDependencyList.at(i)); + } + + QStringList dependencyList = getDependencyList(mmpFilename, 0); +/* + printf("\n \n PRINTING DEPENDENCY FOR: %s \n", mmpFilename.toAscii().data()); + // print it for debug + for(int i = 0; i < dependencyList.size(); ++i) { + printf("FINAL MMP DEPENDENCIES: %s\n", dependencyList.at(i).toAscii().data()); + } + printf("\n \n"); + + printf("\n \n PRINTING DIRECT DEPENDENCY FOR: %s \n", mmpFilename.toAscii().data()); + // print it for debug + for(int i = 0; i < directDependencyList.size(); ++i) { + printf("DIRECT MMP DEPENDENCIES: %s\n", directDependencyList.at(i).toAscii().data()); + } + printf("\n \n"); +*/ + self->output_dir = Option::output_dir; + if(!Option::recursive || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir())) + self->output_file = Option::output.fileName(); + self->makefile = new BuildsMetaMakefileGenerator(project, name, false); + self->makefile->init(); + subs.append(self); + return true; +} + +QStringList SymbianSubdirsMetaMakefileGenerator::calculateRelativePaths(QString mmpParent, QStringList mmpChildren) { + QStringList mmpRelativePaths; + QString parentDir = mmpPaths.value(mmpParent); + QDir directory(parentDir); + for(int i = 0; i < mmpChildren.size(); ++i) { + QString childDir = mmpPaths.value(mmpChildren.at(i)); + if(mmpChildren.at(i) == mmpParent) + mmpRelativePaths.append(mmpChildren.at(i)); + else { + QString relativePath = directory.relativeFilePath(childDir); + if(relativePath.startsWith("..")) + mmpRelativePaths.append(childDir); + else + directory.relativeFilePath(relativePath); + //mmpRelativePaths.append(directory.relativeFilePath(childDir) + "/" + mmpChildren.at(i)); + } + } + return mmpRelativePaths; +} + //Factory things QT_BEGIN_INCLUDE_NAMESPACE #include "unixmake.h" @@ -428,6 +730,8 @@ QT_BEGIN_INCLUDE_NAMESPACE #include "borland_bmake.h" #include "msvc_dsp.h" #include "msvc_vcproj.h" +#include "symmake_abld.h" +#include "symmake_sbsv2.h" QT_END_INCLUDE_NAMESPACE MakefileGenerator * @@ -464,6 +768,10 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) mkfile = new NmakeMakefileGenerator; } else if(gen == "BMAKE") { mkfile = new BorlandMakefileGenerator; + } else if(gen == "SYMBIAN_ABLD") { + mkfile = new SymbianAbldMakefileGenerator; + } else if(gen == "SYMBIAN_SBSV2") { + mkfile = new SymbianSbsv2MakefileGenerator; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); } @@ -480,7 +788,10 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na MetaMakefileGenerator *ret = 0; if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { - if(proj->first("TEMPLATE").endsWith("subdirs")) + if(proj->first("MAKEFILE_GENERATOR").startsWith("SYMBIAN") && proj->values("TEMPLATE").contains("subdirs")) { + // new metamakefilegenerator type to support subdirs for symbian related projects + ret = new SymbianSubdirsMetaMakefileGenerator(proj, name, op); + } else if (proj->first("TEMPLATE").endsWith("subdirs")) ret = new SubdirsMetaMakefileGenerator(proj, name, op); } if(!ret) diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp new file mode 100644 index 0000000..0325264 --- /dev/null +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -0,0 +1,240 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "initprojectdeploy_symbian.h" +#include <QDirIterator> +#include <project.h> +#include <qdebug.h> + +#define PLUGIN_STUB_DIR "qmakepluginstubs" + +static bool isPlugin(const QFileInfo& info, const QString& devicePath) +{ + // Libraries are plugins if deployment path is something else than + // \\sys\\bin or x:\\sys\\bin + if (0 == info.suffix().compare(QLatin1String("dll")) && + (devicePath.size() < 8 || + (0 != devicePath.compare(QLatin1String("\\sys\\bin")) && + 0 != devicePath.mid(1).compare(QLatin1String(":\\sys\\bin"))))) { + return true; + } else { + return false; + } +} + +static bool isBinary(const QFileInfo& info) +{ + if (0 == info.suffix().compare(QLatin1String("dll")) || + 0 == info.suffix().compare(QLatin1String("exe"))) { + return true; + } else { + return false; + } +} + +static void createPluginStub(const QFileInfo& info, + const QString& devicePath, + DeploymentList &deploymentList, + QStringList& generatedDirs, + QStringList& generatedFiles) { + QDir().mkpath(QLatin1String(PLUGIN_STUB_DIR "\\")); + if (!generatedDirs.contains(PLUGIN_STUB_DIR)) + generatedDirs << PLUGIN_STUB_DIR; + // Plugin stubs must have different name from the actual plugins, because + // the toolchain for creating ROM images cannot handle non-binary .dll files properly. + QFile stubFile(QLatin1String(PLUGIN_STUB_DIR "\\") + info.completeBaseName() + ".qtplugin"); + if(stubFile.open(QIODevice::WriteOnly)) { + if (!generatedFiles.contains(stubFile.fileName())) + generatedFiles << stubFile.fileName(); + QTextStream t(&stubFile); + // Add note to stub so that people will not wonder what it is. + // Creation date is added to make new stub to deploy always to + // force plugin cache miss when loading plugins. + t << "This file is a Qt plugin stub file. The real Qt plugin is located in \\sys\\bin. Created:" << QDateTime::currentDateTime().toString(Qt::ISODate) << "\n"; + } else { + fprintf(stderr, "cannot deploy \"%s\" because of plugin stub file creation failed\n", info.fileName().toLatin1().constData()); + } + QFileInfo stubInfo(stubFile); + deploymentList.append(CopyItem(Option::fixPathToLocalOS(stubInfo.absoluteFilePath()), + Option::fixPathToLocalOS(devicePath + "\\" + stubInfo.fileName()))); +} + +void initProjectDeploySymbian(QMakeProject* project, + DeploymentList &deploymentList, + const QString &testPath, + bool deployBinaries, + const QString &platform, + const QString &build, + QStringList& generatedDirs, + QStringList& generatedFiles) +{ + QString targetPath = project->values("deploy.path").join(" "); + if (targetPath.isEmpty()) + targetPath = testPath; + if (targetPath.endsWith("/") || targetPath.endsWith("\\")) + targetPath = targetPath.mid(0,targetPath.size()-1); + + bool targetPathHasDriveLetter = false; + if (targetPath.size() > 1) { + targetPathHasDriveLetter = targetPath.at(1) == QLatin1Char(':'); + } + QString deploymentDrive = targetPathHasDriveLetter ? targetPath.left(2) : QLatin1String("c:"); + + // foreach item in DEPLOYMENT + foreach(QString item, project->values("DEPLOYMENT")) { + // get item.path + QString devicePath = project->first(item + ".path"); + if (!deployBinaries + && !devicePath.isEmpty() + && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join("")) + || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join("")))) { + // Do not deploy resources in emulator builds, as that seems to cause conflicts + // If there is ever a real need to deploy pre-built resources for emulator, + // BLD_INF_RULES.prj_exports can be used as a workaround. + continue; + } + + bool devicePathHasDriveLetter = false; + if (devicePath.size() > 1) { + devicePathHasDriveLetter = devicePath.at(1) == QLatin1Char(':'); + } + + if (devicePath.isEmpty() || devicePath == QLatin1String(".")) { + devicePath = targetPath; + } + // check if item.path is relative (! either / or \) + else if (!(devicePath.at(0) == QLatin1Char('/') + || devicePath.at(0) == QLatin1Char('\\') + || devicePathHasDriveLetter)) { + // create output path + devicePath = Option::fixPathToLocalOS(QDir::cleanPath(targetPath + QLatin1Char('\\') + devicePath)); + } else { + if (0 == platform.compare(QLatin1String("winscw"))) { + devicePath = epocRoot() + "epoc32\\winscw\\c" + devicePath; + } else { + // Drive letter needed if targetpath contains one and it is not already in + if (targetPathHasDriveLetter && !devicePathHasDriveLetter) { + devicePath = deploymentDrive + devicePath; + } + } + } + + devicePath.replace(QLatin1String("/"), QLatin1String("\\")); + + if (!deployBinaries && + 0 == devicePath.right(8).compare(QLatin1String("\\sys\\bin"))) { + // Skip deploying to \\sys\\bin for anything but binary deployments + // Note: Deploying pre-built binaries also follow this rule, so emulator builds + // will not get those deployed. Since there is no way to differentiate currently + // between pre-built binaries for emulator and HW anyway, this is not a major issue. + continue; + } + + // foreach d in item.sources + foreach(QString source, project->values(item + ".sources")) { + source = Option::fixPathToLocalOS(source); + QString nameFilter; + QFileInfo info(source); + QString searchPath; + bool dirSearch = false; + + if (info.isDir()) { + nameFilter = QLatin1String("*"); + searchPath = info.absoluteFilePath(); + dirSearch = true; + } else { + if (info.exists() || source.indexOf('*') != -1) { + nameFilter = source.split('\\').last(); + searchPath = info.absolutePath(); + } else { + // Entry was not found. That is ok if it is a binary, since those do not necessarily yet exist. + // Dlls need to be processed even when not deploying binaries for the stubs + if (isBinary(info)) { + if (deployBinaries) { + // Executables and libraries are deployed to \sys\bin + QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\"); + deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName()), + Option::fixPathToLocalOS(deploymentDrive + QLatin1String("\\sys\\bin\\") + info.fileName()))); + } + if (isPlugin(info, devicePath)) { + createPluginStub(info, devicePath, deploymentList, generatedDirs, generatedFiles); + continue; + } + } else { + // Generate deployment even if file doesn't exist, as this may be the case + // when generating .pkg files. + deploymentList.append(CopyItem(Option::fixPathToLocalOS(info.absoluteFilePath()), + Option::fixPathToLocalOS(devicePath + "\\" + info.fileName()))); + continue; + } + } + } + + int pathSize = info.absolutePath().size(); + QDirIterator iterator(searchPath, QStringList() << nameFilter + , QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks + , dirSearch ? QDirIterator::Subdirectories : QDirIterator::NoIteratorFlags ); + // foreach dirIterator-entry in d + while(iterator.hasNext()) { + iterator.next(); + QFileInfo iteratorInfo(iterator.filePath()); + QString absoluteItemPath = Option::fixPathToLocalOS(iteratorInfo.absolutePath()); + int diffSize = absoluteItemPath.size() - pathSize; + + if (!iteratorInfo.isDir()) { + if (isPlugin(iterator.fileInfo(), devicePath)) { + // This deploys pre-built plugins. Other pre-built binaries will deploy normally, + // as they have \sys\bin target path. + if (deployBinaries) { + deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), + Option::fixPathToLocalOS(deploymentDrive + QLatin1String("\\sys\\bin\\") + iterator.fileName()))); + } + createPluginStub(info, devicePath + "\\" + absoluteItemPath.right(diffSize), deploymentList, generatedDirs, generatedFiles); + continue; + } else { + deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), + Option::fixPathToLocalOS(devicePath + "\\" + absoluteItemPath.right(diffSize) + "\\" + iterator.fileName()))); + } + } + } + } + } +} diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.h b/qmake/generators/symbian/initprojectdeploy_symbian.h new file mode 100644 index 0000000..0aad431 --- /dev/null +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef INITPROJECTDEPLOYSYMBIAN_H +#define INITPROJECTDEPLOYSYMBIAN_H + +#include <qstring.h> +#include <qstringlist.h> +#include <qdatetime.h> +#include <option.h> +#include <qdir.h> +#include <qfile.h> +#include <stdlib.h> + +struct CopyItem +{ + CopyItem(const QString& f, const QString& t) : from(f) , to(t) { } + QString from; + QString to; +}; +typedef QList<CopyItem> DeploymentList; + +extern void initProjectDeploySymbian(QMakeProject* project, + DeploymentList &deploymentList, + const QString &testPath, + bool deployBinaries, + const QString &platform, + const QString &build, + QStringList& generatedDirs, + QStringList& generatedFiles); +#endif // INITPROJECTDEPLOYSYMBIAN_H
\ No newline at end of file diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp new file mode 100644 index 0000000..f1e9165 --- /dev/null +++ b/qmake/generators/symbian/symmake.cpp @@ -0,0 +1,1648 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "symmake.h" +#include "initprojectdeploy_symbian.h" + +#include <qstring.h> +#include <qhash.h> +#include <qstringlist.h> +#include <qdir.h> +#include <qdatetime.h> +#include <stdlib.h> +#include <qdebug.h> + +#define RESOURCE_DIRECTORY_MMP "/resource/apps" +#define RESOURCE_DIRECTORY_RESOURCE "\\\\resource\\\\apps\\\\" +#define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" +#define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" +#define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def" +#define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1) + +#define BLD_INF_RULES_BASE "BLD_INF_RULES." +#define BLD_INF_TAG_PLATFORMS "prj_platforms" +#define BLD_INF_TAG_MMPFILES "prj_mmpfiles" +#define BLD_INF_TAG_TESTMMPFILES "prj_testmmpfiles" +#define BLD_INF_TAG_EXTENSIONS "prj_extensions" +#define RSS_RULES "RSS_RULES" +#define RSS_RULES_BASE "RSS_RULES." +#define RSS_TAG_NBROFICONS "number_of_icons" +#define RSS_TAG_ICONFILE "icon_file" + +#define DUMP_VAR(v) \ +{ \ + QString s(v); \ + QStringList list = project->values(s); \ + printf("----------------------------------\n", qPrintable(s)); \ + printf("Dumping %s (%d items) from %s, %d\n", \ + qPrintable(s), \ + list.count(), \ + __FILE__, \ + __LINE__); \ + foreach(QString l, list) \ + printf("\t%s\n", qPrintable(l)); \ +} + +QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir) +{ + static QString epocRootStr; + if (epocRootStr.isEmpty()) { + QFileInfo efi(epocRoot()); + epocRootStr = efi.canonicalFilePath(); + if (epocRootStr.isEmpty()) { + fprintf(stderr, "Unable to resolve epocRoot '%s' to real dir on current drive, defaulting to '/' for mmp paths\n", qPrintable(epocRoot())); + epocRootStr = "/"; + } + if (!epocRootStr.endsWith("/")) + epocRootStr += "/"; + + epocRootStr += "epoc32/"; + } + + QString resultPath = origPath; + + // Make it relative, unless it starts with "%epocroot%/epoc32/" + if (resultPath.startsWith(epocRootStr, Qt::CaseInsensitive)) { + resultPath.replace(epocRootStr, "/epoc32/", Qt::CaseInsensitive); + } else { + resultPath = parentDir.relativeFilePath(resultPath); + } + resultPath = QDir::cleanPath(resultPath); + + if (resultPath.isEmpty()) + resultPath = "."; + + return resultPath; +} + +QString SymbianMakefileGenerator::canonizePath(const QString& origPath) +{ + // Since current path gets appended almost always anyway, use it as default + // for nonexisting paths. + static QString defaultPath; + if (defaultPath.isEmpty()) { + QFileInfo fi("."); + defaultPath = fi.canonicalFilePath(); + } + + // Prepend epocroot to any paths beginning with "/epoc32/" + QString resultPath = QDir::fromNativeSeparators(origPath); + if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) + resultPath = QDir::fromNativeSeparators(epocRoot()) + resultPath.mid(1); + + QFileInfo fi(fileInfo(resultPath)); + if(fi.isDir()) { + resultPath = fi.canonicalFilePath(); + } else { + resultPath = fi.canonicalPath(); + } + + resultPath = QDir::cleanPath(resultPath); + + if (resultPath.isEmpty()) + resultPath = defaultPath; + + return resultPath; +} + +SymbianMakefileGenerator::SymbianMakefileGenerator() : MakefileGenerator() { } +SymbianMakefileGenerator::~SymbianMakefileGenerator() { } + +void SymbianMakefileGenerator::writeHeader(QTextStream &t) { + t << "// ============================================================================" << endl; + t << "// * Makefile for building: " << escapeFilePath(var("TARGET")) << endl; + t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// * This file is generated by qmake and should not be modified by the" << endl; + t << "// * user." << endl; + t << "// * Project: " << fileFixify(project->projectFile()) << endl; + t << "// * Template: " << var("TEMPLATE") << endl; + //if(!project->isActiveConfig("build_pass")) + // t << "// = Command: " << build_args().replace("$(QMAKE)", + // (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE"))) << endl; + t << "// ============================================================================" << endl; + t << endl; + + // defining define for bld.inf + + QString shortProFilename = project->projectFile(); + shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); + shortProFilename.replace(QString(".pro"), QString("")); + + QString bldinfDefine = shortProFilename; + bldinfDefine.append("_"); + bldinfDefine.append(generate_uid(project->projectFile())); + + bldinfDefine.prepend("BLD_INF_"); + removeSpecialCharacters(bldinfDefine); + + t << "#define " << bldinfDefine.toUpper() << endl << endl; +} + +bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) { + writeHeader(t); + + QString numberOfIcons; + QString iconFile; + QStringList userRssRules; + readRssRules(numberOfIcons, iconFile, userRssRules); + + // Get the application translations and convert to symbian OS lang code, i.e. decical number + QStringList symbianLangCodes = symbianLangCodesFromTsFiles(); + + // Generate pkg files if there are any actual files to deploy + bool generatePkg = false; + if (getTargetExtension() == "exe") { + generatePkg = true; + } else { + foreach(QString item, project->values("DEPLOYMENT")) { + if (!project->values(item + ".sources").isEmpty()) { + generatePkg = true; + break; + } + } + } + + if (generatePkg) { + QStringList platformList = project->values("SYMBIAN_PLATFORMS"); + foreach(QString platform, platformList) { + if(platform.compare("WINSCW", Qt::CaseInsensitive)) { + generatePkgFile(platform.toLower(), "udeb", iconFile); + generatePkgFile(platform.toLower(), "urel", iconFile); + } + } + } + + writeBldInfContent(t, generatePkg); + + // Generate empty wrapper makefile here, because wrapper makefile must exist before writeMkFile, + // but all required data is not yet available. + bool isPrimaryMakefile = true; + QString wrapperFileName("Makefile"); + QString outputFileName = fileInfo(Option::output.fileName()).fileName(); + if (outputFileName != BLD_INF_FILENAME) { + wrapperFileName.append(".").append((outputFileName.size() > BLD_INF_FILENAME_LEN && outputFileName.left(BLD_INF_FILENAME_LEN) == BLD_INF_FILENAME) ? outputFileName.mid(8) : outputFileName); + isPrimaryMakefile = false; + } + + QFile wrapperMakefile(wrapperFileName); + if(wrapperMakefile.open(QIODevice::WriteOnly)) { + generatedFiles << wrapperFileName; + } else { + fprintf(stderr, "Error: Could not open wrapper makefile '%s'\n", qPrintable(wrapperFileName)); + return false; + } + + if (getTargetExtension() == "subdirs") { + // If we have something to deploy, generate extension makefile for just that, since + // normal extension makefile is not getting generated and we need emulator deployment to be done. + if (generatePkg) + writeMkFile(wrapperFileName, true); + writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); + return true; + } + + writeMkFile(wrapperFileName, false); + + QString shortProFilename = project->projectFile(); + shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); + shortProFilename.replace(QString(".pro"), QString("")); + + QString mmpFilename = shortProFilename; + mmpFilename.append("_"); + mmpFilename.append(uid3); + mmpFilename.append(".mmp"); + writeMmpFile(mmpFilename, symbianLangCodes); + + if (getTargetExtension() == "exe") { + if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + QString appname = escapeFilePath(fileFixify(project->first("TARGET"))); + appname = removePathSeparators(appname); + writeRegRssFile(appname, userRssRules); + writeRssFile(appname, numberOfIcons, iconFile); + writeLocFile(appname, symbianLangCodes); + } + } + + writeCustomDefFile(); + writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); + + return true; +} + +bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) { + QString pkgFilename = QString("%1_%2_%3.%4") + .arg(fileInfo(project->projectFile()).completeBaseName()) + .arg(compiler) + .arg(config) + .arg("pkg"); + QFile pkgFile(pkgFilename); + if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) + return false; + + generatedFiles << pkgFile.fileName(); + + // header info + QTextStream t(&pkgFile); + t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl; + t << "; This file is generated by qmake and should not be modified by the user" << endl; + t << ";" << endl << endl; + + // language, (*** hardcoded to english atm) + t << "; Language" << endl; + t << "&EN" << endl << endl; + + // name of application, UID and version + QString applicationName = project->first("TARGET"); + int last = applicationName.lastIndexOf(QLatin1Char('/')); + applicationName = applicationName.mid( last == -1 ? 0 : last+1 ); + + QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); + + t << "; SIS header: name, uid, version" << endl; + t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl; + + // vendor names (*** hardcoded for now) + t << "; Localised Vendor name" << endl; + t << "%{\"Nokia, Qt Software\"}" << endl << endl; + t << "; Unique Vendor name" << endl; + t << ":\"Nokia, Qt Software\"" << endl << endl; + + // Dependencies + t << "; Dependencies" << endl; + foreach(QString item, project->values("DEPLOYMENT")) { + QStringList dependencies = project->values(item + ".depends"); + foreach(QString dependency, dependencies) { + t << dependency << endl; + } + } + t << endl; + + // install paths on the phone *** should be dynamic at some point + QString installPathBin = "!:\\sys\\bin"; + QString installPathResource = "!:\\resource\\apps"; + QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; + + // find location of builds + QString epocReleasePath = QString("%1epoc32/release/%2/%3") + .arg(epocRoot()) + .arg(compiler) + .arg(config); + + + if (getTargetExtension() == "exe") { + // deploy .exe file + t << "; Executable and default resource files" << endl; + QString exeFile = applicationName + ".exe"; + t << QString("\"%1/%2\" - \"%3\\%4\"") + .arg(epocReleasePath) + .arg(exeFile) + .arg(installPathBin) + .arg(exeFile) << endl; + + // deploy rsc & reg_rsc file + if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") + .arg(epocRoot()) + .arg(applicationName + ".rsc") + .arg(installPathResource) + .arg(applicationName + ".rsc") << endl; + + t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"") + .arg(epocRoot()) + .arg(applicationName + "_reg.rsc") + .arg(installPathRegResource) + .arg(applicationName + "_reg.rsc") << endl; + + QString myIconFile = iconFile; + myIconFile = myIconFile.replace("\\\\", "\\"); + + if (!iconFile.isEmpty()) { + t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") + .arg(epocRoot()) + .arg(QString(myIconFile).replace('\\','/')) + .arg(myIconFile) << endl << endl; + } + } + } + + // deploy any additional DEPLOYMENT files + DeploymentList depList; + QString remoteTestPath; + remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); + + initProjectDeploySymbian( project, depList, remoteTestPath, true, compiler, config, generatedDirs, generatedFiles ); + if (depList.size()) + t << "; DEPLOYMENT" << endl; + for (int i=0; i<depList.size(); ++i) { + t << QString("\"%1\" - \"%2\"") + .arg(QString(depList.at(i).from).replace('\\','/')) + .arg(depList.at(i).to) << endl; + } + + return true; +} + +bool SymbianMakefileGenerator::writeCustomDefFile() { + if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + // Create custom def file for plugin + QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); + + if(ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + + t << "; ==============================================================================" << endl; + t << "; Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "; This file is generated by qmake and should not be modified by the" << endl; + t << "; user." << endl; + t << "; Name : " PLUGIN_COMMON_DEF_FILE_ACTUAL << endl; + t << "; Part of : " << project->values("TARGET").join(" ") << endl; + t << "; Description : Fixes common plugin symbols to known ordinals" << endl; + t << "; Version : " << endl; + t << ";" << endl; + t << "; ==============================================================================" << "\n" << endl; + + t << endl; + + t << "EXPORTS" << endl; + t << "\tqt_plugin_query_verification_data @ 1 NONAME" << endl; + t << "\tqt_plugin_instance @ 2 NONAME" << endl; + t << endl; + } else { + return false; + } + } + + return true; +} + +void SymbianMakefileGenerator::init() +{ + MakefileGenerator::init(); +/* + DUMP_VAR("GENERATED_SOURCES"); +*/ + // fixing again !!! + if(0 != project->values("QMAKE_PLATFORM").size()) + platform = varGlue("QMAKE_PLATFORM", "", " ", ""); + + if(0 == project->values("QMAKESPEC").size()) + project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); + + if(!isConfigSetToSymbian()) + project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); + + + // bld.inf + project->values("MAKEFILE") += BLD_INF_FILENAME; + + // .mmp + initMmpVariables(); + + // UID1 + uid1 = generateUID1(); + + // check TARGET.UID2 and TARGET.UID3 presence + if(0 != project->values("TARGET.UID3").size()) { + uid3 = project->first("TARGET.UID3"); + } else { + uid3 = generateUID3(); + } + + // some fix + if((project->values("TEMPLATE")).contains("app")) + targetType = "exe"; + else if((project->values("TEMPLATE")).contains("lib")) { + // check CONFIG to see if we are to build staticlib or dll + if(project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) + targetType = "staticlib"; + else if (project->values("CONFIG").contains("plugin")) + targetType = "plugin"; + else // for now it will be default + targetType = "dll"; + } + else // fix + targetType = "subdirs"; + + if(0 != project->values("TARGET.UID2").size()) { + uid2 = project->first("TARGET.UID2"); + } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + uid2 = "0x20004C45"; + } else { + if(getTargetExtension() == "exe") { + if(project->values("QT").contains("gui", Qt::CaseInsensitive)) { + // exe and also gui + uid2 = "0x100039CE"; + } else { + // exe but not gui.. uid2 is ignored anyway + // set it to 0 + uid2 = "0"; + } + } else if(getTargetExtension() == "dll" || getTargetExtension() == "lib") { + uid2 = "0x1000008d"; + } + } + + uid2 = uid2.trimmed(); + uid3 = uid3.trimmed(); + + // UID is valid as either hex or decimal, so just convert it to number and back to hex + // to get proper string for private dir + bool conversionOk = false; + uint uidNum = uid3.toUInt(&conversionOk, 0); + + if (!conversionOk) { + fprintf(stderr, "Error: Invalid UID \"%s\".", uid3.toUtf8().constData()); + } else { + privateDirUid.setNum(uidNum, 16); + while (privateDirUid.length() < 8) + privateDirUid.insert(0,QLatin1Char('0')); + } +} + +QString SymbianMakefileGenerator::getTargetExtension() { + QString ret; + if(targetType.compare("exe", Qt::CaseInsensitive) == 0 || targetType.compare("app", Qt::CaseInsensitive) == 0) { + ret.append("exe"); + } else if (targetType.compare("staticlib",Qt::CaseInsensitive) == 0) { + ret.append("lib"); + } else if (targetType.compare("dll", Qt::CaseInsensitive) == 0 || targetType.compare("plugin", Qt::CaseInsensitive) == 0) { + ret.append("dll"); + } else if (targetType.compare("subdirs", Qt::CaseInsensitive) == 0) { + // just fix + ret.append("subdirs"); + } else { + // if nothing said then assume "exe" + ret.append("exe"); + } + + return ret; +} + +bool SymbianMakefileGenerator::isConfigSetToSymbian() { + return project->values("CONFIG").contains("symbian", Qt::CaseInsensitive); +} + +QString SymbianMakefileGenerator::generateUID1() { + // just for now + return QString(""); +} + +QString SymbianMakefileGenerator::generateUID2() { + // standard stuff; picked form symbian + // later meybe read from somewhere + return QString(""); +} + +QString SymbianMakefileGenerator::generateUID3() { + + QString target = project->first("TARGET"); + QString currPath = qmake_getpwd(); + target.prepend("/").prepend(currPath); + return generate_test_uid(target); + +} + +bool SymbianMakefileGenerator::initMmpVariables() { + QStringList sysincspaths; + QStringList srcincpaths; + QStringList srcpaths; + + srcpaths << project->values("SOURCES") << project->values("GENERATED_SOURCES"); + srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); + srcpaths << project->values("UI_DIR"); + + QDir current = QDir::current(); + QString canonizedCurrent = canonizePath("."); + + for(int j = 0; j < srcpaths.size(); ++j) { + QFileInfo fi(fileInfo(srcpaths.at(j))); + // Sometimes sources have other than *.c* files (e.g. *.moc); prune them. + if (fi.suffix().startsWith("c")) { + if(fi.filePath().length() > fi.fileName().length() ) { + appendIfnotExist(srcincpaths, fi.path() ); + sources[canonizePath(fi.path())] += fi.fileName(); + } else { + sources[canonizedCurrent] += fi.fileName(); + appendIfnotExist(srcincpaths, canonizedCurrent); + } + } + } + + QStringList incpaths; + incpaths << project->values("INCLUDEPATH"); + incpaths << QLibraryInfo::location(QLibraryInfo::HeadersPath); + incpaths << project->values("HEADERS"); + incpaths << srcincpaths; + incpaths << project->values("UI_HEADERS_DIR"); + incpaths << project->values("UI_DIR"); + + QString epocPath("epoc32"); + for(int j = 0; j < incpaths.size(); ++j) { + QString includepath = canonizePath(incpaths.at(j)); + appendIfnotExist(sysincspaths, includepath); + if (!includepath.contains(epocPath)) // No temp dirs for epoc includes + appendIfnotExist(sysincspaths, includepath + QString("/tmp")); + } + + // remove duplicate include path entries + // convert to native directory separators + // to check if includepaths are same + QStringList temporary; + for(int i = 0; i < sysincspaths.size(); ++i) { + QString origPath = sysincspaths.at(i); + QFileInfo origPathInfo(fileInfo(origPath)); + bool bFound = false; + + for(int j = 0; j < temporary.size(); ++j) { + QString tmpPath = temporary.at(j); + QFileInfo tmpPathInfo(fileInfo(tmpPath)); + + if(origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { + bFound = true; + if(!tmpPathInfo.isRelative() && origPathInfo.isRelative()) { + // we keep the relative notation + temporary.removeOne(tmpPath); + temporary << origPath; + } + } + } + + if(!bFound) + temporary << origPath; + + } + + sysincspaths.clear(); + sysincspaths << temporary; + + systeminclude.insert("SYSTEMINCLUDE", sysincspaths); + + return true; +} + +bool SymbianMakefileGenerator::removeDuplicatedStrings(QStringList& stringList) { + + QStringList tmpStringList; + + for(int i = 0; i < stringList.size(); ++i) { + QString string = stringList.at(i); + if(tmpStringList.contains(string)) + continue; + else + tmpStringList.append(string); + } + + stringList.clear(); + stringList = tmpStringList; + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t){ + t << "// ==============================================================================" << endl; + t << "// Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// This file is generated by qmake and should not be modified by the" << endl; + t << "// user." << endl; + t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length()-4,4))) << ".mmp" << endl; + t << "// ==============================================================================" << endl << endl; + + return true; +} + +bool SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) +{ + QFile ft(filename); + if(ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + + //printf("WRITING: %s \n", qPrintable(filename)); + + QTextStream t(&ft); + + writeMmpFileHeader(t); + + writeMmpFileTargetPart(t); + + writeMmpFileResourcePart(t, symbianLangCodes); + + writeMmpFileMacrosPart(t); + + writeMmpFileIncludePart(t); + + QDir current = QDir::current(); + + for(QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { + QStringList values = it.value(); + QString currentSourcePath = it.key(); + + if (values.size()) + t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; + + for (int i = 0; i < values.size(); ++i) { + QString sourceFileName = values.at(i); + t << "SOURCE\t\t" << sourceFileName << endl; + } + t << endl; + } + t << endl; + + writeMmpFileLibraryPart(t); + + writeMmpFileCapabilityPart(t); + + writeMmpFileCompilerOptionPart(t); + + writeMmpFileBinaryVersionPart(t); + + writeMmpFileRulesPart(t); + } else { + return false; + } + + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) { + + t << endl; + + if(isConfigSetToSymbian()) + return true; + + QStringList &defines = project->values("DEFINES"); + if (defines.size()) + t << "// Qt Macros" << endl; + for(int i = 0; i < defines.size(); ++i) { + QString def = defines.at(i); + addMacro(t, def); + } + + // These are required in order that all methods will be correctly exported e.g from qtestlib + QStringList &exp_defines = project->values("PRL_EXPORT_DEFINES"); + if (exp_defines.size()) + t << endl << "// Qt Export Defines" << endl; + for(int i = 0; i < exp_defines.size(); ++i) { + QString def = exp_defines.at(i); + addMacro(t, def); + } + + t << endl; + + return true; +} + +bool SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) { + t << "MACRO" << "\t\t" << value << endl; + return true; +} + + +bool SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) { + if(getTargetExtension() == "exe") { + t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << "\n"; + if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + t << "TARGETTYPE" << "\t\t" << "STDEXE" << endl; + else + t << "TARGETTYPE" << "\t\t" << "EXE" << endl; + } else if (getTargetExtension() == "dll"){ + t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".dll")) << "\n"; + if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + t << "TARGETTYPE" << "\t\t" << "STDDLL" << endl; + else + t << "TARGETTYPE" << "\t\t" << "DLL" << endl; + } else if (getTargetExtension() == "lib"){ + t << "TARGET" << "\t\t" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".lib")) << "\n"; + if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + t << "TARGETTYPE" << "\t\t" << "STDLIB" << endl; + else + t << "TARGETTYPE" << "\t\t" << "LIB" << endl; + } else { + printf("unexpected target and targettype %s\n", getTargetExtension().toAscii().data()); + } + + t << endl; + + t << "UID" << "\t\t" << uid2 << " " << uid3 << endl; + + if(0 != project->values("TARGET.SID").size()) { + t << "SECUREID" << "\t\t" << project->values("TARGET.SID").join(" ") << endl; + } else { + if(0 == uid3.size()) + t << "SECUREID" << "\t\t" << "0" << endl; + else + t << "SECUREID" << "\t\t" << uid3 << endl; + } + + // default value used from mkspecs..qconfig.h is 0 + if(0 != project->values("TARGET.VID").size()) { + t << "VENDORID" << "\t\t" << project->values("TARGET.VID").join(" ") << endl; + } + + t << endl; + + if(0 != project->first("TARGET.EPOCSTACKSIZE").size()) + t << "EPOCSTACKSIZE" << "\t\t" << project->first("TARGET.EPOCSTACKSIZE") << endl; + if(0 != project->values("TARGET.EPOCHEAPSIZE").size()) + t << "EPOCHEAPSIZE" << "\t\t" << project->values("TARGET.EPOCHEAPSIZE").join(" ") << endl; + if(0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) + t << "EPOCALLOWDLLDATA" << endl; + + if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + // use custom def file for Qt plugins + t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; + } + + t << endl; + + return true; +} + + +/* + Application registration resource files + should be installed to the + + \private\10003a3f\import\apps directory. +*/ +bool SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) { + if((getTargetExtension() == "exe") && + !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + QString target = escapeFilePath(fileFixify(project->first("TARGET"))); + target = removePathSeparators(target); + + QString locTarget = target; + locTarget.append(".rss"); + + t << "SOURCEPATH\t\t\t. " << endl; + t << "LANG SC "; // no endl + foreach(QString lang, symbianLangCodes) { + t << lang << " "; // no endl + } + t << endl; + t << "START RESOURCE\t\t" << locTarget << endl; + t << "HEADER" << endl; + t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP<< endl; + t << "END" << endl << endl; + + // now append extension + QString regTarget = target; + regTarget.append("_reg.rss"); + // must state SOURCEPATH for resources + // relative placement (relative to dir where .mmp located) + // absolute placement (!RELATIVE! to EPOCROOT dir) + + + t << "SOURCEPATH\t\t\t. " << endl; + t << "START RESOURCE\t\t" << regTarget << endl; + if (isForSymbianSbsv2()) + t << "DEPENDS " << target << ".rsg" << endl; + t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; + t << "END" << endl << endl; + } + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { + + QDir current = QDir::current(); + + for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + QString handledPath = values.at(i); + t << "SYSTEMINCLUDE" << "\t\t" << fixPathForMmp(handledPath, current) << endl; + } + } + + t << endl; + + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) { + + writeMmpFileSystemIncludePart(t); + + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) { + QStringList &libs = project->values("LIBS"); + libs << project->values("QMAKE_LIBS"); + + removeDuplicatedStrings(libs); + + for(int i = 0; i < libs.size(); ++i) { + QString lib = libs.at(i); + // The -L flag is uninteresting, since all symbian libraries exist in the + // same directory. + if(lib.startsWith("-l")) { + lib.remove(0,2); + QString mmpStatement; + if (lib.endsWith(".dll")) { + lib.chop(4); + mmpStatement = "LIBRARY\t\t"; + } else if (lib.endsWith(".lib")) { + lib.chop(4); + mmpStatement = "STATICLIBRARY\t"; + } else { + // Hacky way to find out what kind of library it is. Check the + // ARMV5 build directory for library type. We default to shared + // library, since that is probably more common. + QString udebStaticLibLocation(epocRoot()); + QString urelStaticLibLocation(udebStaticLibLocation); + udebStaticLibLocation += QString("epoc32/release/armv5/udeb/%1.lib").arg(lib); + urelStaticLibLocation += QString("epoc32/release/armv5/urel/%1.lib").arg(lib); + if (QFile::exists(udebStaticLibLocation) || QFile::exists(urelStaticLibLocation)) { + mmpStatement = "STATICLIBRARY\t"; + } else { + mmpStatement = "LIBRARY\t\t"; + } + } + t << mmpStatement << lib << ".lib" << endl; + } + } + + t << endl; + + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileCapabilityPart(QTextStream& t) { + if(0 != project->first("TARGET.CAPABILITY").size()) { + QStringList &capabilities = project->values("TARGET.CAPABILITY"); + t << "CAPABILITY" << "\t\t"; + + for(int i = 0; i < capabilities.size(); ++i) { + QString cap = capabilities.at(i); + t << cap << " "; + } + } + else { + t << "CAPABILITY" << "\t\t" << "None"; + } + t << endl << endl; + + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileCompilerOptionPart(QTextStream& t) { + QString cw, armcc; + + if(0 != project->values("QMAKE_CXXFLAGS.CW").size()) { + cw.append(project->values("QMAKE_CXXFLAGS.CW").join(" ")); + cw.append(" "); + } + + if(0 != project->values("QMAKE_CXXFLAGS.ARMCC").size()) { + armcc.append(project->values("QMAKE_CXXFLAGS.ARMCC").join(" ")); + armcc.append(" "); + } + + if(0 != project->values("QMAKE_CFLAGS.CW").size()) { + cw.append(project->values("QMAKE_CFLAGS.CW").join(" ")); + cw.append(" "); + } + + if(0 != project->values("QMAKE_CFLAGS.ARMCC").size()) { + armcc.append(project->values("QMAKE_CFLAGS.ARMCC").join(" ")); + armcc.append(" "); + } + + if(0 != project->values("QMAKE_CXXFLAGS").size()) { + cw.append(project->values("QMAKE_CXXFLAGS").join(" ")); + cw.append(" "); + armcc.append(project->values("QMAKE_CXXFLAGS").join(" ")); + armcc.append(" "); + } + + if(0 != project->values("QMAKE_CFLAGS").size()) { + cw.append(project->values("QMAKE_CFLAGS").join(" ")); + cw.append(" "); + armcc.append(project->values("QMAKE_CFLAGS").join(" ")); + armcc.append(" "); + } + + if (!cw.isEmpty() && cw[cw.size()-1] == ' ') + cw.chop(1); + if (!armcc.isEmpty() && armcc[armcc.size()-1] == ' ') + armcc.chop(1); + + if (!cw.isEmpty()) + t << "OPTION" << '\t' << " CW " << cw << endl; + if (!armcc.isEmpty()) + t << "OPTION" << '\t' << " ARMCC "<< armcc << endl; + // others to come + + t << endl; + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileBinaryVersionPart(QTextStream& t) { + QString applicationVersion = project->first("VERSION"); + QStringList verNumList = applicationVersion.split('.'); + uint major = 0; + uint minor = 0; + uint patch = 0; + bool success = false; + + if (verNumList.size() > 0) { + major = verNumList[0].toUInt(&success); + if (success && verNumList.size() > 1) { + minor = verNumList[1].toUInt(&success); + if (success && verNumList.size() > 2) { + patch = verNumList[2].toUInt(&success); + } + } + } + + QString mmpVersion; + if (success && major <= 0xFFFF && minor <= 0xFF && patch <= 0xFF) { + // Symbian binary version only has major and minor components, so compress + // Qt's minor and patch values into the minor component. Since Symbian's minor + // component is a 16 bit value, only allow 8 bits for each to avoid overflow. + mmpVersion.append(QString::number(major)) + .append('.') + .append(QString::number((minor << 8) + patch)); + } else { + if (!applicationVersion.isEmpty()) + fprintf(stderr, "Invalid VERSION string: %s\n", qPrintable(applicationVersion)); + mmpVersion = "10.0"; // Default binary version for symbian is 10.0 + } + + t << "VERSION " << mmpVersion << endl; + + return true; +} + +bool SymbianMakefileGenerator::writeMmpFileRulesPart(QTextStream& t) { + foreach(QString item, project->values("MMP_RULES")) { + t << endl; + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line mmp statements + if (project->values(item).isEmpty()) { + t << item << endl; + } else { + foreach(QString itemRow, project->values(item)) { + t << itemRow << endl; + } + } + } + return true; +} + +bool SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploymentExtension) { + // Read user defined bld inf rules + QMap<QString, QStringList> userBldInfRules; + for(QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { + if (it.key().startsWith(BLD_INF_RULES_BASE)) { + QString newKey = it.key().mid(sizeof(BLD_INF_RULES_BASE)-1); + if (newKey.isEmpty()) { + fprintf(stderr, "Warning: Empty BLD_INF_RULES key encountered\n"); + continue; + } + QStringList newValues; + QStringList values = it.value(); + foreach(QString item, values) { + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line statements + if (project->values(item).isEmpty()) { + newValues << item; + } else { + foreach(QString itemRow, project->values(item)) { + newValues << itemRow; + } + } + } + userBldInfRules.insert(newKey, newValues); + } + } + + // Add includes of subdirs bld.inf files + + QString mmpfilename = escapeFilePath(fileFixify(project->projectFile())); + mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf(".")+1, 3, "mmp"); + QString currentPath = qmake_getpwd(); + + if(!currentPath.endsWith(QString("/"))) + currentPath.append("/"); + + QStringList mmpProjects = project->values("MMPFILES_DIRECT_DEPENDS"); + QStringList shadowProjects = project->values("SHADOW_BLD_INFS"); + + removeDuplicatedStrings(mmpProjects); + removeDuplicatedStrings(shadowProjects); + + // go in reverse order ... as that is the way how I build the list + QListIterator<QString> iT(mmpProjects); + iT.toBack(); + while(iT.hasPrevious()) { + QString fullMmpName = iT.previous(); + QString relativePath; + QString bldinfFilename; + + QString fullProFilename = fullMmpName; + fullProFilename.replace(QString(".mmp"), QString(".pro")); + QString uid = generate_uid(fullProFilename); + + QString cleanMmpName = fullProFilename; + cleanMmpName.replace(QString(".pro"), QString("")); + cleanMmpName.replace(0, cleanMmpName.lastIndexOf("/") + 1, QString("")); + + if(shadowProjects.contains(BLD_INF_FILENAME "." + cleanMmpName)) { // shadow project + QDir directory(currentPath); + relativePath = directory.relativeFilePath(fullProFilename); + bldinfFilename = BLD_INF_FILENAME "." + cleanMmpName; + if(relativePath.contains("/")) { + // shadow .pro not in same + // directory as parent .pro + if(relativePath.startsWith("..")) { + // shadow .pro out of parent .pro + relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); + bldinfFilename.prepend("/").prepend(relativePath); + } else { + relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); + bldinfFilename.prepend("/").prepend(relativePath); + } + } else { + // shadow .pro and parent .pro in same directory + bldinfFilename.prepend("./"); + } + } else { // regular project + // calc relative path + QDir directory(currentPath); + relativePath = directory.relativeFilePath(fullProFilename); + relativePath.replace(relativePath.lastIndexOf("/"), relativePath.length(), QString("")); + bldinfFilename = relativePath.append("/").append(BLD_INF_FILENAME); + } + + QString bldinfDefine = QString("BLD_INF_") + cleanMmpName + QString("_") + uid; + bldinfDefine = bldinfDefine.toUpper(); + removeSpecialCharacters(bldinfDefine); + + t << "#ifndef " << bldinfDefine << endl; + t << "\t#include \"" << QDir::toNativeSeparators(bldinfFilename) << "\"" << endl; + t << "#endif // " << bldinfDefine << endl; + } + + // Add supported project platforms + + t << endl << BLD_INF_TAG_PLATFORMS << endl << endl; + if(0 != project->values("SYMBIAN_PLATFORMS").size()) + t << project->values("SYMBIAN_PLATFORMS").join(" ") << endl; + + QStringList userItems = userBldInfRules.value(BLD_INF_TAG_PLATFORMS); + foreach(QString item, userItems) + t << item << endl; + userBldInfRules.remove(BLD_INF_TAG_PLATFORMS); + t << endl; + + // Add project mmps and old style extension makefiles + QString mmpTag; + if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) + mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); + else + mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); + + t << endl << mmpTag << endl << endl; + + writeBldInfMkFilePart(t, addDeploymentExtension); + if (getTargetExtension() == "subdirs") { + mmpProjects.removeOne(mmpfilename); + } + + if(getTargetExtension() != "subdirs") { + QString shortProFilename = project->projectFile(); + shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); + shortProFilename.replace(QString(".pro"), QString("")); + + QString mmpFilename = shortProFilename + QString("_") + uid3 + QString(".mmp"); + + t << mmpFilename << endl; + } + + userItems = userBldInfRules.value(mmpTag); + foreach(QString item, userItems) + t << item << endl; + userBldInfRules.remove(mmpTag); + + t << endl << BLD_INF_TAG_EXTENSIONS << endl << endl; + + // Generate extension rules + writeBldInfExtensionRulesPart(t); + + userItems = userBldInfRules.value(BLD_INF_TAG_EXTENSIONS); + foreach(QString item, userItems) + t << item << endl; + userBldInfRules.remove(BLD_INF_TAG_EXTENSIONS); + + // Add rest of the user defined content + + for(QMap<QString, QStringList>::iterator it = userBldInfRules.begin(); it != userBldInfRules.end(); ++it) { + t << endl << endl << it.key() << endl << endl; + userItems = it.value(); + foreach(QString item, userItems) + t << item << endl; + } + + return true; +} + +bool SymbianMakefileGenerator::writeRegRssFile(QString &appName, QStringList &userItems) { + QString filename(appName); + filename.append("_reg.rss"); + QFile ft(filename); + if(ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + t << "// ============================================================================" << endl; + t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// * This file is generated by qmake and should not be modified by the" << endl; + t << "// * user." << endl; + t << "// ============================================================================" << endl; + t << endl; + t << "#include <" << appName << ".rsg>" << endl; + t << "#include <appinfo.rh>" << endl; + t << endl; + //t << "#include <data_caging_paths.hrh>" << "\n" << endl; + t << "UID2 " << "KUidAppRegistrationResourceFile" << endl; + t << "UID3 " << uid3 << endl << endl; + t << "RESOURCE APP_REGISTRATION_INFO" << endl; + t << "\t{" << endl; + t << "\tapp_file=\"" << appName << "\";" << endl; + t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << appName << "\";" << endl; + t << endl; + + foreach(QString item, userItems) + t << "\t" << item << endl; + t << "\t}" << endl; + } else { + return false; + } + return true; +} + +bool SymbianMakefileGenerator::writeRssFile(QString &appName, QString &numberOfIcons, QString &iconFile) { + QString filename(appName); + filename.append(".rss"); + QFile ft(filename); + if(ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + t << "// ============================================================================" << endl; + t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// * This file is generated by qmake and should not be modified by the" << endl; + t << "// * user." << endl; + t << "// ============================================================================" << endl; + t << endl; + t << "#include <appinfo.rh>" << endl; + t << "#include \"" << appName << ".loc\"" << endl; + t << endl; + t << "RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info" << endl; + t << "\t{" << endl; + t << "\tshort_caption = STRING_r_short_caption;" << endl; + t << "\tcaption_and_icon =" << endl; + t << "\tCAPTION_AND_ICON_INFO" << endl; + t << "\t\t{" << endl; + t << "\t\tcaption = STRING_r_caption;" << endl; + + if(numberOfIcons.isEmpty() || iconFile.isEmpty() ) { + // There can be maximum one item in this tag, validated when parsed + t << "\t\tnumber_of_icons = 0;" << endl; + t << "\t\ticon_file = \"\";" << endl; + } + else { + // There can be maximum one item in this tag, validated when parsed + t << "\t\tnumber_of_icons = " << numberOfIcons << ";" << endl; + t << "\t\ticon_file = \"" << iconFile << "\";" << endl; + } + t << "\t\t};" << endl; + t << "\t}" << endl; + t << endl; + } else { + return false; + } + return true; +} + +bool SymbianMakefileGenerator::writeLocFile(QString &appName, QStringList &symbianLangCodes) { + QString filename(appName); + filename.append(".loc"); + QFile ft(filename); + if(ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + t << "// ============================================================================" << endl; + t << "// * Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl; + t << "// * This file is generated by qmake and should not be modified by the" << endl; + t << "// * user." << endl; + t << "// ============================================================================" << endl; + t << endl; + t << "#ifdef LANGUAGE_SC" << endl; + //t << "#include \"" << appName << ".l01\"" << endl; + t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; + t << "#define STRING_r_caption \"" << appName << "\"" << endl; + foreach(QString lang, symbianLangCodes) { + t << "#elif defined LANGUAGE_" << lang << endl; + //t << "#include \"" << appName << ".l" << lang << "\"" << endl; + t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; + t << "#define STRING_r_caption \"" << appName << "\"" << endl; + } + t << "#else" << endl; + t << "#define STRING_r_short_caption \"" << appName << "\"" << endl; + t << "#define STRING_r_caption \"" << appName << "\"" << endl; + t << "#endif" << endl; + } else { + return false; + } + return true; +} + +void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) { + for(QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { + if (it.key().startsWith(RSS_RULES_BASE)) { + QString newKey = it.key().mid(sizeof(RSS_RULES_BASE)-1); + if (newKey.isEmpty()) { + fprintf(stderr, "Warning: Empty RSS_RULES_BASE key encountered\n"); + continue; + } + QStringList newValues; + QStringList values = it.value(); + foreach(QString item, values) { + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line statements + if (project->values(item).isEmpty()) { + newValues << item; + } else { + foreach(QString itemRow, project->values(item)) { + newValues << itemRow; + } + } + } + // Verify thet there is exactly one value in RSS_TAG_NBROFICONS + if (newKey == RSS_TAG_NBROFICONS) { + if (newValues.count() == 1) { + numberOfIcons = newValues[0]; + } else { + fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", + RSS_RULES_BASE, RSS_TAG_NBROFICONS); + continue; + } + // Verify thet there is exactly one value in RSS_TAG_ICONFILE + } else if (newKey == RSS_TAG_ICONFILE) { + if (newValues.count() == 1) { + iconFile = newValues[0]; + } else { + fprintf(stderr, "Warning: There must be exactly one value in '%s%s'\n", + RSS_RULES_BASE, RSS_TAG_ICONFILE); + continue; + } + } else { + fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", + RSS_RULES_BASE, newKey.toLatin1().constData()); + continue; + } + } + } + + foreach(QString item, project->values(RSS_RULES)) { + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line mmp statements + if (project->values(item).isEmpty()) { + userRssRules << item; + } else { + userRssRules << project->values(item); + } + } + + // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist + // or neither of them exist + if ( !((numberOfIcons.isEmpty() && iconFile.isEmpty()) || + (!numberOfIcons.isEmpty() && !iconFile.isEmpty())) ) { + numberOfIcons.clear(); + iconFile.clear(); + fprintf(stderr, "Warning: Both or neither of '%s%s' and '%s%s' keys must exist.\n", + RSS_RULES_BASE, RSS_TAG_NBROFICONS, RSS_RULES_BASE, RSS_TAG_ICONFILE ); + } + + // Validate that RSS_TAG_NBROFICONS contains only numbers + if( !numberOfIcons.isEmpty() ) { + bool ok; + numberOfIcons = numberOfIcons.simplified(); + int tmp = numberOfIcons.toInt(&ok); + if (!ok) { + numberOfIcons.clear(); + iconFile.clear(); + fprintf(stderr, "Warning: '%s%s' must be integer in decimal format.\n", + RSS_RULES_BASE, RSS_TAG_NBROFICONS ); + } + } +} + +QStringList SymbianMakefileGenerator::symbianLangCodesFromTsFiles() { + QStringList tsfiles; + QStringList symbianLangCodes; + tsfiles << project->values("TRANSLATIONS"); + + fillQt2S60LangMapTable(); + + foreach(QString file, tsfiles) { + int extIndex = file.lastIndexOf("."); + int langIndex = file.lastIndexOf("_", (extIndex - file.length())); + langIndex += 1; + QString qtlang = file.mid(langIndex, extIndex - langIndex ); + QString s60lang = qt2S60LangMapTable.value(qtlang, QString("SC")); + + if( !symbianLangCodes.contains(s60lang) && s60lang != "SC" ) + symbianLangCodes += s60lang; + } + + return symbianLangCodes; +} + +void SymbianMakefileGenerator::fillQt2S60LangMapTable() { + qt2S60LangMapTable.reserve(170); // 165 items at time of writing. + qt2S60LangMapTable.insert("ab", "SC"); //Abkhazian // + qt2S60LangMapTable.insert("om", "SC"); //Afan // + qt2S60LangMapTable.insert("aa", "SC"); //Afar // + qt2S60LangMapTable.insert("af", "34"); //Afrikaans //Afrikaans + qt2S60LangMapTable.insert("sq", "35"); //Albanian //Albanian + qt2S60LangMapTable.insert("am", "36"); //Amharic //Amharic + qt2S60LangMapTable.insert("ar", "37"); //Arabic //Arabic + qt2S60LangMapTable.insert("hy", "38"); //Armenian //Armenian + qt2S60LangMapTable.insert("as", "SC"); //Assamese // + qt2S60LangMapTable.insert("ay", "SC"); //Aymara // + qt2S60LangMapTable.insert("az", "SC"); //Azerbaijani // + qt2S60LangMapTable.insert("ba", "SC"); //Bashkir // + qt2S60LangMapTable.insert("eu", "SC"); //Basque // + qt2S60LangMapTable.insert("bn", "41"); //Bengali //Bengali + qt2S60LangMapTable.insert("dz", "SC"); //Bhutani // + qt2S60LangMapTable.insert("bh", "SC"); //Bihari // + qt2S60LangMapTable.insert("bi", "SC"); //Bislama // + qt2S60LangMapTable.insert("br", "SC"); //Breton // + qt2S60LangMapTable.insert("bg", "42"); //Bulgarian //Bulgarian + qt2S60LangMapTable.insert("my", "43"); //Burmese //Burmese + qt2S60LangMapTable.insert("be", "40"); //Byelorussian //Belarussian + qt2S60LangMapTable.insert("km", "SC"); //Cambodian // + qt2S60LangMapTable.insert("ca", "44"); //Catalan //Catalan + qt2S60LangMapTable.insert("zh", "SC"); //Chinese // + qt2S60LangMapTable.insert("co", "SC"); //Corsican // + qt2S60LangMapTable.insert("hr", "45"); //Croatian //Croatian + qt2S60LangMapTable.insert("cs", "25"); //Czech //Czech + qt2S60LangMapTable.insert("da", "07"); //Danish //Danish + qt2S60LangMapTable.insert("nl", "18"); //Dutch //Dutch + qt2S60LangMapTable.insert("en", "01"); //English //English(UK) + qt2S60LangMapTable.insert("eo", "SC"); //Esperanto // + qt2S60LangMapTable.insert("et", "49"); //Estonian //Estonian + qt2S60LangMapTable.insert("fo", "SC"); //Faroese // + qt2S60LangMapTable.insert("fj", "SC"); //Fiji // + qt2S60LangMapTable.insert("fi", "09"); //Finnish //Finnish + qt2S60LangMapTable.insert("fr", "02"); //French //French + qt2S60LangMapTable.insert("fy", "SC"); //Frisian // + qt2S60LangMapTable.insert("gd", "52"); //Gaelic //Gaelic + qt2S60LangMapTable.insert("gl", "SC"); //Galician // + qt2S60LangMapTable.insert("ka", "53"); //Georgian //Georgian + qt2S60LangMapTable.insert("de", "03"); //German //German + qt2S60LangMapTable.insert("el", "54"); //Greek //Greek + qt2S60LangMapTable.insert("kl", "SC"); //Greenlandic // + qt2S60LangMapTable.insert("gn", "SC"); //Guarani // + qt2S60LangMapTable.insert("gu", "56"); //Gujarati //Gujarati + qt2S60LangMapTable.insert("ha", "SC"); //Hausa // + qt2S60LangMapTable.insert("he", "57"); //Hebrew //Hebrew + qt2S60LangMapTable.insert("hi", "58"); //Hindi //Hindi + qt2S60LangMapTable.insert("hu", "17"); //Hungarian //Hungarian + qt2S60LangMapTable.insert("is", "15"); //Icelandic //Icelandic + qt2S60LangMapTable.insert("id", "59"); //Indonesian //Indonesian + qt2S60LangMapTable.insert("ia", "SC"); //Interlingua // + qt2S60LangMapTable.insert("ie", "SC"); //Interlingue // + qt2S60LangMapTable.insert("iu", "SC"); //Inuktitut // + qt2S60LangMapTable.insert("ik", "SC"); //Inupiak // + qt2S60LangMapTable.insert("ga", "60"); //Irish //Irish + qt2S60LangMapTable.insert("it", "05"); //Italian //Italian + qt2S60LangMapTable.insert("ja", "32"); //Japanese //Japanese + qt2S60LangMapTable.insert("jv", "SC"); //Javanese // + qt2S60LangMapTable.insert("kn", "62"); //Kannada //Kannada + qt2S60LangMapTable.insert("ks", "SC"); //Kashmiri // + qt2S60LangMapTable.insert("kk", "63"); //Kazakh //Kazakh + qt2S60LangMapTable.insert("rw", "SC"); //Kinyarwanda // + qt2S60LangMapTable.insert("ky", "SC"); //Kirghiz // + qt2S60LangMapTable.insert("ko", "65"); //Korean //Korean + qt2S60LangMapTable.insert("ku", "SC"); //Kurdish // + qt2S60LangMapTable.insert("rn", "SC"); //Kurundi // + qt2S60LangMapTable.insert("lo", "66"); //Laothian //Laothian + qt2S60LangMapTable.insert("la", "SC"); //Latin // + qt2S60LangMapTable.insert("lv", "67"); //Latvian //Latvian + qt2S60LangMapTable.insert("ln", "SC"); //Lingala // + qt2S60LangMapTable.insert("lt", "68"); //Lithuanian //Lithuanian + qt2S60LangMapTable.insert("mk", "69"); //Macedonian //Macedonian + qt2S60LangMapTable.insert("mg", "SC"); //Malagasy // + qt2S60LangMapTable.insert("ms", "70"); //Malay //Malay + qt2S60LangMapTable.insert("ml", "71"); //Malayalam //Malayalam + qt2S60LangMapTable.insert("mt", "SC"); //Maltese // + qt2S60LangMapTable.insert("mi", "SC"); //Maori // + qt2S60LangMapTable.insert("mr", "72"); //Marathi //Marathi + qt2S60LangMapTable.insert("mo", "73"); //Moldavian //Moldovian + qt2S60LangMapTable.insert("mn", "74"); //Mongolian //Mongolian + qt2S60LangMapTable.insert("na", "SC"); //Nauru // + qt2S60LangMapTable.insert("ne", "SC"); //Nepali // + qt2S60LangMapTable.insert("nb", "08"); //Norwegian //Norwegian + qt2S60LangMapTable.insert("oc", "SC"); //Occitan // + qt2S60LangMapTable.insert("or", "SC"); //Oriya // + qt2S60LangMapTable.insert("ps", "SC"); //Pashto // + qt2S60LangMapTable.insert("fa", "SC"); //Persian // + qt2S60LangMapTable.insert("pl", "27"); //Polish //Polish + qt2S60LangMapTable.insert("pt", "13"); //Portuguese //Portuguese + qt2S60LangMapTable.insert("pa", "77"); //Punjabi //Punjabi + qt2S60LangMapTable.insert("qu", "SC"); //Quechua // + qt2S60LangMapTable.insert("rm", "SC"); //RhaetoRomance // + qt2S60LangMapTable.insert("ro", "78"); //Romanian //Romanian + qt2S60LangMapTable.insert("ru", "16"); //Russian //Russian + qt2S60LangMapTable.insert("sm", "SC"); //Samoan // + qt2S60LangMapTable.insert("sg", "SC"); //Sangho // + qt2S60LangMapTable.insert("sa", "SC"); //Sanskrit // + qt2S60LangMapTable.insert("sr", "79"); //Serbian //Serbian + qt2S60LangMapTable.insert("sh", "SC"); //SerboCroatian // + qt2S60LangMapTable.insert("st", "SC"); //Sesotho // + qt2S60LangMapTable.insert("tn", "SC"); //Setswana // + qt2S60LangMapTable.insert("sn", "SC"); //Shona // + qt2S60LangMapTable.insert("sd", "SC"); //Sindhi // + qt2S60LangMapTable.insert("si", "80"); //Singhalese //Sinhalese + qt2S60LangMapTable.insert("ss", "SC"); //Siswati // + qt2S60LangMapTable.insert("sk", "26"); //Slovak //Slovak + qt2S60LangMapTable.insert("sl", "28"); //Slovenian //Slovenian + qt2S60LangMapTable.insert("so", "81"); //Somali //Somali + qt2S60LangMapTable.insert("es", "04"); //Spanish //Spanish + qt2S60LangMapTable.insert("su", "SC"); //Sundanese // + qt2S60LangMapTable.insert("sw", "84"); //Swahili //Swahili + qt2S60LangMapTable.insert("sv", "06"); //Swedish //Swedish + qt2S60LangMapTable.insert("tl", "39"); //Tagalog //Tagalog + qt2S60LangMapTable.insert("tg", "SC"); //Tajik // + qt2S60LangMapTable.insert("ta", "87"); //Tamil //Tamil + qt2S60LangMapTable.insert("tt", "SC"); //Tatar // + qt2S60LangMapTable.insert("te", "88"); //Telugu //Telugu + qt2S60LangMapTable.insert("th", "33"); //Thai //Thai + qt2S60LangMapTable.insert("bo", "89"); //Tibetan //Tibetan + qt2S60LangMapTable.insert("ti", "90"); //Tigrinya //Tigrinya + qt2S60LangMapTable.insert("to", "SC"); //Tonga // + qt2S60LangMapTable.insert("ts", "SC"); //Tsonga // + qt2S60LangMapTable.insert("tr", "14"); //Turkish //Turkish + qt2S60LangMapTable.insert("tk", "92"); //Turkmen //Turkmen + qt2S60LangMapTable.insert("tw", "SC"); //Twi // + qt2S60LangMapTable.insert("ug", "SC"); //Uigur // + qt2S60LangMapTable.insert("uk", "93"); //Ukrainian //Ukrainian + qt2S60LangMapTable.insert("ur", "94"); //Urdu //Urdu + qt2S60LangMapTable.insert("uz", "SC"); //Uzbek // + qt2S60LangMapTable.insert("vi", "96"); //Vietnamese //Vietnamese + qt2S60LangMapTable.insert("vo", "SC"); //Volapuk // + qt2S60LangMapTable.insert("cy", "97"); //Welsh //Welsh + qt2S60LangMapTable.insert("wo", "SC"); //Wolof // + qt2S60LangMapTable.insert("xh", "SC"); //Xhosa // + qt2S60LangMapTable.insert("yi", "SC"); //Yiddish // + qt2S60LangMapTable.insert("yo", "SC"); //Yoruba // + qt2S60LangMapTable.insert("za", "SC"); //Zhuang // + qt2S60LangMapTable.insert("zu", "98"); //Zulu //Zulu + qt2S60LangMapTable.insert("nn", "75"); //Nynorsk //NorwegianNynorsk + qt2S60LangMapTable.insert("bs", "SC"); //Bosnian // + qt2S60LangMapTable.insert("dv", "SC"); //Divehi // + qt2S60LangMapTable.insert("gv", "SC"); //Manx // + qt2S60LangMapTable.insert("kw", "SC"); //Cornish // + qt2S60LangMapTable.insert("ak", "SC"); //Akan // + qt2S60LangMapTable.insert("kok", "SC"); //Konkani // + qt2S60LangMapTable.insert("gaa", "SC"); //Ga // + qt2S60LangMapTable.insert("ig", "SC"); //Igbo // + qt2S60LangMapTable.insert("kam", "SC"); //Kamba // + qt2S60LangMapTable.insert("syr", "SC"); //Syriac // + qt2S60LangMapTable.insert("byn", "SC"); //Blin // + qt2S60LangMapTable.insert("gez", "SC"); //Geez // + qt2S60LangMapTable.insert("kfo", "SC"); //Koro // + qt2S60LangMapTable.insert("sid", "SC"); //Sidamo // + qt2S60LangMapTable.insert("cch", "SC"); //Atsam // + qt2S60LangMapTable.insert("tig", "SC"); //Tigre // + qt2S60LangMapTable.insert("kaj", "SC"); //Jju // + qt2S60LangMapTable.insert("fur", "SC"); //Friulian // + qt2S60LangMapTable.insert("ve", "SC"); //Venda // + qt2S60LangMapTable.insert("ee", "SC"); //Ewe // + qt2S60LangMapTable.insert("wa", "SC"); //Walamo // + qt2S60LangMapTable.insert("haw", "SC"); //Hawaiian // + qt2S60LangMapTable.insert("kcg", "SC"); //Tyap // + qt2S60LangMapTable.insert("ny", "SC"); //Chewa // +} + +void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QString value) +{ + if(!list.contains(value)) + list += value; +} + +void SymbianMakefileGenerator::appendIfnotExist(QStringList &list, QStringList values) +{ + foreach(QString item, values) + appendIfnotExist(list, item); +} + +QString SymbianMakefileGenerator::removePathSeparators(QString &file) +{ + QString ret = file; + while(ret.indexOf(QDir::separator()) > 0) { + ret.remove(0, ret.indexOf(QDir::separator())+1); + } + + return ret; +} + + +QString SymbianMakefileGenerator::removeTrailingPathSeparators(QString &file) +{ + QString ret = file; + if(ret.endsWith(QDir::separator())) { + ret.remove(ret.length()-1,1); + } + + return ret; +} + +bool SymbianMakefileGenerator::generateCleanCommands(QTextStream& t, + const QStringList& toClean, + const QString& cmd, + const QString& cmdOptions, + const QString& itemPrefix, + const QString& itemSuffix) { + for (int i = 0; i < toClean.size(); ++i) { + QString item = toClean.at(i); + item.prepend(itemPrefix).append(itemSuffix); +#if defined(Q_OS_WIN) + t << "\t-@ if EXIST \"" << QDir::toNativeSeparators(item) << "\" "; + t << cmd << " " << cmdOptions << " \"" << QDir::toNativeSeparators(item) << "\"" << endl; +#else + t << "\t-if test -f " << QDir::toNativeSeparators(item) << "; then "; + t << cmd << " " << cmdOptions << " " << QDir::toNativeSeparators(item) << "; fi" << endl; +#endif + } + + return true; +} + +QString SymbianMakefileGenerator::getWithoutSpecialCharacters(QString& str) { + QString tmp = str; + + tmp.replace(QString("/"), QString("_")); + tmp.replace(QString("\\"), QString("_")); + tmp.replace(QString("-"), QString("_")); + tmp.replace(QString(":"), QString("_")); + tmp.replace(QString("."), QString("_")); + + return tmp; +} + +void SymbianMakefileGenerator::removeSpecialCharacters(QString& str) { + str.replace(QString("/"), QString("_")); + str.replace(QString("\\"), QString("_")); + str.replace(QString("-"), QString("_")); + str.replace(QString(":"), QString("_")); + str.replace(QString("."), QString("_")); + str.replace(QString(" "), QString("_")); +} diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h new file mode 100644 index 0000000..037faff --- /dev/null +++ b/qmake/generators/symbian/symmake.h @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SYMMAKEFILE_H +#define SYMMAKEFILE_H + +#include <makefile.h> + +QT_BEGIN_NAMESPACE + +// In the Qt evaluation and educational version, we have a postfix in the +// library name (e.g. qtmteval301.dll). QTDLL_POSTFIX is used for this. +// A script modifies these lines when building eval/edu version, so be careful +// when changing them. +#ifndef QTDLL_POSTFIX +#define QTDLL_POSTFIX "" +#endif + +#define BLD_INF_FILENAME "bld.inf" +#define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" + +class SymbianMakefileGenerator : public MakefileGenerator { + +protected: + + QString platform; + QString uid1; + QString uid2; + QString uid3; + QString privateDirUid; + QString targetType; + QMap<QString, QStringList> sources; + QMap<QString, QStringList> systeminclude; + QMap<QString, QStringList> library; + // (output file) (source , command) + QMap<QString, QStringList> makmakeCommands; + + QStringList generatedFiles; + QStringList generatedDirs; + QHash<QString, QString> qt2S60LangMapTable; + + void removeSpecialCharacters(QString& str); + QString getWithoutSpecialCharacters(QString& str); + QString fixPathForMmp(const QString& origPath, const QDir& parentDir); + QString canonizePath(const QString& origPath); + + virtual bool writeMakefile(QTextStream &t); + bool generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); + + virtual void init(); + + QString getTargetExtension(); + bool isConfigSetToSymbian(); + + QString generateUID1(); + QString generateUID2(); + QString generateUID3(); + + bool initMmpVariables(); + + void writeHeader(QTextStream &t); + bool writeBldInfContent(QTextStream& t, bool addDeploymentExtension); + + static bool removeDuplicatedStrings(QStringList& stringList); + + bool writeMmpFileHeader(QTextStream &t); + bool writeMmpFile(QString &filename, QStringList &symbianLangCodes); + bool writeMmpFileMacrosPart(QTextStream& t); + bool addMacro(QTextStream& t, const QString& value); + bool writeMmpFileTargetPart(QTextStream& t); + bool writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes); + bool writeMmpFileSystemIncludePart(QTextStream& t); + bool writeMmpFileIncludePart(QTextStream& t); + bool writeMmpFileLibraryPart(QTextStream& t); + bool writeMmpFileCapabilityPart(QTextStream& t); + bool writeMmpFileCompilerOptionPart(QTextStream& t); + bool writeMmpFileBinaryVersionPart(QTextStream& t); + bool writeMmpFileRulesPart(QTextStream& t); + + bool writeRegRssFile(QString &appname, QStringList &useritems); + bool writeRssFile(QString &appName, QString &numberOfIcons, QString &iconfile); + bool writeLocFile(QString &appName, QStringList &symbianLangCodes); + void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); + QStringList symbianLangCodesFromTsFiles(); + void fillQt2S60LangMapTable(); + + void appendIfnotExist(QStringList &list, QString value); + void appendIfnotExist(QStringList &list, QStringList values); + + QString removePathSeparators(QString &file); + QString removeTrailingPathSeparators(QString &file); + bool generateCleanCommands(QTextStream& t, + const QStringList& toClean, + const QString& cmd, + const QString& cmdOptions, + const QString& itemPrefix, + const QString& itemSuffix); + + + bool writeCustomDefFile(); + + // Subclass implements + virtual bool writeBldInfExtensionRulesPart(QTextStream& t) = 0; + virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0; + virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly) = 0; + virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) = 0; + +public: + + SymbianMakefileGenerator(); + ~SymbianMakefileGenerator(); + +}; + +#endif // SYMMAKEFILE_H + diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp new file mode 100644 index 0000000..8501224 --- /dev/null +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -0,0 +1,474 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "symmake_abld.h" +#include "initprojectdeploy_symbian.h" + +#include <qstring.h> +#include <qstringlist.h> +#include <qdir.h> +#include <qdatetime.h> +#include <qdebug.h> + +#define DO_NOTHING_TARGET "do_nothing" +#define CREATE_TEMPS_TARGET "create_temps" +#define EXTENSION_CLEAN "extension_clean" +#define PRE_TARGETDEPS_TARGET "pre_targetdeps" +#define COMPILER_CLEAN_TARGET "compiler_clean" +#define FINALIZE_TARGET "finalize" +#define GENERATED_SOURCES_TARGET "generated_sources" +#define ALL_SOURCE_DEPS_TARGET "all_source_deps" +#define WINSCW_DEPLOYMENT_TARGET "winscw_deployment" +#define WINSCW_DEPLOYMENT_CLEAN_TARGET "winscw_deployment_clean" + +SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } +SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } + +bool SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) +{ + + QString gnuMakefileName = QLatin1String("Makefile_") + uid3; + removeSpecialCharacters(gnuMakefileName); + gnuMakefileName.append(".mk"); + + QFile ft(gnuMakefileName); + if(ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.fileName(); + QTextStream t(&ft); + + t << "# ==============================================================================" << endl; + t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString() << endl; + t << "# This file is generated by qmake and should not be modified by the" << endl; + t << "# user." << endl; + t << "# Name : " << gnuMakefileName << endl; + t << "# Part of : " << project->values("TARGET").join(" ") << endl; + t << "# Description : This file is used to call necessary targets on wrapper makefile" << endl; + t << "# during normal Symbian build process." << endl; + t << "# Version : " << endl; + t << "#" << endl; + t << "# ==============================================================================" << "\n" << endl; + + t << endl << endl; + + t << "MAKE = make" << endl; + t << endl; + + t << DO_NOTHING_TARGET " :" << endl; + t << "\t" << "@rem " DO_NOTHING_TARGET << endl << endl; + + QString buildDeps; + QString cleanDeps; + QString finalDeps; + QString cleanDepsWinscw; + QString finalDepsWinscw; + QStringList wrapperTargets; + if (deploymentOnly) { + buildDeps.append(DO_NOTHING_TARGET); + cleanDeps.append(DO_NOTHING_TARGET); + cleanDepsWinscw.append( WINSCW_DEPLOYMENT_CLEAN_TARGET); + finalDeps.append(DO_NOTHING_TARGET); + finalDepsWinscw.append(WINSCW_DEPLOYMENT_TARGET); + wrapperTargets << WINSCW_DEPLOYMENT_TARGET << WINSCW_DEPLOYMENT_CLEAN_TARGET; + } else { + buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET); + cleanDeps.append(EXTENSION_CLEAN); + cleanDepsWinscw.append(EXTENSION_CLEAN " " WINSCW_DEPLOYMENT_CLEAN_TARGET); + finalDeps.append(FINALIZE_TARGET); + finalDepsWinscw.append(FINALIZE_TARGET " " WINSCW_DEPLOYMENT_TARGET); + wrapperTargets << PRE_TARGETDEPS_TARGET + << CREATE_TEMPS_TARGET + << EXTENSION_CLEAN + << FINALIZE_TARGET + << WINSCW_DEPLOYMENT_CLEAN_TARGET + << WINSCW_DEPLOYMENT_TARGET; + } + + t << "MAKMAKE: " << buildDeps << endl << endl; + t << "LIB: " << buildDeps << endl << endl; + t << "BLD: " << buildDeps << endl << endl; + t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; + t << "CLEAN: " << cleanDepsWinscw << endl; + t << "else" << endl; + t << "CLEAN: " << cleanDeps << endl; + t << "endif" << endl << endl; + t << "CLEANLIB: " DO_NOTHING_TARGET << endl << endl; + t << "RESOURCE: " DO_NOTHING_TARGET << endl << endl; + t << "FREEZE: " DO_NOTHING_TARGET << endl << endl; + t << "SAVESPACE: " DO_NOTHING_TARGET << endl << endl; + t << "RELEASABLES: " DO_NOTHING_TARGET << endl << endl; + t << "ifeq \"$(PLATFORM)\" \"WINSCW\"" << endl; + t << "FINAL: " << finalDepsWinscw << endl; + t << "else" << endl; + t << "FINAL: " << finalDeps << endl; + t << "endif" << endl << endl; + + QString makefile(Option::fixPathToTargetOS(fileInfo(wrapperFileName).canonicalFilePath())); + foreach(QString target, wrapperTargets) { + t << target << " : " << makefile << endl; + t << "\t-$(MAKE) -f \"" << makefile << "\" " << target << endl << endl; + } + + t << endl; + } // if(ft.open(QIODevice::WriteOnly)) + + return true; +} + +void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) +{ + QStringList allPlatforms; + foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) { + allPlatforms << platform.toLower(); + } + + QStringList debugPlatforms = allPlatforms; + QStringList releasePlatforms = allPlatforms; + releasePlatforms.removeAll("winscw"); // No release for emulator + + bool isSubdirs = getTargetExtension() == "subdirs"; + + QString testClause; + if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) + testClause = QLatin1String(" test"); + else + testClause = QLatin1String(""); + + QTextStream t(&wrapperFile); + + t << "# ==============================================================================" << endl; + t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString() << endl; + t << "# This file is generated by qmake and should not be modified by the" << endl; + t << "# user." << endl; + t << "# Name : " << wrapperFile.fileName() << endl; + t << "# Description : Wrapper Makefile for calling Symbian build tools" << endl; + t << "#" << endl; + t << "# ==============================================================================" << "\n" << endl; + t << endl; + QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); + if(ofile.lastIndexOf(Option::dir_sep) != -1) + ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); + t << "MAKEFILE = " << ofile << endl; + t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "XCOPY = xcopy /d /f /h /r /y /i" << endl; + t << "ABLD = ABLD.BAT" << endl; + t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; + t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; + t << "MAKE = make" << endl; + t << endl; + t << "ifeq (WINS,$(findstring WINS, $(PLATFORM)))" << endl; + t << "ZDIR=$(EPOCROOT)epoc32\\release\\$(PLATFORM)\\$(CFG)\\Z" << endl; + t << "else" << endl; + t << "ZDIR=$(EPOCROOT)epoc32\\data\\z" << endl; + t << "endif" << endl; + t << endl; + t << "DEFINES" << '\t' << " = " + << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") + << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") + << varGlue("DEFINES","-D"," -D","") << endl; + + t << "INCPATH" << '\t' << " = "; + + for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + t << " -I\"" << values.at(i) << "\""; + } + } + t << endl; + t << "first: default" << endl; + if (debugPlatforms.contains("winscw")) + t << "default: debug-winscw"; + else if (debugPlatforms.contains("armv5")) + t << "default: debug-armv5"; + else if (debugPlatforms.size()) + t << "default: debug-" << debugPlatforms.first(); + else + t << "default: all"; + + t << endl; + if (!isPrimaryMakefile) { + t << "all:" << endl; + } else { + t << "all: debug release" << endl; + t << endl; + t << "qmake:" << endl; + t << "\t$(QMAKE) -spec symbian-abld -o \"" << fileInfo(Option::output.fileName()).fileName() + << "\" \"" << project->projectFile() << "\"" << endl; + t << endl; + t << BLD_INF_FILENAME ":" << endl; + t << "\t$(QMAKE)" << endl; + t << endl; + t << "$(ABLD): " BLD_INF_FILENAME << endl; + t << "\tbldmake bldfiles" << endl; + t << endl; + + t << "debug: $(ABLD)" << endl; + foreach(QString item, debugPlatforms) { + t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; + } + t << endl; + t << "release: $(ABLD)" << endl; + foreach(QString item, releasePlatforms) { + t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; + } + t << endl; + + // For more specific builds, targets are in this form: build-platform, e.g. release-armv5 + foreach(QString item, debugPlatforms) { + t << "debug-" << item << ": $(ABLD)" << endl; + t << "\t$(ABLD)" << testClause << " build " << item << " udeb" << endl; + } + + foreach(QString item, releasePlatforms) { + t << "release-" << item << ": $(ABLD)" << endl; + t << "\t$(ABLD)" << testClause << " build " << item << " urel" << endl; + } + + t << endl; + t << "export: $(ABLD)" << endl; + t << "\t$(ABLD)" << testClause << " export" << endl; + t << endl; + + t << "cleanexport: $(ABLD)" << endl; + t << "\t$(ABLD)" << testClause << " cleanexport" << endl; + t << endl; + + } + + // pre_targetdeps target depends on: + // - all targets specified in PRE_TARGETDEPS + // - the GENERATED_SOURCES sources (so that they get generated) + // - all dependencies of sources targeted for compilation + // (mainly to ensure that any included UNUSED_SOURCES that need to be generated get generated) + // + // Unfortunately, Symbian build chain doesn't support linking generated objects to target, + // so supporting generating sources is the best we can do. This is enough for mocs. + + if (!isSubdirs) { + writeExtraTargets(t); + writeExtraCompilerTargets(t); + + t << CREATE_TEMPS_TARGET ":" << endl; + // generate command lines like this ... + // -@ if NOT EXIST ".\somedir" mkdir ".\somedir" + for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + t << "\t-@ if NOT EXIST \"" << QDir::toNativeSeparators(values.at(i)) << "\\tmp\" mkdir \"" + << QDir::toNativeSeparators(values.at(i)) << "\\tmp\"" << endl; + } + } + t << endl; + + // Note: EXTENSION_CLEAN will get called many times when doing reallyclean + // This is why the "2> NUL" gets appended to generated clean targets in makefile.cpp. + t << EXTENSION_CLEAN ": " COMPILER_CLEAN_TARGET << endl; + for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + QStringList dirsToClean = it.value(); + generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", "/tmp"); + } + t << endl; + + t << PRE_TARGETDEPS_TARGET ":" + << MAKEFILE_DEPENDENCY_SEPARATOR GENERATED_SOURCES_TARGET + << MAKEFILE_DEPENDENCY_SEPARATOR ALL_SOURCE_DEPS_TARGET; + if (project->values("PRE_TARGETDEPS").size()) + t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("PRE_TARGETDEPS").join(MAKEFILE_DEPENDENCY_SEPARATOR); + t << endl << endl; + t << GENERATED_SOURCES_TARGET ":"; + if (project->values("GENERATED_SOURCES").size()) + t << MAKEFILE_DEPENDENCY_SEPARATOR << project->values("GENERATED_SOURCES").join(MAKEFILE_DEPENDENCY_SEPARATOR); + t << endl << endl; + t << ALL_SOURCE_DEPS_TARGET ":"; + + QStringList allDeps; + for(QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { + QString currentSourcePath = it.key(); + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + // we need additional check + QString sourceFile = currentSourcePath + "/" + values.at(i); + QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile)); + appendIfnotExist(allDeps, deps); + } + } + + foreach(QString item, allDeps) { + t << MAKEFILE_DEPENDENCY_SEPARATOR << item; + } + t << endl << endl; + + // Post link operations + t << FINALIZE_TARGET ":" << endl; + if(!project->isEmpty("QMAKE_POST_LINK")) { + t << '\t' << var("QMAKE_POST_LINK"); + t << endl; + } + t << endl; + } + else { + QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); + writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets); + qDeleteAll(subtargets); + } + + writeDeploymentTargets(t); + + t << "dodistclean:" << endl; + foreach(QString item, project->values("SUBDIRS")) { + bool fromFile = false; + QString fixedItem; + if(!project->isEmpty(item + ".file")) { + fixedItem = project->first(item + ".file"); + fromFile = true; + } else if(!project->isEmpty(item + ".subdir")) { + fixedItem = project->first(item + ".subdir"); + fromFile = false; + } else { + fromFile = item.endsWith(Option::pro_ext); + fixedItem = item; + } + QFileInfo fi(fileInfo(fixedItem)); + if (!fromFile) { + t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.canonicalFilePath()) << "\\Makefile\" dodistclean" << endl; + } else { + QString itemName = fi.fileName(); + int extIndex = itemName.lastIndexOf(Option::pro_ext); + if (extIndex) + fixedItem = fi.canonicalPath() + "/" + QString("Makefile.") + itemName.mid(0,extIndex); + t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl; + } + + } + + generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).canonicalFilePath()); // bld.inf + generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup + generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean + QStringList fixedFiles; + QStringList fixedDirs; + foreach(QString item, generatedFiles) { + QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).canonicalFilePath()); + if (!fixedFiles.contains(fixedItem)) { + fixedFiles << fixedItem; + } + } + foreach(QString item, generatedDirs) { + QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).canonicalFilePath()); + if (!fixedDirs.contains(fixedItem)) { + fixedDirs << fixedItem; + } + } + generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", ""); + generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", ""); + t << endl; + + t << "distclean: clean dodistclean" << endl; + t << endl; + t << "clean: $(ABLD)" << endl; + t << "\t-$(ABLD)" << testClause << " reallyclean" << endl; + t << "\t-bldmake clean" << endl; + t << endl; + + // create execution target + if (debugPlatforms.contains("winscw") && getTargetExtension() == "exe") { + t << "run:" << endl; + t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; + } +} + +bool SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +{ + // We don't use extensions for anything in abld + Q_UNUSED(t); + return true; +} + +bool SymbianAbldMakefileGenerator::writeDeploymentTargets(QTextStream &t) +{ + t << WINSCW_DEPLOYMENT_TARGET ":" << endl; + + QString remoteTestPath = epocRoot() + QLatin1String("epoc32\\winscw\\c\\private\\") + privateDirUid; // default 4 OpenC; 4 all Symbian too + DeploymentList depList; + initProjectDeploySymbian( project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles ); + + if (depList.size()) + t << "\t-echo Deploying changed files..." << endl; + + for (int i=0; i<depList.size(); ++i) { + // xcopy prompts for selecting file or directory if target doesn't exist, + // and doesn't provide switch to force file selection. It does provide dir forcing, though, + // so strip the last part of the destination. + t << "\t-$(XCOPY) \"" << depList.at(i).from << "\" \"" << depList.at(i).to.left(depList.at(i).to.lastIndexOf("\\")+1) << "\"" << endl; + } + + t << endl; + + t << WINSCW_DEPLOYMENT_CLEAN_TARGET ":" << endl; + QStringList cleanList; + for (int i=0; i<depList.size(); ++i) { + cleanList.append(depList.at(i).to); + } + generateCleanCommands(t, cleanList, "$(DEL_FILE)", "", "", ""); + + // Note: If deployment creates any directories, they will not get deleted after cleanup. + // To do this in robust fashion could be quite complex. + + t << endl; + + return true; +} + +void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) +{ + // Normally emulator deployment gets done via regular makefile, but since subdirs + // do not get that, special deployment only makefile is generated for them if needed. + if(getTargetExtension() != "subdirs" || addDeploymentExtension) { + QString gnuMakefileName = QLatin1String("Makefile_") + uid3; + removeSpecialCharacters(gnuMakefileName); + gnuMakefileName.append(".mk"); + t << "gnumakefile " << gnuMakefileName << endl; + } +} + diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h new file mode 100644 index 0000000..d323813 --- /dev/null +++ b/qmake/generators/symbian/symmake_abld.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SYMMAKE_ABLD_H +#define SYMMAKE_ABLD_H + +#include <symmake.h> + +QT_BEGIN_NAMESPACE + +class SymbianAbldMakefileGenerator : public SymbianMakefileGenerator { + +protected: + + // Inherited from parent + virtual bool writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); + virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly); + virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); + + bool writeDeploymentTargets(QTextStream &t); + +public: + + SymbianAbldMakefileGenerator(); + ~SymbianAbldMakefileGenerator(); + +}; + +#endif // SYMMAKE_ABLD_H + diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp new file mode 100644 index 0000000..7b739c7 --- /dev/null +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -0,0 +1,447 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "symmake_sbsv2.h" +#include "initprojectdeploy_symbian.h" + +#include <qstring.h> +#include <qstringlist.h> +#include <qdir.h> +#include <qdatetime.h> +#include <qdebug.h> + +SymbianSbsv2MakefileGenerator::SymbianSbsv2MakefileGenerator() : SymbianMakefileGenerator() { } +SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { } + +#define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt" +#define FLM_SOURCE_DIR "/mkspecs/symbian-sbsv2/flm/qt" + +// Copies Qt FLMs to correct location under epocroot. +// This is not done by configure as it is possible to change epocroot after configure. +void SymbianSbsv2MakefileGenerator::exportFlm() +{ + static bool flmExportDone = false; + + if (!flmExportDone) { + QDir sourceDir = QDir(QLibraryInfo::location(QLibraryInfo::PrefixPath) + FLM_SOURCE_DIR); + QFileInfoList sourceInfos = sourceDir.entryInfoList(QDir::Files); + + QDir destDir(epocRoot() + FLM_DEST_DIR); + if (!destDir.exists()) { + if (destDir.mkpath(destDir.absolutePath())) + generatedDirs << destDir.absolutePath(); + } + + foreach(QFileInfo item, sourceInfos) { + QFileInfo destInfo = QFileInfo(destDir.absolutePath() + "/" + item.fileName()); + if (!destInfo.exists() || destInfo.lastModified() < item.lastModified()) { + if (destInfo.exists()) + QFile::remove(destInfo.absoluteFilePath()); + if (QFile::copy(item.absoluteFilePath(), destInfo.absoluteFilePath())) + generatedFiles << destInfo.absoluteFilePath(); + else + fprintf(stderr, "Error: Could not copy '%s' -> '%s'\n", qPrintable(item.absoluteFilePath()), qPrintable(destInfo.absoluteFilePath())); + } + } + flmExportDone = true; + } +} + +bool SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) +{ + // Can't use extension makefile with sbsv2 + Q_UNUSED(wrapperFileName); + Q_UNUSED(deploymentOnly); + return true; +} + +void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile) +{ + QStringList allPlatforms; + foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) { + allPlatforms << platform.toLower(); + } + + QStringList debugPlatforms = allPlatforms; + QStringList releasePlatforms = allPlatforms; + releasePlatforms.removeAll("winscw"); // No release for emulator + + bool isSubdirs = getTargetExtension() == "subdirs"; + + QString testClause; + if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) + testClause = QLatin1String(".test"); + else + testClause = QLatin1String(""); + + QTextStream t(&wrapperFile); + + t << "# ==============================================================================" << endl; + t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; + t << QDateTime::currentDateTime().toString() << endl; + t << "# This file is generated by qmake and should not be modified by the" << endl; + t << "# user." << endl; + t << "# Name : " << wrapperFile.fileName() << endl; + t << "# Description : Wrapper Makefile for calling Symbian build tools" << endl; + t << "#" << endl; + t << "# ==============================================================================" << "\n" << endl; + t << endl; + QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); + if(ofile.lastIndexOf(Option::dir_sep) != -1) + ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); + t << "MAKEFILE = " << ofile << endl; + t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "DEBUG_PLATFORMS = " << debugPlatforms.join(" ") << endl; + t << "RELEASE_PLATFORMS = " << releasePlatforms.join(" ") << endl; + t << "MAKE = make" << endl; + t << "SBS = sbs" << endl; + t << endl; + t << "DEFINES" << '\t' << " = " + << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") + << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") + << varGlue("DEFINES","-D"," -D","") << endl; + + t << "INCPATH" << '\t' << " = "; + + for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + t << " -I\"" << values.at(i) << "\" "; + } + } + t << endl; + t << "first: default" << endl; + if (debugPlatforms.contains("winscw")) + t << "default: debug-winscw"; + else if (debugPlatforms.contains("armv5")) + t << "default: debug-armv5"; + else if (debugPlatforms.size()) + t << "default: debug-" << debugPlatforms.first(); + else + t << "default: all"; + + t << endl; + if (!isPrimaryMakefile) { + t << "all:" << endl; + } else { + t << "all: debug release" << endl; + t << endl; + t << "qmake:" << endl; + t << "\t$(QMAKE) -spec symbian-sbsv2 -o \"" << fileInfo(Option::output.fileName()).fileName() + << "\" \"" << project->projectFile() << "\"" << endl; + t << endl; + t << BLD_INF_FILENAME ":" << endl; + t << "\t$(QMAKE)" << endl; + t << endl; + + t << "debug: " << BLD_INF_FILENAME << endl; + foreach(QString item, debugPlatforms) { + t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl; + } + t << endl; + t << "release: " << BLD_INF_FILENAME << endl; + foreach(QString item, releasePlatforms) { + t << "\t$(SBS) -c " << item << "_urel" << testClause << endl; + } + t << endl; + + // For more specific builds, targets are in this form: build-platform, e.g. release-armv5 + foreach(QString item, debugPlatforms) { + t << "debug-" << item << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl; + } + + foreach(QString item, releasePlatforms) { + t << "release-" << item << ": " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) -c " << item << "_urel" << testClause << endl; + } + + t << endl; + t << "export: " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) export" << endl; + t << endl; + + t << "cleanexport: " << BLD_INF_FILENAME << endl; + t << "\t$(SBS) cleanexport" << endl; + t << endl; + + } + + // Add all extra targets including extra compiler targest also to wrapper makefile, + // even though many of them may have already been added to bld.inf as FLMs. + // This is to enable use of targets like 'mocables', which call targets generated by extra compilers. + if (!isSubdirs) { + t << extraTargetsCache; + t << extraCompilersCache; + } + else { + QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); + writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets); + qDeleteAll(subtargets); + } + + t << "dodistclean:" << endl; + foreach(QString item, project->values("SUBDIRS")) { + bool fromFile = false; + QString fixedItem; + if(!project->isEmpty(item + ".file")) { + fixedItem = project->first(item + ".file"); + fromFile = true; + } else if(!project->isEmpty(item + ".subdir")) { + fixedItem = project->first(item + ".subdir"); + fromFile = false; + } else { + fromFile = item.endsWith(Option::pro_ext); + fixedItem = item; + } + QFileInfo fi(fileInfo(fixedItem)); + if (!fromFile) { + t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl; + } else { + QString itemName = fi.fileName(); + int extIndex = itemName.lastIndexOf(Option::pro_ext); + if (extIndex) + fixedItem = fi.absolutePath() + "/" + QString("Makefile.") + itemName.mid(0,extIndex); + t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fixedItem) << "\" dodistclean" << endl; + } + + } + + generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf + generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup + generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean + QStringList fixedFiles; + QStringList fixedDirs; + foreach(QString item, generatedFiles) { + QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); + if (!fixedFiles.contains(fixedItem)) { + fixedFiles << fixedItem; + } + } + foreach(QString item, generatedDirs) { + QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); + if (!fixedDirs.contains(fixedItem)) { + fixedDirs << fixedItem; + } + } + generateCleanCommands(t, fixedFiles, "$(DEL_FILE)", "", "", ""); + generateCleanCommands(t, fixedDirs, "$(DEL_DIR)", "", "", ""); + t << endl; + + t << "distclean: clean dodistclean" << endl; + t << endl; + t << "clean: " << BLD_INF_FILENAME << endl; + t << "\t-$(SBS) reallyclean" << endl; + t << endl; + + // create execution target + if (debugPlatforms.contains("winscw") && getTargetExtension() == "exe") { + t << "run:" << endl; + t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; + } +} + +bool SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +{ + // Makes sure we have needed FLMs in place. + exportFlm(); + + // Parse extra compilers data + QStringList defines; + QStringList incPath; + + defines << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") + << varGlue("QMAKE_COMPILER_DEFINES", "-D", "-D", " ") + << varGlue("DEFINES","-D"," -D",""); + for(QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + incPath << QLatin1String(" -I\"") + values.at(i) + "\""; + } + } + + // Write extra compilers and targets to initialize QMAKE_ET_* variables + // Cache results to avoid duplicate calls when creating wrapper makefile + QTextStream extraCompilerStream(&extraCompilersCache); + QTextStream extraTargetStream(&extraTargetsCache); + writeExtraCompilerTargets(extraCompilerStream); + writeExtraTargets(extraTargetStream); + + // Figure out everything the target depends on as we don't want to run extra targets that + // are not necessary. + QStringList allPreDeps; + foreach(QString item, project->values("PRE_TARGETDEPS")) { + // Predeps get mangled in windows, so fix them to more sbsv2 friendly format +#if defined(Q_OS_WIN) + if (item.mid(1,1) == ":") + item = item.mid(0,1).toUpper().append(item.mid(1)); // Fix drive to uppercase +#endif + item.replace("\\", "/"); + allPreDeps << escapeDependencyPath(item); + } + + foreach (QString item, project->values("GENERATED_SOURCES")) { + allPreDeps.append(fileInfo(item).absoluteFilePath()); + } + + for(QMap<QString, QStringList>::iterator it = sources.begin(); it != sources.end(); ++it) { + QString currentSourcePath = it.key(); + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + QString sourceFile = currentSourcePath + "/" + values.at(i); + QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile)); + foreach(QString depItem, deps) { + appendIfnotExist(allPreDeps, fileInfo(depItem).absoluteFilePath()); + } + } + } + + // Write FLM rules for all extra targets and compilers that we depend on to build the target. + QStringList extraTargets; + extraTargets << project->values("QMAKE_EXTRA_TARGETS") << project->values("QMAKE_EXTRA_COMPILERS"); + foreach(QString item, extraTargets) { + foreach(QString targetItem, project->values(QLatin1String("QMAKE_ET_PARSED_TARGETS.") + item)) { + // Make sure targetpath is absolute + QString absoluteTarget = fileInfo(targetItem).absoluteFilePath(); + if (allPreDeps.contains(absoluteTarget)) { + QStringList deps = project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + item + targetItem); + //QString depsItem = project->values(QLatin1String("QMAKE_ET_PARSED_DEPS.") + item + targetItem).join(" "); + QString commandItem = project->values(QLatin1String("QMAKE_ET_PARSED_CMD.") + item + targetItem).join(" "); + + + // Make sure all deps paths are absolute + QString absoluteDeps; + foreach (QString depItem, deps) { + if (!depItem.isEmpty()) { + absoluteDeps.append(fileInfo(depItem).absoluteFilePath()); + absoluteDeps.append(" "); + } + } + + t << "START EXTENSION qt/qmake_extra_pre_targetdep" << endl; + t << "OPTION PREDEP_TARGET " << absoluteTarget << endl; + t << "OPTION DEPS " << absoluteDeps << endl; + //t << "OPTION DEPS " << depsItem << endl; + + if (commandItem.indexOf("$(INCPATH)") != -1) + commandItem.replace("$(INCPATH)", incPath.join(" ")); + if (commandItem.indexOf("$(DEFINES)") != -1) + commandItem.replace("$(DEFINES)", defines.join(" ")); + + // Sbsv2 strips all backslashes (even doubles ones) from option parameters, so just replace them with slashes + // Problem: If some command actually needs backslashes for something else than dir separator, we are out of luck... + commandItem.replace("\\", "/"); + t << "OPTION COMMAND " << commandItem << endl; + t << "END" << endl; + } + } + } + + t << endl; + + // Write winscw deployment rules + QString remoteTestPath = epocRoot() + QLatin1String("epoc32/winscw/c/private/") + privateDirUid; + DeploymentList depList; + initProjectDeploySymbian( project, depList, remoteTestPath, false, QLatin1String("winscw"), QLatin1String("udeb"), generatedDirs, generatedFiles ); + + t << "#if defined(WINSCW)" << endl; + for (int i=0; i<depList.size(); ++i) { + t << "START EXTENSION qt/qmake_emulator_deployment" << endl; + QString fromItem = depList.at(i).from; + QString toItem = depList.at(i).to; + fromItem.replace("\\", "/"); + toItem.replace("\\", "/"); +#if defined(Q_OS_WIN) + toItem.prepend(QDir::current().absolutePath().left(2)); // add drive +#endif + t << "OPTION DEPLOY_SOURCE " << fromItem << endl; + t << "OPTION DEPLOY_TARGET " << toItem << endl; + t << "END" << endl; + } + t << "#endif" << endl; + + t << endl; + + // ### TODO: Linux emulator (platsim?) deployment + + // Write post link rules + if(!project->isEmpty("QMAKE_POST_LINK")) { + t << "START EXTENSION qt/qmake_post_link" << endl; + t << "OPTION POST_LINK_CMD " << var("QMAKE_POST_LINK") << endl; + t << "OPTION LINK_TARGET " << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".").append(getTargetExtension())) << endl; + t << "END" << endl; + t << endl; + } + + // Application icon generation + QStringList icons = project->values("ICON"); + if (icons.size()) { + QString icon = icons.first(); + if (icons.size() > 1) + fprintf(stderr, "Warning: Only first icon specified in ICON variable is used: '%s'.", icon); + + t << "START EXTENSION s60/mifconv" << endl; + + QFileInfo iconInfo = fileInfo(icon); + QString iconPath = iconInfo.path(); + QString iconFile = iconInfo.baseName(); + + t << "OPTION SOURCES -c32 " << iconFile << endl; + t << "OPTION SOURCEDIR " << iconPath << endl; + t << "OPTION TARGETFILE " << uid3 << ".mif" << endl; + t << "OPTION SVGENCODINGVERSION 3" << endl; // Compatibility with S60 3.1 devices and up + t << "END" << endl; + } + + t << endl; + + return true; +} + +void SymbianSbsv2MakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) +{ + // We don't generate extension makefile in sbsb2 + Q_UNUSED(t); + Q_UNUSED(addDeploymentExtension); +} + diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h new file mode 100644 index 0000000..e55d177 --- /dev/null +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SYMMAKE_SBSV2_H +#define SYMMAKE_SBSV2_H + +#include <symmake.h> + +QT_BEGIN_NAMESPACE + +class SymbianSbsv2MakefileGenerator : public SymbianMakefileGenerator { + +protected: + + // Inherited from parent + virtual bool writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); + virtual bool writeMkFile(const QString& wrapperFileName, bool deploymentOnly); + virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); + +public: + + SymbianSbsv2MakefileGenerator(); + ~SymbianSbsv2MakefileGenerator(); + +private: + void exportFlm(); + + QString extraTargetsCache; + QString extraCompilersCache; +}; + +#endif // SYMMAKE_SBSV2_H + diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 44905ed..44caa68 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp @@ -1123,6 +1123,20 @@ QString DspMakefileGenerator::writeBuildstepForFileForConfig(const QString &file fileOut); dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(config->canExecute(dep_cmd)) { +#if defined(Q_CC_MWERKS) && defined(Q_OS_WIN32) + QPopen procPipe; + if( procPipe.init(dep_cmd.toLatin1().constData(), "r") ) { + QString indeps; + while(true) { + int read_in = procPipe.fread(buff, 255); + if ( !read_in ) + break; + indeps += QByteArray(buff, read_in); + } + if(!indeps.isEmpty()) + step.deps += config->fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); + } +#else if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1135,6 +1149,7 @@ QString DspMakefileGenerator::writeBuildstepForFileForConfig(const QString &file if(!indeps.isEmpty()) step.deps += config->fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); } +#endif } } diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 1dafd98..9d3fa67 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2215,6 +2215,26 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) Option::fixPathToLocalOS(inFile, true, false), out); if(Project->canExecute(dep_cmd)) { +#if defined(Q_CC_MWERKS) && defined(Q_OS_WIN32) + QPopen procPipe; + if( procPipe.init(dep_cmd.toLatin1().constData(), "r") ) { + QString indeps; + while(true) { + int read_in = procPipe.fread(buff, 255); + if ( !read_in ) + break; + indeps += QByteArray(buff, read_in); + } + if(!indeps.isEmpty()) { + QStringList extradeps = indeps.split(QLatin1Char('\n')); + for (int i = 0; i < extradeps.count(); ++i) { + QString dd = extradeps.at(i).simplified(); + if (!dd.isEmpty()) + deps += Project->fileFixify(dd); + } + } + } +#else if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -2233,6 +2253,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) } } } +#endif } } for (int i = 0; i < deps.count(); ++i) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 079aa9f..303e3e1 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -1448,6 +1448,20 @@ void VcprojGenerator::initResourceFiles() dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); if(canExecute(dep_cmd)) { +#if defined(Q_CC_MWERKS) && defined(Q_OS_WIN32) + QPopen procPipe; + if( procPipe.init(dep_cmd.toLatin1().constData(), "r") ) { + QString indeps; + while(true) { + int read_in = procPipe.fread(buff, 255); + if ( !read_in ) + break; + indeps += QByteArray(buff, read_in); + } + if(!indeps.isEmpty()) + deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); + } +#else if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { QString indeps; while(!feof(proc)) { @@ -1460,6 +1474,7 @@ void VcprojGenerator::initResourceFiles() if(!indeps.isEmpty()) deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); } +#endif } } vcProject.ResourceFiles.addFiles(deps); diff --git a/qmake/project.cpp b/qmake/project.cpp index 047a5e3..0a5e9a3 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -52,6 +52,8 @@ #include <qtextstream.h> #include <qstack.h> #include <qhash.h> +#include <qxmlstream.h> +#include <qsettings.h> #include <qdebug.h> #ifdef Q_OS_UNIX #include <unistd.h> @@ -63,8 +65,12 @@ #include <stdlib.h> #ifdef Q_OS_WIN32 +#if defined(Q_CC_MWERKS) +#include "qpopen.h" +#else #define QT_POPEN _popen #define QT_PCLOSE _pclose +#endif #else #define QT_POPEN popen #define QT_PCLOSE pclose @@ -76,7 +82,8 @@ QT_BEGIN_NAMESPACE enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST, E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION, E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND, - E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE }; + E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE, + E_GENERATE_TEST_UID, E_SIZE }; QMap<QString, ExpandFunc> qmake_expandFunctions() { static QMap<QString, ExpandFunc> *qmake_expand_functions = 0; @@ -107,6 +114,8 @@ QMap<QString, ExpandFunc> qmake_expandFunctions() qmake_expand_functions->insert("files", E_FILES); qmake_expand_functions->insert("prompt", E_PROMPT); qmake_expand_functions->insert("replace", E_REPLACE); + qmake_expand_functions->insert("generate_test_uid", E_GENERATE_TEST_UID); + qmake_expand_functions->insert("size", E_SIZE); } return *qmake_expand_functions; } @@ -588,6 +597,69 @@ static void qmake_error_msg(const QString &msg) msg.toLatin1().constData()); } +enum isForSymbian_enum +{ + isForSymbian_NOT_SET = -1, + isForSymbian_FALSE = 0, + isForSymbian_ABLD = 1, + isForSymbian_SBSV2 = 2, +}; + +static isForSymbian_enum isForSymbian_value = isForSymbian_NOT_SET; + +// Checking for symbian build is primarily determined from the qmake spec, +// but if that is not specified, detect if symbian is the default spec +// by checking the MAKEFILE_GENERATOR variable value. +static void init_isForSymbian(const QMap<QString, QStringList>& vars) +{ + if (isForSymbian_value != isForSymbian_NOT_SET) + return; + + QString spec = QFileInfo(Option::mkfile::qmakespec).fileName(); + if (spec.startsWith("symbian-abld", Qt::CaseInsensitive)) { + isForSymbian_value = isForSymbian_ABLD; + return; + } + if (spec.startsWith("symbian-sbsv2", Qt::CaseInsensitive)) { + isForSymbian_value = isForSymbian_SBSV2; + return; + } + + QStringList generatorList = vars["MAKEFILE_GENERATOR"]; + + if (!generatorList.isEmpty()) { + QString generator = generatorList.first(); + if (generator.startsWith("SYMBIAN_ABLD")) + isForSymbian_value = isForSymbian_ABLD; + else if (generator.startsWith("SYMBIAN_SBSV2")) + isForSymbian_value = isForSymbian_SBSV2; + else + isForSymbian_value = isForSymbian_FALSE; + } else { + isForSymbian_value = isForSymbian_FALSE; + } +} + +bool isForSymbian() +{ + // If isForSymbian_value has not been initialized explicitly yet, + // call initializer with dummy map to check qmake spec. + if (isForSymbian_value == isForSymbian_NOT_SET) + init_isForSymbian(QMap<QString, QStringList>()); + + return (isForSymbian_value == isForSymbian_ABLD || isForSymbian_value == isForSymbian_SBSV2); +} + +bool isForSymbianSbsv2() +{ + // If isForSymbian_value has not been initialized explicitly yet, + // call initializer with dummy map to check qmake spec. + if (isForSymbian_value == isForSymbian_NOT_SET) + init_isForSymbian(QMap<QString, QStringList>()); + + return (isForSymbian_value == isForSymbian_SBSV2); +} + /* 1) environment variable QMAKEFEATURES (as separated by colons) 2) property variable QMAKEFEATURES (as separated by colons) @@ -614,11 +686,21 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0) concat << base_concat + QDir::separator() + "unix"; break; case Option::TARG_UNIX_MODE: - concat << base_concat + QDir::separator() + "unix"; - break; + { + if (isForSymbian()) + concat << base_concat + QDir::separator() + "symbian"; + else + concat << base_concat + QDir::separator() + "unix"; + break; + } case Option::TARG_WIN_MODE: - concat << base_concat + QDir::separator() + "win32"; - break; + { + if (isForSymbian()) + concat << base_concat + QDir::separator() + "symbian"; + else + concat << base_concat + QDir::separator() + "win32"; + break; + } case Option::TARG_MAC9_MODE: concat << base_concat + QDir::separator() + "mac"; concat << base_concat + QDir::separator() + "mac9"; @@ -1475,6 +1557,9 @@ QMakeProject::read(uchar cmd) fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.toLatin1().constData()); return false; } + + init_isForSymbian(base_vars); + if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty()) { debug_msg(1, "QMAKECACHE file: reading %s", Option::mkfile::cachefile.toLatin1().constData()); read(Option::mkfile::cachefile, base_vars); @@ -1609,25 +1694,34 @@ QMakeProject::isActiveConfig(const QString &x, bool regex, QMap<QString, QString else if(x == "false") return false; + static QString spec; + if(spec.isEmpty()) + spec = QFileInfo(Option::mkfile::qmakespec).fileName(); + + // Symbian is an exception to how scopes are resolved. Since we do not + // have a separate target mode for Symbian, but we expect the scope to resolve + // on other platforms we base it entirely on the mkspec. This means that + // using a mkspec starting with 'symbian*' will resolve both the 'symbian' + // and the 'unix' (because of Open C) scopes to true. + if(isForSymbian() && (x == "symbian" || x == "unix")) + return true; + //mkspecs if((Option::target_mode == Option::TARG_MACX_MODE || Option::target_mode == Option::TARG_QNX6_MODE || Option::target_mode == Option::TARG_UNIX_MODE) && x == "unix") - return true; + return !isForSymbian(); else if(Option::target_mode == Option::TARG_MACX_MODE && x == "macx") - return true; + return !isForSymbian(); else if(Option::target_mode == Option::TARG_QNX6_MODE && x == "qnx6") - return true; + return !isForSymbian(); else if(Option::target_mode == Option::TARG_MAC9_MODE && x == "mac9") - return true; + return !isForSymbian(); else if((Option::target_mode == Option::TARG_MAC9_MODE || Option::target_mode == Option::TARG_MACX_MODE) && x == "mac") - return true; + return !isForSymbian(); else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32") - return true; + return !isForSymbian(); QRegExp re(x, Qt::CaseSensitive, QRegExp::Wildcard); - static QString spec; - if(spec.isEmpty()) - spec = QFileInfo(Option::mkfile::qmakespec).fileName(); if((regex && re.exactMatch(spec)) || (!regex && spec == x)) return true; #ifdef Q_OS_UNIX @@ -1718,6 +1812,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL if(file.indexOf(Option::dir_sep) == -1 || !QFile::exists(file)) { static QStringList *feature_roots = 0; if(!feature_roots) { + init_isForSymbian(base_vars); feature_roots = new QStringList(qmake_feature_paths(prop)); qmakeAddCacheClear(qmakeDeleteCacheClear_QStringList, (void**)&feature_roots); } @@ -2158,11 +2253,33 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list, } else { QMakeProjectEnv env(place); char buff[256]; - FILE *proc = QT_POPEN(args[0].toLatin1(), "r"); bool singleLine = true; if(args.count() > 1) singleLine = (args[1].toLower() == "true"); QString output; +#if defined(Q_CC_MWERKS) && defined(Q_OS_WIN32) + QPopen procPipe; + if( !procPipe.init(args[0].toLatin1(), "r") ) { + fprintf(stderr, "%s:%d system(%s) failed.\n", + parser.file.toLatin1().constData(), + parser.line_no, + qPrintable(args[0])); + } + + while(true) { + int read_in = procPipe.fread(buff, 255); + if ( !read_in ) + break; + for(int i = 0; i < read_in; ++i) { + if((singleLine && buff[i] == '\n') || buff[i] == '\t') + buff[i] = ' '; + } + buff[read_in] = '\0'; + output += buff; + } + ret += split_value_list(output); +#else + FILE *proc = QT_POPEN(args[0].toLatin1(), "r"); while(proc && !feof(proc)) { int read_in = int(fread(buff, 1, 255, proc)); if(!read_in) @@ -2177,6 +2294,7 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list, ret += split_value_list(output); if(proc) QT_PCLOSE(proc); +#endif } break; } case E_UNIQUE: { @@ -2311,6 +2429,32 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list, ret += it->replace(before, after); } break; } + case E_GENERATE_TEST_UID: { + if(args.count() != 1) { + fprintf(stderr, "%s:%d: generate_test_uid(targetname) requires one argument.\n", + parser.file.toLatin1().constData(), parser.line_no); + } else { + QString target = args[0]; + + QString currPath = qmake_getpwd(); + target.prepend("/").prepend(currPath); + + + QString tmp = generate_test_uid(target); + + ret += tmp; + } + break; } + case E_SIZE: { + if(args.count() != 1) { + fprintf(stderr, "%s:%d: size(var) requires one argument.\n", + parser.file.toLatin1().constData(), parser.line_no); + } else { + //QString target = args[0]; + int size = values(args[0]).size(); + ret += QString::number(size); + } + break; } default: { #ifdef QTSCRIPT_SUPPORT { @@ -3185,9 +3329,161 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList } else if (var == QLatin1String("QMAKE_DIR_SEP")) { if (place[var].isEmpty()) return values("DIR_SEPARATOR", place); + } else if (var == QLatin1String("EPOCROOT")) { + if (place[var].isEmpty()) + place[var] = QStringList(epocRoot()); } //qDebug("REPLACE [%s]->[%s]", qPrintable(var), qPrintable(place[var].join("::"))); return place[var]; } + +// UIDs starting with 0xE are test UIDs in symbian +QString generate_test_uid(const QString& target) { + QString tmp = generate_uid(target); + tmp.replace(0,1,"E"); + tmp.prepend("0x"); + + // printf("generate_test_uid for %s is %s \n", qPrintable(target), qPrintable(tmp)); + + return tmp; +} + + +// UIDs starting with 0xE are test UIDs in symbian +QString generate_uid(const QString& target) { + + static QMap<QString, QString> targetToUid; + + QString tmp = targetToUid[target]; + + if(!tmp.isEmpty()) { + // printf("generate_uid for %s is %s \n", qPrintable(target), qPrintable(tmp)); + return tmp; + } + + unsigned long hash = 5381; + int c; + + for(int i = 0; i < target.size(); ++i) { + c = target.at(i).toAscii(); + hash ^= c + ((c-i) << i%20) + ((c+i) << (i+5)%20) + ((c-2*i) << (i+10)%20) + ((c+2*i) << (i+15)%20); + } + + tmp.setNum(hash, 16); + for(int i = tmp.size(); i < 8; ++i) + tmp.prepend("0"); + +#if 0 + static QMap<QString, QString> uidConflictCheckList; + QString testStr = tmp; + testStr.replace(0,1,"E"); // Simulate actual UID generation + if (uidConflictCheckList.contains(testStr)) { + printf("\n\n!!!! generated duplicate uid for %s is %s <-> %s !!!!\n\n\n", + qPrintable(target), + qPrintable(testStr), + qPrintable(uidConflictCheckList.value(testStr))); + } + uidConflictCheckList.insert(testStr, target); + printf("generate_uid for %s is %s \n", qPrintable(target), qPrintable(tmp)); +#endif + + targetToUid[target] = tmp; + + return tmp; +} + +static void fixEpocRootStr(QString& path) +{ + path.replace("\\","/"); + + if (path.size() > 1 && path[1] == QChar(':')) { + path = path.mid(2); + } + + if (!path.size() || path[path.size()-1] != QChar('/')) { + path += QChar('/'); + } +} + +#define SYMBIAN_SDKS_KEY "HKEY_LOCAL_MACHINE\\Software\\Symbian\\EPOC SDKs" + +static QString epocRootStr; + +QString epocRoot() +{ + if (!epocRootStr.isEmpty()) + { + return epocRootStr; + } + + // First, check the env variable + epocRootStr = qgetenv("EPOCROOT"); + + if (epocRootStr.isEmpty()) { + // No EPOCROOT set, check the default device + // First check EPOCDEVICE env variable + QString defaultDevice = qgetenv("EPOCDEVICE"); + + // Check the windows registry via QSettings for devices.xml path + QSettings settings(SYMBIAN_SDKS_KEY, QSettings::NativeFormat); + QString devicesXmlPath = settings.value("CommonPath").toString(); + + if (!devicesXmlPath.isEmpty()) { + // Parse xml for correct device + devicesXmlPath += "/devices.xml"; + QFile devicesFile(devicesXmlPath); + if (devicesFile.open(QIODevice::ReadOnly)) { + QXmlStreamReader xml(&devicesFile); + while (!xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement() && xml.name() == "devices") { + if (xml.attributes().value("version") == "1.0") { + // Look for correct device + while (!(xml.isEndElement() && xml.name() == "devices") && !xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement() && xml.name() == "device") { + if ((defaultDevice.isEmpty() && xml.attributes().value("default") == "yes") || + (!defaultDevice.isEmpty() && (xml.attributes().value("id").toString() + QString(":") + xml.attributes().value("name").toString()) == defaultDevice)) { + // Found the correct device + while (!(xml.isEndElement() && xml.name() == "device") && !xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement() && xml.name() == "epocroot") { + epocRootStr = xml.readElementText(); + fixEpocRootStr(epocRootStr); + return epocRootStr; + } + } + xml.raiseError("No epocroot element found"); + } + } + } + } else { + xml.raiseError("Invalid 'devices' element version"); + } + } + } + if (xml.hasError()) { + fprintf(stderr, "ERROR: \"%s\" when parsing devices.xml\n", qPrintable(xml.errorString())); + } + } else { + fprintf(stderr, "Could not open devices.xml (%s)\n", qPrintable(devicesXmlPath)); + } + } else { + fprintf(stderr, "Could not retrieve " SYMBIAN_SDKS_KEY " setting\n"); + } + + fprintf(stderr, "Failed to determine epoc root.\n"); + if (!defaultDevice.isEmpty()) + fprintf(stderr, "The device indicated by EPOCDEVICE environment variable (%s) could not be found.\n", qPrintable(defaultDevice)); + fprintf(stderr, "Either set EPOCROOT or EPOCDEVICE environment variable to a valid value, or provide a default Symbian device.\n"); + + // No valid device found; set epocroot to "/" + epocRootStr = QLatin1String("/"); + } + + fixEpocRootStr(epocRootStr); + return epocRootStr; +} + QT_END_NAMESPACE diff --git a/qmake/project.h b/qmake/project.h index edc9ecf..a079e42 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -203,6 +203,13 @@ inline QString QMakeProject::first(const QString &v) inline QMap<QString, QStringList> &QMakeProject::variables() { return vars; } +// Helper functions needed for Symbian .mmp files and deployment +QString generate_test_uid(const QString& target); +QString generate_uid(const QString& target); +QString epocRoot(); +bool isForSymbian(); +bool isForSymbianSbsv2(); + QT_END_NAMESPACE #endif // PROJECT_H diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 9147ee8..2304fab 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -13,14 +13,29 @@ SOURCES += project.cpp property.cpp main.cpp generators/makefile.cpp \ generators/xmloutput.cpp generators/win32/borland_bmake.cpp \ generators/win32/msvc_nmake.cpp generators/projectgenerator.cpp \ generators/win32/msvc_dsp.cpp generators/win32/msvc_vcproj.cpp \ - generators/win32/msvc_objectmodel.cpp + generators/win32/msvc_objectmodel.cpp \ + generators/symbian/symmake.cpp \ + generators/symbian/symmake_abld.cpp \ + generators/symbian/symmake_sbsv2.cpp \ + generators/symbian/initprojectdeploy_symbian.cpp + +# MWC does not provide an implementation of popen() so fake it. +win32-mwc { + SOURCES += qpopen.cpp \ +} + + HEADERS += project.h property.h generators/makefile.h \ generators/unix/unixmake.h meta.h option.h cachekeys.h \ generators/win32/winmakefile.h generators/projectgenerator.h \ generators/makefiledeps.h generators/metamakefile.h generators/mac/pbuilder_pbx.h \ generators/xmloutput.h generators/win32/borland_bmake.h generators/win32/msvc_nmake.h \ generators/win32/msvc_dsp.h generators/win32/msvc_vcproj.h \ - generators/win32/mingw_make.h generators/win32/msvc_objectmodel.h + generators/win32/mingw_make.h generators/win32/msvc_objectmodel.h \ + generators/symbian/symmake.h \ + generators/symbian/symmake_abld.h \ + generators/symbian/symmake_sbsv2.h \ + generators/symbian/initprojectdeploy_symbian.h contains(QT_EDITION, OpenSource) { DEFINES += QMAKE_OPENSOURCE_EDITION @@ -63,7 +78,9 @@ bootstrap { #Qt code qlibraryinfo.cpp \ qvariant.cpp \ qvector.cpp \ - qvsnprintf.cpp + qvsnprintf.cpp \ + qxmlstream.cpp \ + qxmlutils.cpp HEADERS+= \ qbitarray.h \ @@ -97,7 +114,9 @@ bootstrap { #Qt code qtextstream.h \ qurl.h \ quuid.h \ - qvector.h + qvector.h \ + qxmlstream.h \ + qxmlutils.h unix { SOURCES += qfsfileengine_unix.cpp qfsfileengine_iterator_unix.cpp @@ -109,6 +128,7 @@ bootstrap { #Qt code } else:win32 { SOURCES += qfsfileengine_win.cpp qfsfileengine_iterator_win.cpp qsettings_win.cpp win32-msvc*:LIBS += ole32.lib advapi32.lib + win32-mwc:LIBS += -lole32.lib -ladvapi32.lib } qnx { diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 38c58fb..594e698 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -17,8 +17,9 @@ VPATH += $$QT_SOURCE_TREE/src/corelib/global \ $$QT_SOURCE_TREE/src/corelib/kernel \ $$QT_SOURCE_TREE/src/corelib/plugin \ $$QT_SOURCE_TREE/src/corelib/io \ + $$QT_SOURCE_TREE/src/corelib/xml \ $$QT_SOURCE_TREE/src/script -INCPATH += generators generators/unix generators/win32 generators/mac \ +INCPATH += generators generators/unix generators/win32 generators/mac generators/symbian \ $$QT_SOURCE_TREE/include $$QT_SOURCE_TREE/include/QtCore \ $$QT_SOURCE_TREE/qmake $$QT_SOURCE_TREE/include/QtScript include(qmake.pri) diff --git a/qmake/qpopen.cpp b/qmake/qpopen.cpp new file mode 100644 index 0000000..ebde035 --- /dev/null +++ b/qmake/qpopen.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qpopen.h" + + +QPopen::QPopen() +{ +} + +bool QPopen::init(const char *command, const char* /* mode */) +{ + SECURITY_ATTRIBUTES attributes; + + attributes.nLength = sizeof(SECURITY_ATTRIBUTES); + attributes.bInheritHandle = TRUE; + attributes.lpSecurityDescriptor = NULL; + + if (! CreatePipe(&childStdOutR, &childStdOutW, &attributes, 0)) { + return false; + } + + // Ensure that the read handle to the child process's pipe for STDOUT is not inherited. + SetHandleInformation( childStdOutR, HANDLE_FLAG_INHERIT, 0); + + // Create a pipe for the child process's STDIN. + if (! CreatePipe(&childStdInR, &childStdInW, &attributes, 0)) { + return false; + } + + // Ensure that the write handle to the child process's pipe for STDIN is not inherited. + SetHandleInformation( childStdInW, HANDLE_FLAG_INHERIT, 0); + + //TCHAR szCmdline[strlen(command)]=TEXT(command); + TCHAR *szCmdLine = new TCHAR[strlen(command)+1]; + strcpy(szCmdLine, command); + + // Set up members of the PROCESS_INFORMATION structure. + + ZeroMemory( &processInfo, sizeof(PROCESS_INFORMATION) ); + + // Set up members of the STARTUPINFO structure. + + ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) ); + siStartInfo.cb = sizeof(STARTUPINFO); + siStartInfo.hStdError = childStdOutW; + siStartInfo.hStdOutput = childStdOutW; + siStartInfo.hStdInput = childStdInR; + siStartInfo.dwFlags |= STARTF_USESTDHANDLES; + + // Create the child process. + + bool success = CreateProcess(NULL, + szCmdLine, // command line + NULL, // process security attributes + NULL, // primary thread security attributes + TRUE, // handles are inherited + 0, // creation flags + NULL, // use parent's environment + NULL, // use parent's current directory + &siStartInfo, // STARTUPINFO pointer + &processInfo); // receives PROCESS_INFORMATION + + delete szCmdLine; + + return success; +} + +QPopen::~QPopen() +{ + CloseHandle(processInfo.hProcess); + CloseHandle(processInfo.hThread); + CloseHandle(childStdInR); + CloseHandle(childStdInW); + CloseHandle(childStdOutR); + CloseHandle(childStdOutW); +} + +int QPopen::fwrite(char* buffer, int maxBytes) +{ + DWORD bytesWritten; + + bool success = WriteFile(childStdInW, buffer, maxBytes, &bytesWritten, NULL); + if(success) { + return bytesWritten; + } + + return 0; +} + + +int QPopen::fread(char* buffer, int maxBytes) +{ + DWORD bytesRead; + + if( !CloseHandle(childStdOutW) ) + return 0; + + bool success = ReadFile(childStdOutR, buffer, maxBytes, &bytesRead, NULL); + if(success) + return bytesRead; + + return 0; +} + diff --git a/qmake/qpopen.h b/qmake/qpopen.h new file mode 100644 index 0000000..e15830d --- /dev/null +++ b/qmake/qpopen.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the $MODULE$ of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPOPEN_H +#define QPOPEN_H + +#include <windows.h> +#include <tchar.h> +#include <stdio.h> +#include <string.h> + +class QPopen +{ +public: + QPopen(); + ~QPopen(); + int fread(char* buffer, int maxBytes); + int fwrite(char* buffer, int maxBytes); + bool init(const char* command, const char* mode); + +private: + // This pair of handles represent the "Write" pipe + // ie: Parent -> Child + HANDLE childStdInR; + HANDLE childStdInW; + + // This pair of handles represent the "Read" pipe + // ie: Child -> Parent + HANDLE childStdOutR; + HANDLE childStdOutW; + PROCESS_INFORMATION processInfo; + STARTUPINFO siStartInfo; +}; + +#endif |