diff options
Diffstat (limited to 'qmake')
35 files changed, 4237 insertions, 1076 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 7634021..fcf43c8 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -9,30 +9,17 @@ 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 \ - qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlistdata.o qfile.o \ +QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ + qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfile.o \ qfsfileengine_unix.o qfsfileengine_iterator_unix.o qfsfileengine.o \ qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o \ qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o \ qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o qvsnprintf.o \ - qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.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 qscriptextenumeration.o qscriptextvariant.o \ - qscriptcontext.o qscriptfunction.o \ - qscriptgrammar.o qscriptlexer.o qscriptclassdata.o \ - qscriptparser.o qscriptprettypretty.o qscriptsyntaxchecker.o \ - qscriptvalue.o qscriptvalueimpl.o qscriptvalueiterator.o \ - qscriptvalueiteratorimpl.o \ - qscriptclass.o qscriptclasspropertyiterator.o \ - qscriptengineagent.o qscriptcontextinfo.o qscriptstring.o \ + qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o \ $(QTOBJS) @@ -44,6 +31,9 @@ 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/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.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 \ @@ -52,7 +42,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp $(SOURCE_PATH)/src/corelib/io/qbuffer.cpp \ $(SOURCE_PATH)/src/corelib/io/qfsfileengine_unix.cpp $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp \ $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator_unix.cpp $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp \ - $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp $(SOURCE_PATH)/src/corelib/tools/qlistdata.cpp \ + $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp $(SOURCE_PATH)/src/corelib/tools/qlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qvector.cpp $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \ $(SOURCE_PATH)/src/corelib/io/qdiriterator.cpp \ $(SOURCE_PATH)/src/corelib/io/qdir.cpp $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp \ @@ -65,33 +55,14 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/src/corelib/io/qsettings.cpp $(SOURCE_PATH)/src/corelib/kernel/qvariant.cpp \ $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \ $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp $(SOURCE_PATH)/src/corelib/global/qnumeric.cpp \ - $(SOURCE_PATH)/src/script/qscriptasm.cpp \ - $(SOURCE_PATH)/src/script/qscriptast.cpp $(SOURCE_PATH)/src/script/qscriptastvisitor.cpp \ - $(SOURCE_PATH)/src/script/qscriptcompiler.cpp $(SOURCE_PATH)/src/script/qscriptecmaarray.cpp \ - $(SOURCE_PATH)/src/script/qscriptecmaboolean.cpp $(SOURCE_PATH)/src/script/qscriptecmacore.cpp \ - $(SOURCE_PATH)/src/script/qscriptecmadate.cpp $(SOURCE_PATH)/src/script/qscriptecmafunction.cpp \ - $(SOURCE_PATH)/src/script/qscriptecmaglobal.cpp $(SOURCE_PATH)/src/script/qscriptecmamath.cpp \ - $(SOURCE_PATH)/src/script/qscriptecmanumber.cpp $(SOURCE_PATH)/src/script/qscriptecmaobject.cpp \ - $(SOURCE_PATH)/src/script/qscriptecmaregexp.cpp $(SOURCE_PATH)/src/script/qscriptecmastring.cpp \ - $(SOURCE_PATH)/src/script/qscriptecmaerror.cpp $(SOURCE_PATH)/src/script/qscriptcontext_p.cpp \ - $(SOURCE_PATH)/src/script/qscriptengine.cpp $(SOURCE_PATH)/src/script/qscriptengine_p.cpp \ - $(SOURCE_PATH)/src/script/qscriptextenumeration.cpp $(SOURCE_PATH)/src/script/qscriptextvariant.cpp \ - $(SOURCE_PATH)/src/script/qscriptcontext.cpp $(SOURCE_PATH)/src/script/qscriptfunction.cpp \ - $(SOURCE_PATH)/src/script/qscriptgrammar.cpp \ - $(SOURCE_PATH)/src/script/qscriptlexer.cpp $(SOURCE_PATH)/src/script/qscriptclassdata.cpp \ - $(SOURCE_PATH)/src/script/qscriptparser.cpp $(SOURCE_PATH)/src/script/qscriptprettypretty.cpp \ - $(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/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 \ + $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp \ + $(SOURCE_PATH)/src/corelib/xml/qxmlutils.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 \ + -I$(BUILD_PATH)/src/corelib/global -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 \ @@ -160,6 +131,12 @@ qcore_mac.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_mac.cpp qurl.o: $(SOURCE_PATH)/src/corelib/io/qurl.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qurl.cpp +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp @@ -172,8 +149,8 @@ qdatastream.o: $(SOURCE_PATH)/src/corelib/io/qdatastream.cpp qbuffer.o: $(SOURCE_PATH)/src/corelib/io/qbuffer.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qbuffer.cpp -qlistdata.o: $(SOURCE_PATH)/src/corelib/tools/qlistdata.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlistdata.cpp +qlist.o: $(SOURCE_PATH)/src/corelib/tools/qlist.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlist.cpp qfile.o: $(SOURCE_PATH)/src/corelib/io/qfile.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qfile.cpp @@ -292,123 +269,26 @@ 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 -projectgenerator.o: generators/projectgenerator.cpp - $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp - -qscriptasm.o: $(SOURCE_PATH)/src/script/qscriptasm.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptasm.cpp - -qscriptast.o: $(SOURCE_PATH)/src/script/qscriptast.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptast.cpp - -qscriptastvisitor.o: $(SOURCE_PATH)/src/script/qscriptastvisitor.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptastvisitor.cpp - -qscriptcompiler.o: $(SOURCE_PATH)/src/script/qscriptcompiler.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptcompiler.cpp - -qscriptecmaarray.o: $(SOURCE_PATH)/src/script/qscriptecmaarray.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaarray.cpp - -qscriptecmaboolean.o: $(SOURCE_PATH)/src/script/qscriptecmaboolean.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaboolean.cpp - -qscriptecmacore.o: $(SOURCE_PATH)/src/script/qscriptecmacore.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmacore.cpp - -qscriptecmadate.o: $(SOURCE_PATH)/src/script/qscriptecmadate.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmadate.cpp - -qscriptecmafunction.o: $(SOURCE_PATH)/src/script/qscriptecmafunction.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmafunction.cpp - -qscriptecmaglobal.o: $(SOURCE_PATH)/src/script/qscriptecmaglobal.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaglobal.cpp - -qscriptecmamath.o: $(SOURCE_PATH)/src/script/qscriptecmamath.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmamath.cpp - -qscriptecmanumber.o: $(SOURCE_PATH)/src/script/qscriptecmanumber.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmanumber.cpp - -qscriptecmaobject.o: $(SOURCE_PATH)/src/script/qscriptecmaobject.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaobject.cpp - -qscriptecmaregexp.o: $(SOURCE_PATH)/src/script/qscriptecmaregexp.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaregexp.cpp - -qscriptecmastring.o: $(SOURCE_PATH)/src/script/qscriptecmastring.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmastring.cpp - -qscriptecmaerror.o: $(SOURCE_PATH)/src/script/qscriptecmaerror.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptecmaerror.cpp +symmake.o: generators/symbian/symmake.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/symmake.cpp -qscriptcontext_p.o: $(SOURCE_PATH)/src/script/qscriptcontext_p.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptcontext_p.cpp +symmake_abld.o: generators/symbian/symmake_abld.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/symmake_abld.cpp -qscriptengine.o: $(SOURCE_PATH)/src/script/qscriptengine.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptengine.cpp +symmake_sbsv2.o: generators/symbian/symmake_sbsv2.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/symmake_sbsv2.cpp -qscriptengine_p.o: $(SOURCE_PATH)/src/script/qscriptengine_p.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptengine_p.cpp +initprojectdeploy_symbian.o: generators/symbian/initprojectdeploy_symbian.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/symbian/initprojectdeploy_symbian.cpp -qscriptextenumeration.o: $(SOURCE_PATH)/src/script/qscriptextenumeration.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptextenumeration.cpp - -qscriptextvariant.o: $(SOURCE_PATH)/src/script/qscriptextvariant.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptextvariant.cpp - -qscriptcontext.o: $(SOURCE_PATH)/src/script/qscriptcontext.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptcontext.cpp - -qscriptfunction.o: $(SOURCE_PATH)/src/script/qscriptfunction.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptfunction.cpp - -qscriptgrammar.o: $(SOURCE_PATH)/src/script/qscriptgrammar.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptgrammar.cpp - -qscriptlexer.o: $(SOURCE_PATH)/src/script/qscriptlexer.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptlexer.cpp - -qscriptclassdata.o: $(SOURCE_PATH)/src/script/qscriptclassdata.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptclassdata.cpp - -qscriptparser.o: $(SOURCE_PATH)/src/script/qscriptparser.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptparser.cpp - -qscriptprettypretty.o: $(SOURCE_PATH)/src/script/qscriptprettypretty.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptprettypretty.cpp - -qscriptsyntaxchecker.o: $(SOURCE_PATH)/src/script/qscriptsyntaxchecker.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptsyntaxchecker.cpp - -qscriptvalue.o: $(SOURCE_PATH)/src/script/qscriptvalue.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalue.cpp - -qscriptvalueimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueimpl.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueimpl.cpp - -qscriptvalueiterator.o: $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiterator.cpp - -qscriptvalueiteratorimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp - -qscriptclass.o: $(SOURCE_PATH)/src/script/qscriptclass.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptclass.cpp - -qscriptclasspropertyiterator.o: $(SOURCE_PATH)/src/script/qscriptclasspropertyiterator.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptclasspropertyiterator.cpp - -qscriptengineagent.o: $(SOURCE_PATH)/src/script/qscriptengineagent.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptengineagent.cpp - -qscriptcontextinfo.o: $(SOURCE_PATH)/src/script/qscriptcontextinfo.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptcontextinfo.cpp +projectgenerator.o: generators/projectgenerator.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp -qscriptstring.o: $(SOURCE_PATH)/src/script/qscriptstring.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptstring.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 #default rules .cpp.o: $(CXX) -c -o $@ $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 53130aa..e6bbcd5 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -28,11 +28,11 @@ 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 +54,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 +74,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 @@ -84,11 +85,11 @@ CFLAGS = $(CFLAGS) -DQMAKE_OPENSOURCE_EDITION QTOBJS= \ qbitarray.obj \ qbuffer.obj \ - qcryptographichash.obj \ + qcryptographichash.obj \ qfsfileengine.obj \ qfsfileengine_iterator.obj \ qbytearray.obj \ - qvsnprintf.obj \ + qvsnprintf.obj \ qbytearraymatcher.obj \ qdatetime.obj \ qdir.obj \ @@ -102,12 +103,14 @@ QTOBJS= \ qglobal.obj \ qhash.obj \ qiodevice.obj \ - qlistdata.obj \ + qlist.obj \ qlinkedlist.obj \ qlocale.obj \ - qmalloc.obj \ + qmalloc.obj \ qmap.obj \ qregexp.obj \ + qtextcodec.obj \ + qutfcodec.obj \ qstring.obj \ qstringlist.obj \ qtextstream.obj \ @@ -117,48 +120,12 @@ QTOBJS= \ qsettings.obj \ qlibraryinfo.obj \ qvariant.obj \ - qurl.obj \ + qurl.obj \ qsettings_win.obj \ - qmetatype.obj \ - qnumeric.obj \ - qscriptasm.obj \ - qscriptast.obj \ - qscriptastvisitor.obj \ - qscriptcompiler.obj \ - qscriptecmaarray.obj \ - qscriptecmaboolean.obj \ - qscriptecmacore.obj \ - qscriptecmadate.obj \ - qscriptecmafunction.obj \ - qscriptecmaglobal.obj \ - qscriptecmamath.obj \ - qscriptecmanumber.obj \ - qscriptecmaobject.obj \ - qscriptecmaregexp.obj \ - qscriptecmastring.obj \ - qscriptecmaerror.obj \ - qscriptcontext_p.obj \ - qscriptengine.obj \ - qscriptengine_p.obj \ - qscriptengineagent.obj \ - qscriptextenumeration.obj \ - qscriptextvariant.obj \ - qscriptcontext.obj \ - qscriptcontextinfo.obj \ - qscriptfunction.obj \ - qscriptgrammar.obj \ - qscriptlexer.obj \ - qscriptclassdata.obj \ - qscriptparser.obj \ - qscriptprettypretty.obj \ - qscriptsyntaxchecker.obj \ - qscriptclass.obj \ - qscriptclasspropertyiterator.obj \ - qscriptstring.obj \ - qscriptvalue.obj \ - qscriptvalueimpl.obj \ - qscriptvalueiterator.obj \ - qscriptvalueiteratorimpl.obj + qmetatype.obj \ + qxmlstream.obj \ + qxmlutils.obj \ + qnumeric.obj first all: qmake.exe @@ -175,7 +142,7 @@ clean:: -del qfsfileengine.obj -del qfsfileengine_iterator.obj -del qbytearray.obj - -del qvsnprintf.obj + -del qvsnprintf.obj -del qbytearraymatcher.obj -del qdatetime.obj -del qdir.obj @@ -189,11 +156,13 @@ clean:: -del qglobal.obj -del qhash.obj -del qiodevice.obj - -del qlistdata.obj + -del qlist.obj -del qlocale.obj -del qmalloc.obj -del qmap.obj -del qregexp.obj + -del qtextcodec.obj + -del qutfcodec.obj -del qstring.obj -del qstringlist.obj -del qtextstream.obj @@ -203,9 +172,9 @@ clean:: -del qsettings.obj -del qlibraryinfo.obj -del qvariant.obj - -del qurl.obj + -del qurl.obj -del qsettings_win.obj - -del qmetatype.obj + -del qmetatype.obj -del project.obj -del main.obj -del makefile.obj @@ -225,46 +194,14 @@ 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 \ - -del qscriptast.obj \ - -del qscriptastvisitor.obj \ - -del qscriptcompiler.obj \ - -del qscriptecmaarray.obj \ - -del qscriptecmaboolean.obj \ - -del qscriptecmacore.obj \ - -del qscriptecmadate.obj \ - -del qscriptecmafunction.obj \ - -del qscriptecmaglobal.obj \ - -del qscriptecmamath.obj \ - -del qscriptecmanumber.obj \ - -del qscriptecmaobject.obj \ - -del qscriptecmaregexp.obj \ - -del qscriptecmastring.obj \ - -del qscriptecmaerror.obj \ - -del qscriptcontext_p.obj \ - -del qscriptengine.obj \ - -del qscriptengine_p.obj \ - -del qscriptengineagent.obj \ - -del qscriptextenumeration.obj \ - -del qscriptextvariant.obj \ - -del qscriptcontext.obj \ - -del qscriptcontextinfo.obj \ - -del qscriptfunction.obj \ - -del qscriptgrammar.obj \ - -del qscriptlexer.obj \ - -del qscriptclassdata.obj \ - -del qscriptparser.obj \ - -del qscriptprettypretty.obj \ - -del qscriptsyntaxchecker.obj \ - -del qscriptclass.obj \ - -del qscriptclasspropertyiterator.obj \ - -del qscriptstring.obj \ - -del qscriptvalue.obj \ - -del qscriptvalueimpl.obj \ - -del qscriptvalueiterator.obj \ - -del qscriptvalueiteratorimpl.obj + -del qxmlstream.obj + -del qxmlutils.obj + -del qnumeric.obj -del vc60.pdb -del vc70.pdb -del qmake.pdb @@ -337,6 +274,9 @@ qbytearraymatcher.obj: $(SOURCE_PATH)\src\corelib\tools\qbytearraymatcher.cpp qchar.obj: $(SOURCE_PATH)\src\corelib\tools\qchar.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qchar.cpp +qutfcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qutfcodec.cpp + qstring.obj: $(SOURCE_PATH)\src\corelib\tools\qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qstring.cpp @@ -352,8 +292,8 @@ quuid.obj: $(SOURCE_PATH)\src\corelib\plugin\quuid.cpp qbuffer.obj: $(SOURCE_PATH)\src\corelib\io\qbuffer.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\io\qbuffer.cpp -qlistdata.obj: $(SOURCE_PATH)\src\corelib\tools\qlistdata.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qlistdata.cpp +qlist.obj: $(SOURCE_PATH)\src\corelib\tools\qlist.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qlist.cpp qlinkedlist.obj: $(SOURCE_PATH)\src\corelib\tools\qlinkedlist.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qlinkedlist.cpp @@ -379,8 +319,8 @@ qfsfileengine_iterator.obj: $(SOURCE_PATH)\src\corelib\io\qfsfileengine_iterator qabstractfileengine.obj: $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\io\qabstractfileengine.cpp -qtextcodec.obj: $(SOURCE_PATH)\src\codecs\qtextcodec.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\codecs\qtextcodec.cpp +qtextcodec.obj: $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\codecs\qtextcodec.cpp qregexp.obj: $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qregexp.cpp @@ -414,6 +354,7 @@ qmap.obj: $(SOURCE_PATH)\src\corelib\tools\qmap.cpp qunicodetables.obj: $(SOURCE_PATH)\src\corelib\tools\qunicodetables.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\tools\qunicodetables.cpp + makefile.obj: $(SOURCE_PATH)/qmake/generators\makefile.cpp $(CXX) $(CXXFLAGS) generators\makefile.cpp @@ -444,8 +385,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 @@ -476,116 +430,8 @@ metamakefile.obj: $(SOURCE_PATH)/qmake/generators/metamakefile.cpp xmloutput.obj: $(SOURCE_PATH)/qmake/generators/xmloutput.cpp $(CXX) $(CXXFLAGS) generators/xmloutput.cpp -qscriptasm.obj: $(SOURCE_PATH)\src\script\qscriptasm.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptasm.cpp - -qscriptast.obj: $(SOURCE_PATH)\src\script\qscriptast.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptast.cpp - -qscriptastvisitor.obj: $(SOURCE_PATH)\src\script\qscriptastvisitor.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptastvisitor.cpp - -qscriptcompiler.obj: $(SOURCE_PATH)\src\script\qscriptcompiler.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptcompiler.cpp - -qscriptecmaarray.obj: $(SOURCE_PATH)\src\script\qscriptecmaarray.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmaarray.cpp - -qscriptecmaboolean.obj: $(SOURCE_PATH)\src\script\qscriptecmaboolean.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmaboolean.cpp - -qscriptecmacore.obj: $(SOURCE_PATH)\src\script\qscriptecmacore.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmacore.cpp - -qscriptecmadate.obj: $(SOURCE_PATH)\src\script\qscriptecmadate.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmadate.cpp - -qscriptecmafunction.obj: $(SOURCE_PATH)\src\script\qscriptecmafunction.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmafunction.cpp - -qscriptecmaglobal.obj: $(SOURCE_PATH)\src\script\qscriptecmaglobal.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmaglobal.cpp - -qscriptecmamath.obj: $(SOURCE_PATH)\src\script\qscriptecmamath.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmamath.cpp - -qscriptecmanumber.obj: $(SOURCE_PATH)\src\script\qscriptecmanumber.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmanumber.cpp - -qscriptecmaobject.obj: $(SOURCE_PATH)\src\script\qscriptecmaobject.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmaobject.cpp - -qscriptecmaregexp.obj: $(SOURCE_PATH)\src\script\qscriptecmaregexp.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmaregexp.cpp - -qscriptecmastring.obj: $(SOURCE_PATH)\src\script\qscriptecmastring.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmastring.cpp - -qscriptecmaerror.obj: $(SOURCE_PATH)\src\script\qscriptecmaerror.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptecmaerror.cpp - -qscriptcontext_p.obj: $(SOURCE_PATH)\src\script\qscriptcontext_p.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptcontext_p.cpp - -qscriptengine.obj: $(SOURCE_PATH)\src\script\qscriptengine.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptengine.cpp - -qscriptengine_p.obj: $(SOURCE_PATH)\src\script\qscriptengine_p.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptengine_p.cpp - -qscriptengineagent.obj: $(SOURCE_PATH)\src\script\qscriptengineagent.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptengineagent.cpp - -qscriptextenumeration.obj: $(SOURCE_PATH)\src\script\qscriptextenumeration.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptextenumeration.cpp - -qscriptextvariant.obj: $(SOURCE_PATH)\src\script\qscriptextvariant.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptextvariant.cpp - -qscriptcontext.obj: $(SOURCE_PATH)\src\script\qscriptcontext.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptcontext.cpp - -qscriptcontextinfo.obj: $(SOURCE_PATH)\src\script\qscriptcontextinfo.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptcontextinfo.cpp - -qscriptfunction.obj: $(SOURCE_PATH)\src\script\qscriptfunction.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptfunction.cpp - -qscriptgrammar.obj: $(SOURCE_PATH)\src\script\qscriptgrammar.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptgrammar.cpp - -qscriptlexer.obj: $(SOURCE_PATH)\src\script\qscriptlexer.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptlexer.cpp - -qscriptclassdata.obj: $(SOURCE_PATH)\src\script\qscriptclassdata.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptclassdata.cpp - -qscriptparser.obj: $(SOURCE_PATH)\src\script\qscriptparser.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptparser.cpp - -qscriptprettypretty.obj: $(SOURCE_PATH)\src\script\qscriptprettypretty.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptprettypretty.cpp - -qscriptsyntaxchecker.obj: $(SOURCE_PATH)\src\script\qscriptsyntaxchecker.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptsyntaxchecker.cpp - -qscriptstring.obj: $(SOURCE_PATH)\src\script\qscriptstring.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptstring.cpp - -qscriptclass.obj: $(SOURCE_PATH)\src\script\qscriptclass.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptclass.cpp - -qscriptclasspropertyiterator.obj: $(SOURCE_PATH)\src\script\qscriptclasspropertyiterator.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptclasspropertyiterator.cpp - -qscriptvalue.obj: $(SOURCE_PATH)\src\script\qscriptvalue.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptvalue.cpp - -qscriptvalueimpl.obj: $(SOURCE_PATH)\src\script\qscriptvalueimpl.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptvalueimpl.cpp - -qscriptvalueiterator.obj: $(SOURCE_PATH)\src\script\qscriptvalueiterator.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptvalueiterator.cpp +qxmlstream.obj: $(SOURCE_PATH)\src\corelib\xml\qxmlstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\corelib\xml\qxmlstream.cpp -qscriptvalueiteratorimpl.obj: $(SOURCE_PATH)\src\script\qscriptvalueiteratorimpl.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)\src\script\qscriptvalueiteratorimpl.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..ade379b 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -15,14 +15,16 @@ 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_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_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) LFLAGS = LIBS = -lole32 -luuid @@ -35,7 +37,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 @@ -46,7 +49,7 @@ QTOBJS= \ qbitarray.o \ qbuffer.o \ qbytearray.o \ - qcryptographichash.o \ + qcryptographichash.o \ qvsnprintf.o \ qbytearraymatcher.o \ qconfig.o \ @@ -65,12 +68,14 @@ QTOBJS= \ qhash.o \ qiodevice.o \ qlibraryinfo.o \ - qlistdata.o \ + qlist.o \ qlinkedlist.o \ qlocale.o \ qmalloc.o \ qmap.o \ qregexp.o \ + qtextcodec.o \ + qutfcodec.o \ qstring.o \ qstringlist.o \ qtextstream.o \ @@ -81,45 +86,9 @@ QTOBJS= \ 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 \ + qnumeric.o qmake.exe: $(OBJS) $(QTOBJS) @@ -192,6 +161,9 @@ qvsnprintf.o: $(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 +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp @@ -204,8 +176,8 @@ quuid.o: $(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 +qlist.o: $(SOURCE_PATH)/src/corelib/tools/qlist.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlist.cpp qlinkedlist.o: $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp @@ -231,8 +203,8 @@ qfsfileengine.o: $(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 +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp @@ -294,6 +266,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 @@ -324,116 +308,8 @@ metamakefile.o: $(SOURCE_PATH)/qmake/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 +qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp -qscriptvalueiteratorimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.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..8d2723c 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -15,14 +15,16 @@ 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_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_BOOTSTRAPPED CXXFLAGS = $(CFLAGS) LFLAGS = LIBS = -lole32 -luuid @@ -35,7 +37,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 @@ -65,12 +68,14 @@ QTOBJS= \ qhash.o \ qiodevice.o \ qlibraryinfo.o \ - qlistdata.o \ + qlist.o \ qlinkedlist.o \ qlocale.o \ qmalloc.o \ qmap.o \ qregexp.o \ + qtextcodec.o \ + qutfcodec.o \ qstring.o \ qstringlist.o \ qtextstream.o \ @@ -81,45 +86,9 @@ QTOBJS= \ 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 \ + qnumeric.o qmake.exe: $(OBJS) $(QTOBJS) $(LINKQMAKE) @@ -191,6 +160,9 @@ qvsnprintf.o: $(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 +qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp + qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qstring.cpp @@ -203,8 +175,8 @@ quuid.o: $(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 +qlist.o: $(SOURCE_PATH)/src/corelib/tools/qlist.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlist.cpp qlinkedlist.o: $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp @@ -230,8 +202,8 @@ qfsfileengine.o: $(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 +qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp @@ -293,6 +265,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 @@ -323,116 +307,8 @@ metamakefile.o: $(SOURCE_PATH)/qmake/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 +qxmlstream.o: $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlstream.cpp -qscriptvalueiteratorimpl.o: $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp - $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/script/qscriptvalueiteratorimpl.cpp +qxmlutils.o: $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp + $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/xml/qxmlutils.cpp diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 3192bdd..29f53b6 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -156,7 +156,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; fi = QFileInfo(profile); } QMakeProject tmp_proj; diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index d7ae668..aa1126a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -121,7 +121,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const QDir d; if(path.startsWith(QDir::separator())) { d.cd(QString(QDir::separator())); - path = path.right(path.length() - 1); + path.remove(0, 1); } bool ret = true; #ifdef Q_OS_WIN @@ -129,7 +129,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const if(!QDir::isRelativePath(path)) { if(QFile::exists(path.left(3))) { d.cd(path.left(3)); - path = path.right(path.length() - 3); + path.remove(0, 3); } else { warn_msg(WarnLogic, "Cannot access drive '%s' (%s)", path.left(3).toLatin1().data(), path.toLatin1().data()); @@ -201,13 +201,13 @@ MakefileGenerator::initOutPaths() if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() && v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) { QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first(); - root = Option::fixPathToTargetOS(root); + root = QDir::fromNativeSeparators(root); if(!root.isEmpty()) { QFileInfo fi = fileInfo(Option::mkfile::cachefile); if(!fi.makeAbsolute()) { QString cache_r = fi.path(), pwd = Option::output_dir; if(pwd.startsWith(cache_r) && !pwd.startsWith(root)) { - pwd = Option::fixPathToTargetOS(root + pwd.mid(cache_r.length())); + pwd = root + pwd.mid(cache_r.length()); if(exists(pwd)) v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", QStringList(pwd)); } @@ -217,7 +217,7 @@ MakefileGenerator::initOutPaths() } if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) { QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first(); - asp = Option::fixPathToTargetOS(asp); + asp = QDir::fromNativeSeparators(asp); if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother? v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear(); } @@ -243,7 +243,7 @@ MakefileGenerator::initOutPaths() if(!(dirs[x] == "DLLDESTDIR")) #endif { - if(pathRef.right(Option::dir_sep.length()) != Option::dir_sep) + if(!pathRef.endsWith(Option::dir_sep)) pathRef += Option::dir_sep; } @@ -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 contain 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()); } } } @@ -344,7 +346,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v QString real_dir = Option::fixPathToLocalOS((*vpath_it)); if(exists(real_dir + QDir::separator() + val)) { QString dir = (*vpath_it); - if(dir.right(Option::dir_sep.length()) != Option::dir_sep) + if(!dir.endsWith(Option::dir_sep)) dir += Option::dir_sep; val = dir + val; if(!(flags & VPATH_NoFixify)) @@ -363,7 +365,7 @@ MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &v real_dir = dir; if(!(flags & VPATH_NoFixify)) real_dir = fileFixify(real_dir, qmake_getpwd(), Option::output_dir); - regex = regex.right(regex.length() - dir.length()); + regex.remove(0, dir.length()); } if(real_dir.isEmpty() || exists(real_dir)) { QStringList files = QDir(real_dir).entryList(QStringList(regex)); @@ -723,14 +725,14 @@ MakefileGenerator::init() if(project->isActiveConfig("qmake_cache")) { QString cache_file; if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) { - cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); + cache_file = QDir::fromNativeSeparators(project->first("QMAKE_INTERNAL_CACHE_FILE")); } else { cache_file = ".qmake.internal.cache"; if(project->isActiveConfig("build_pass")) cache_file += ".BUILD." + project->first("BUILD_PASS"); } - if(cache_file.indexOf(QDir::separator()) == -1) - cache_file.prepend(Option::output_dir + QDir::separator()); + if(cache_file.indexOf('/') == -1) + cache_file.prepend(Option::output_dir + '/'); QMakeSourceFileInfo::setCacheFile(cache_file); } @@ -787,7 +789,7 @@ MakefileGenerator::init() QString dir, regex = Option::fixPathToLocalOS((*dep_it)); if(regex.lastIndexOf(Option::dir_sep) != -1) { dir = regex.left(regex.lastIndexOf(Option::dir_sep) + 1); - regex = regex.right(regex.length() - dir.length()); + regex.remove(0, dir.length()); } QStringList files = QDir(dir).entryList(QStringList(regex)); if(files.isEmpty()) { @@ -937,7 +939,7 @@ MakefileGenerator::writePrlFile(QTextStream &t) QString target = project->first("TARGET"); int slsh = target.lastIndexOf(Option::dir_sep); if(slsh != -1) - target = target.right(target.length() - slsh - 1); + target.remove(0, slsh + 1); QString bdir = Option::output_dir; if(bdir.isEmpty()) bdir = qmake_getpwd(); @@ -967,6 +969,8 @@ MakefileGenerator::writePrlFile(QTextStream &t) libs = project->values("QMAKE_INTERNAL_PRL_LIBS"); else libs << "QMAKE_LIBS"; //obvious one + if(project->isActiveConfig("staticlib")) + libs << "QMAKE_LIBS_PRIVATE"; t << "QMAKE_PRL_LIBS = "; for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) t << project->values((*it)).join(" ") << " "; @@ -1055,11 +1059,11 @@ MakefileGenerator::prlFileName(bool fixify) ret = project->first("TARGET"); int slsh = ret.lastIndexOf(Option::dir_sep); if(slsh != -1) - ret = ret.right(ret.length() - slsh); + ret.remove(0, slsh); if(!ret.endsWith(Option::prl_ext)) { int dot = ret.indexOf('.'); if(dot != -1) - ret = ret.left(dot); + ret.truncate(dot); ret += Option::prl_ext; } if(!project->isEmpty("QMAKE_BUNDLE")) @@ -1209,7 +1213,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n if(project->values((*it) + ".CONFIG").indexOf("no_path") == -1 && project->values((*it) + ".CONFIG").indexOf("dummy_install") == -1) { dst = fileFixify(unescapeFilePath(project->values(pvar).first()), FileFixifyAbsolute, false); - if(dst.right(1) != Option::dir_sep) + if(!dst.endsWith(Option::dir_sep)) dst += Option::dir_sep; } dst = escapeFilePath(dst); @@ -1238,9 +1242,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n int slsh = filestr.lastIndexOf(Option::dir_sep); if(slsh != -1) { dirstr = filestr.left(slsh+1); - filestr = filestr.right(filestr.length() - slsh - 1); + filestr.remove(0, slsh+1); } - if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) + if(!dirstr.endsWith(Option::dir_sep)) dirstr += Option::dir_sep; if(exists(wild)) { //real file QString file = wild; @@ -1340,7 +1344,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n const QStringList &dirs = project->values(pvar); for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { QString tmp_dst = fileFixify((*pit), FileFixifyAbsolute, false); - if (!isWindowsShell() && tmp_dst.right(1) != Option::dir_sep) + if (!isWindowsShell() && !tmp_dst.endsWith(Option::dir_sep)) tmp_dst += Option::dir_sep; t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t"; } @@ -1579,8 +1583,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 +1704,10 @@ MakefileGenerator::writeExtraTargets(QTextStream &t) if(!cmd.isEmpty()) t << "\n\t" << cmd; t << endl << endl; + + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + (*it)) << escapeDependencyPath(targ); + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(targ)) << deps.split(" ", QString::SkipEmptyParts); + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + (*it) + escapeDependencyPath(targ)) << cmd; } } @@ -1784,6 +1795,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 +1825,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), @@ -1887,15 +1903,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_INTERNAL_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_INTERNAL_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(tmp_out)) << tmp_dep; } else { t << " " << valList(escapeDependencyPaths(inputs)) << " " << valList(escapeDependencyPaths(deps)); + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(tmp_out)) << inputs << deps; } t << "\n\t" << cmd << endl << endl; + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + (*it) + escapeDependencyPath(tmp_out)) << cmd; continue; } for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { @@ -1909,6 +1938,15 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) deps += replaceExtraCompilerVariables(pre_deps.at(i), (*input), out); } 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()) { @@ -1998,6 +2036,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } t << escapeDependencyPath(out) << ": " << valList(escapeDependencyPaths(deps)) << "\n\t" << cmd << endl << endl; + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + (*it)) << escapeDependencyPath(out); + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + (*it) + escapeDependencyPath(out)) << deps; + project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + (*it) + escapeDependencyPath(out)) << cmd; } } t << "compiler_clean: " << clean_targets << endl << endl; @@ -2111,8 +2152,6 @@ QString MakefileGenerator::buildArgs(const QString &outdir) ret += " -unix"; else if(Option::target_mode == Option::TARG_WIN_MODE) ret += " -win32"; - else if(Option::target_mode == Option::TARG_QNX6_MODE) - ret += " -qnx6"; //configs for(QStringList::Iterator it = Option::user_configs.begin(); @@ -2171,8 +2210,8 @@ MakefileGenerator::writeHeader(QTextStream &t) t << endl; } -void -MakefileGenerator::writeSubDirs(QTextStream &t) +QList<MakefileGenerator::SubTarget*> +MakefileGenerator::findSubDirsSubTargets() const { QList<SubTarget*> targets; { @@ -2214,8 +2253,8 @@ MakefileGenerator::writeSubDirs(QTextStream &t) st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext; st->in_directory = file; } - while(st->in_directory.right(1) == Option::dir_sep) - st->in_directory = st->in_directory.left(st->in_directory.length() - 1); + while(st->in_directory.endsWith(Option::dir_sep)) + st->in_directory.chop(1); if(fileInfo(st->in_directory).isRelative()) st->out_directory = st->in_directory; else @@ -2269,6 +2308,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")) @@ -2285,39 +2331,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.remove(0, 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) { @@ -2437,23 +2487,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); @@ -2462,7 +2514,12 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT t << suffix << ":"; for(int target = 0; target < targets.size(); ++target) { - QString targetRule = targets.at(target)->target + "-" + suffix; + SubTarget *subTarget = targets.at(target); + if((suffix == "make_first" || suffix == "make_default") + && project->values(subTarget->name + ".CONFIG").indexOf("no_default_target") != -1) { + continue; + } + QString targetRule = subTarget->target + "-" + suffix; if(flags & SubTargetOrdered) targetRule += "-ordered"; t << " " << targetRule; @@ -2721,11 +2778,13 @@ MakefileGenerator::fileFixify(const QString& file, const QString &out_d, const Q return cacheVal; //do the fixin' - const QString pwd = qmake_getpwd() + "/"; + QString pwd = qmake_getpwd(); + if (!pwd.endsWith('/')) + pwd += '/'; QString orig_file = ret; if(ret.startsWith(QLatin1Char('~'))) { if(ret.startsWith(QLatin1String("~/"))) - ret = QDir::homePath() + Option::dir_sep + ret.mid(1); + ret = QDir::homePath() + ret.mid(1); else warn_msg(WarnLogic, "Unable to expand ~ in %s", ret.toLatin1().constData()); } @@ -2814,13 +2873,13 @@ MakefileGenerator::checkMultipleDefinition(const QString &f, const QString &w) QString file = f; int slsh = f.lastIndexOf(Option::dir_sep); if(slsh != -1) - file = file.right(file.length() - slsh - 1); + file.remove(0, slsh + 1); QStringList &l = project->values(w); for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { QString file2((*val_it)); slsh = file2.lastIndexOf(Option::dir_sep); if(slsh != -1) - file2 = file2.right(file2.length() - slsh - 1); + file2.remove(0, slsh + 1); if(file2 == file) { warn_msg(WarnLogic, "Found potential symbol conflict of %s (%s) in %s", file.toLatin1().constData(), (*val_it).toLatin1().constData(), w.toLatin1().constData()); @@ -2974,7 +3033,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const file.setFileName(Option::output_dir + "/" + file.fileName()); //pwd when qmake was run QFileInfo fi(fileInfo(file.fileName())); if(fi.isDir()) - outdir = file.fileName() + QDir::separator(); + outdir = file.fileName() + '/'; } if(!outdir.isEmpty() || file.fileName().isEmpty()) { QString fname = "Makefile"; @@ -2994,7 +3053,7 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const file.setFileName(file.fileName() + "." + build); if(project->isEmpty("QMAKE_MAKEFILE")) project->values("QMAKE_MAKEFILE").append(file.fileName()); - int slsh = file.fileName().lastIndexOf(Option::dir_sep); + int slsh = file.fileName().lastIndexOf('/'); if(slsh != -1) mkdir(file.fileName().left(slsh)); if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { @@ -3004,9 +3063,13 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const od = fileInfo(fi.readLink()).absolutePath(); else od = fi.path(); - od = Option::fixPathToTargetOS(od); - if(QDir::isRelativePath(od)) - od.prepend(Option::output_dir); + od = QDir::fromNativeSeparators(od); + if(QDir::isRelativePath(od)) { + QString dir = Option::output_dir; + if (!dir.endsWith('/') && !od.isEmpty()) + dir += '/'; + od.prepend(dir); + } Option::output_dir = od; return true; } diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 93ee633..1ef91fb 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -116,9 +116,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/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 4eb1311..12fe4d4 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -378,17 +378,19 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) files_changed = true; file->dep_checked = true; + const QMakeLocalFileName sourceFile = fixPathForFile(file->file, true); + struct stat fst; char *buffer = 0; int buffer_len = 0; { int fd; #if defined(_MSC_VER) && _MSC_VER >= 1400 - if (_sopen_s(&fd, fixPathForFile(file->file, true).local().toLatin1().constData(), + if (_sopen_s(&fd, sourceFile.local().toLatin1().constData(), _O_RDONLY, _SH_DENYNO, _S_IREAD) != 0) fd = -1; #else - fd = open(fixPathForFile(file->file, true).local().toLatin1().constData(), O_RDONLY); + fd = open(sourceFile.local().toLatin1().constData(), O_RDONLY); #endif if(fd == -1 || fstat(fd, &fst) || S_ISDIR(fst.st_mode)) return false; @@ -623,12 +625,8 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) QMakeLocalFileName lfn(inc); if(QDir::isRelativePath(lfn.real())) { if(try_local) { - QString dir = findFileInfo(file->file).path(); - if(QDir::isRelativePath(dir)) - dir.prepend(qmake_getpwd() + "/"); - if(!dir.endsWith("/")) - dir += "/"; - QMakeLocalFileName f(dir + lfn.local()); + QDir sourceDir = findFileInfo(sourceFile).dir(); + QMakeLocalFileName f(sourceDir.absoluteFilePath(lfn.local())); if(findFileInfo(f).exists()) { lfn = fixPathForFile(f); exists = true; diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 7a64378..d7a5d6f 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -60,8 +60,8 @@ MetaMakefileGenerator::~MetaMakefileGenerator() class BuildsMetaMakefileGenerator : public MetaMakefileGenerator { - bool init_flag; private: + bool init_flag; struct Build { QString name, build; MakefileGenerator *makefile; @@ -263,8 +263,8 @@ MakefileGenerator class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator { +protected: bool init_flag; -private: struct Subdir { Subdir() : makefile(0), indent(0) { } ~Subdir() { delete makefile; } @@ -293,9 +293,9 @@ SubdirsMetaMakefileGenerator::init() init_flag = true; if(Option::recursive) { - QString old_output_dir = QDir::cleanPath(Option::output_dir); + QString old_output_dir = Option::output_dir; QString old_output = Option::output.fileName(); - QString oldpwd = QDir::cleanPath(qmake_getpwd()); + QString oldpwd = qmake_getpwd(); QString thispwd = oldpwd; if(!thispwd.endsWith('/')) thispwd += '/'; @@ -375,6 +375,7 @@ SubdirsMetaMakefileGenerator::init() self->makefile = new BuildsMetaMakefileGenerator(project, name, false); self->makefile->init(); subs.append(self); + return true; } @@ -418,6 +419,269 @@ 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; + + 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 = tailList.at(j); + list.append(path); + } + } + + 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; + + // If we are here then we have template == subdirs + + 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(Option::mmp_ext); + + + 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(); + childMmpFilename = subdir.absoluteFilePath(); + childMmpFilename.replace(Option::pro_ext, QString("")); + childMmpFilename.append(Option::mmp_ext); + } else { + childMmpFilename = subdir.absoluteFilePath(); + childMmpFilename.replace(Option::pro_ext, Option::mmp_ext); + sub_name = childMmpFilename; + sub_name.replace(Option::mmp_ext, 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 { + 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(Option::mmp_ext); + + // map mmpfile to its absolute 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); + + 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); + } + } + return mmpRelativePaths; +} + //Factory things QT_BEGIN_INCLUDE_NAMESPACE #include "unixmake.h" @@ -428,6 +692,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 +730,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()); } @@ -478,12 +748,15 @@ MetaMakefileGenerator * MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op) { 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 ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || + Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { + 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) + if (!ret) ret = new BuildsMetaMakefileGenerator(proj, name, op); ret->init(); return ret; diff --git a/qmake/generators/symbian/epocroot.h b/qmake/generators/symbian/epocroot.h new file mode 100644 index 0000000..6ff5e24 --- /dev/null +++ b/qmake/generators/symbian/epocroot.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EPOCROOT_H +#define EPOCROOT_H + +#include <qstring.h> + +// Implementation of epocRoot method is in initprojectdeploy_symbian.cpp +// Defined in separate header for inclusion clarity +extern QString epocRoot(); + +#endif // EPOCROOT_H diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp new file mode 100644 index 0000000..3bc2391 --- /dev/null +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -0,0 +1,380 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "initprojectdeploy_symbian.h" +#include <QDirIterator> +#include <project.h> +#include <qxmlstream.h> +#include <qsettings.h> +#include <qdebug.h> + +#define PLUGIN_STUB_DIR "qmakepluginstubs" +#define SYSBIN_DIR "\\sys\\bin" + +#define SUFFIX_DLL "dll" +#define SUFFIX_EXE "exe" +#define SUFFIX_QTPLUGIN "qtplugin" + +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; +} + + +static bool isPlugin(const QFileInfo& info, const QString& devicePath) +{ + // Libraries are plugins if deployment path is something else than + // SYSBIN_DIR with or without drive letter + if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) && + (devicePath.size() < 8 || + (0 != devicePath.compare(QLatin1String(SYSBIN_DIR), Qt::CaseInsensitive) && + 0 != devicePath.mid(1).compare(QLatin1String(":" SYSBIN_DIR), Qt::CaseInsensitive)))) { + return true; + } else { + return false; + } +} + +static bool isBinary(const QFileInfo& info) +{ + if (0 == info.suffix().compare(QLatin1String(SUFFIX_DLL), Qt::CaseInsensitive) || + 0 == info.suffix().compare(QLatin1String(SUFFIX_EXE), Qt::CaseInsensitive)) { + 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() + "." SUFFIX_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 " SYSBIN_DIR ". 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()))); +} + +QString generate_uid(const QString& target) +{ + static QMap<QString, QString> targetToUid; + + QString tmp = targetToUid[target]; + + if (!tmp.isEmpty()) { + 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"); + + targetToUid[target] = tmp; + + return tmp; +} + +// 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"); + + return tmp; +} + + +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(QString item, project->values("DEPLOYMENT")) { + QString devicePath = project->first(item + ".path"); + if (!deployBinaries + && !devicePath.isEmpty() + && (0 == devicePath.compare(project->values("APP_RESOURCE_DIR").join(""), Qt::CaseInsensitive) + || 0 == devicePath.compare(project->values("REG_RESOURCE_IMPORT_DIR").join(""), Qt::CaseInsensitive))) { + // 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"), Qt::CaseInsensitive)) { + if (devicePathHasDriveLetter) { + devicePath = epocRoot() + "epoc32\\winscw\\" + devicePath.remove(1, 1); + } else { + 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(SYSBIN_DIR), Qt::CaseInsensitive)) { + // Skip deploying to SYSBIN_DIR 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(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(), false, true), + Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + 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); + + 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 SYSBIN_DIR target path. + if (deployBinaries) { + deploymentList.append(CopyItem(Option::fixPathToLocalOS(absoluteItemPath + "\\" + iterator.fileName()), + Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + 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..029a897 --- /dev/null +++ b/qmake/generators/symbian/initprojectdeploy_symbian.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $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> + +#include "epocroot.h" + +struct CopyItem +{ + CopyItem(const QString& f, const QString& t) : from(f) , to(t) { } + QString from; + QString to; +}; +typedef QList<CopyItem> DeploymentList; + +extern QString generate_uid(const QString& target); +extern QString generate_test_uid(const QString& target); + +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 diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp new file mode 100644 index 0000000..3aa3c7b --- /dev/null +++ b/qmake/generators/symbian/symmake.cpp @@ -0,0 +1,1725 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $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 MMP_TARGET "TARGET" +#define MMP_TARGETTYPE "TARGETTYPE" +#define MMP_SECUREID "SECUREID" + +#define SISX_TARGET "sisx" +#define OK_SISX_TARGET "ok_sisx" +#define FAIL_SISX_NOPKG_TARGET "fail_sisx_nopkg" +#define FAIL_SISX_NOCACHE_TARGET "fail_sisx_nocache" +#define RESTORE_BUILD_TARGET "restore_build" + +#define PRINT_FILE_CREATE_ERROR(filename) fprintf(stderr, "Error: Could not create '%s'\n", qPrintable(filename)); + +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; + t << "// ============================================================================" << endl; + t << endl; + + // Defining define for bld.inf + + QString shortProFilename = project->projectFile(); + shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); + shortProFilename.replace(Option::pro_ext, 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 (targetType == TypeExe) { + generatePkg = true; + } else { + foreach(QString item, project->values("DEPLOYMENT")) { + if (!project->values(item + ".sources").isEmpty()) { + generatePkg = true; + break; + } + } + } + + if (generatePkg) { + generatePkgFile(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 { + PRINT_FILE_CREATE_ERROR(wrapperFileName); + return false; + } + + if (targetType == TypeSubdirs) { + // 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(Option::pro_ext, QString("")); + + QString mmpFilename = shortProFilename; + mmpFilename.append("_"); + mmpFilename.append(uid3); + mmpFilename.append(Option::mmp_ext); + writeMmpFile(mmpFilename, symbianLangCodes); + + if (targetType == TypeExe) { + if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + writeRegRssFile(userRssRules); + writeRssFile(numberOfIcons, iconFile); + writeLocFile(symbianLangCodes); + } + } + + writeCustomDefFile(); + writeWrapperMakefile(wrapperMakefile, isPrimaryMakefile); + + return true; +} + +void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile) +{ + QString pkgFilename = QString("%1_template.%2") + .arg(fixedTarget) + .arg("pkg"); + QFile pkgFile(pkgFilename); + if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + PRINT_FILE_CREATE_ERROR(pkgFilename); + return; + } + + 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; + + // Construct QStringList from pkg_prerules since we need search it before printed to file + QStringList rawPkgPreRules; + foreach(QString deploymentItem, project->values("DEPLOYMENT")) { + foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) { + QStringList pkgrulesValue = project->values(pkgrulesItem); + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line mmp statements + if (pkgrulesValue.isEmpty()) { + rawPkgPreRules << pkgrulesItem; + } else { + foreach(QString pkgrule, pkgrulesValue) { + rawPkgPreRules << pkgrule; + } + } + } + } + + // Apply some defaults if specific data does not exist in PKG pre-rules + + if (!containsStartWithItem('&', rawPkgPreRules)) { + // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) + t << "; Language" << endl; + t << "&EN" << endl << endl; + } else { + // In case user defines langs, he must take care also about SIS header + if (!containsStartWithItem('#', rawPkgPreRules)) + fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); + } + + // name of application, UID and version + QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); + + if (!containsStartWithItem('#', rawPkgPreRules)) { + QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET"))); + visualTarget = removePathSeparators(visualTarget); + + t << "; SIS header: name, uid, version" << endl; + t << QString("#{\"%1\"},(%2),%3").arg(visualTarget).arg(uid3).arg(applicationVersion) << endl << endl; + } + + // Localized vendor name + if (!containsStartWithItem('%', rawPkgPreRules)) { + t << "; Localised Vendor name" << endl; + t << "%{\"Vendor\"}" << endl << endl; + } + + // Unique vendor name + if (!containsStartWithItem(':', rawPkgPreRules)) { + t << "; Unique Vendor name" << endl; + t << ":\"Vendor\"" << endl << endl; + } + + // PKG pre-rules - these are added before actual file installations i.e. SISX package body + if (rawPkgPreRules.size()) { + t << "; Manual PKG pre-rules from PRO files" << endl; + foreach(QString item, rawPkgPreRules) { + t << item << 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/$(PLATFORM)/$(TARGET)") + .arg(epocRoot()); + + + if (targetType == TypeExe) { + // deploy .exe file + t << "; Executable and default resource files" << endl; + QString exeFile = fixedTarget + ".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(fixedTarget + ".rsc") + .arg(installPathResource) + .arg(fixedTarget + ".rsc") << endl; + + t << QString("\"%1epoc32/data/z/private/10003a3f/import/apps/%2\" - \"%3\\%4\"") + .arg(epocRoot()) + .arg(fixedTarget + "_reg.rsc") + .arg(installPathRegResource) + .arg(fixedTarget + "_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, "$(PLATFORM)", "$(TARGET)", 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; + } + t << endl; + + // PKG post-rules - these are added after actual file installations i.e. SIS package body + t << "; Manual PKG post-rules from PRO files" << endl; + foreach(QString deploymentItem, project->values("DEPLOYMENT")) { + foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_postrules")) { + QStringList pkgrulesValue = project->values(pkgrulesItem); + // If there is no stringlist defined for a rule, use rule name directly + // This is convenience for defining single line statements + if (pkgrulesValue.isEmpty()) { + t << pkgrulesItem << endl; + } else { + foreach(QString pkgrule, pkgrulesValue) { + t << pkgrule << endl; + } + } + t << endl; + } + } +} + +bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src) +{ + bool result = false; + foreach(QString str, src) { + if (str.startsWith(c)) { + result = true; + break; + } + } + return result; +} + +void SymbianMakefileGenerator::writeCustomDefFile() +{ + if (targetType == TypePlugin && !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 { + PRINT_FILE_CREATE_ERROR(QString(PLUGIN_COMMON_DEF_FILE_ACTUAL)) + } + } +} + +void SymbianMakefileGenerator::init() +{ + MakefileGenerator::init(); + fixedTarget = escapeFilePath(fileFixify(project->first("TARGET"))); + fixedTarget = removePathSeparators(fixedTarget); + removeSpecialCharacters(fixedTarget); + + if (0 != project->values("QMAKE_PLATFORM").size()) + platform = varGlue("QMAKE_PLATFORM", "", " ", ""); + + if (0 == project->values("QMAKESPEC").size()) + project->values("QMAKESPEC").append(qgetenv("QMAKESPEC")); + + project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); + project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); + + // bld.inf + project->values("MAKEFILE") += BLD_INF_FILENAME; + + // .mmp + initMmpVariables(); + + // Check TARGET.UID3 presence + if (0 != project->values("TARGET.UID3").size()) { + uid3 = project->first("TARGET.UID3"); + } else { + uid3 = generateUID3(); + } + + if ((project->values("TEMPLATE")).contains("app")) + targetType = TypeExe; + 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 = TypeLib; + else if (project->values("CONFIG").contains("plugin")) + targetType = TypePlugin; + else + targetType = TypeDll; + } else { + targetType = TypeSubdirs; + } + + 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 (targetType == TypeExe) { + if (project->values("QT").contains("gui", Qt::CaseInsensitive)) { + // exe and gui -> uid2 needed + uid2 = "0x100039CE"; + } else { + // exe but not gui: uid2 is ignored anyway -> set it to 0 + uid2 = "0"; + } + } else if (targetType == TypeDll || targetType == TypeLib || targetType == TypePlugin) { + 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\".\n", uid3.toUtf8().constData()); + } else { + privateDirUid.setNum(uidNum, 16); + while (privateDirUid.length() < 8) + privateDirUid.insert(0, QLatin1Char('0')); + } +} + +QString SymbianMakefileGenerator::getTargetExtension() +{ + QString ret; + if (targetType == TypeExe) { + ret.append("exe"); + } else if (targetType == TypeLib) { + ret.append("lib"); + } else if (targetType == TypeDll || targetType == TypePlugin) { + ret.append("dll"); + } else if (targetType == TypeSubdirs) { + // Not actually usable, so return empty + } else { + // If nothing else set, default to exe + ret.append("exe"); + } + + return ret; +} + +QString SymbianMakefileGenerator::generateUID3() +{ + QString target = project->first("TARGET"); + QString currPath = qmake_getpwd(); + target.prepend("/").prepend(currPath); + return generate_test_uid(target); +} + +void 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); + // As a workaround for Symbian toolchain insistence to treat include + // statements as relative to source file rather than the file they appear in, + // we generate extra temporary include directories to make + // relative include paths used in various headers to work properly. + // Note that this is not a fix-all solution; it's just a stop-gap measure + // to make Qt itself build until toolchain can support relative includes in + // a way that Qt expects. + if (!includepath.contains(epocPath)) // No temp dirs for epoc includes + appendIfnotExist(sysincspaths, includepath + QString("/" QT_EXTRA_INCLUDE_DIR)); + } + + // Remove duplicate include path entries + 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); +} + +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; +} + +void 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))) << Option::mmp_ext << endl; + t << "// ==============================================================================" << endl << endl; +} + +void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symbianLangCodes) +{ + QFile ft(filename); + if (ft.open(QIODevice::WriteOnly)) { + generatedFiles << ft.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; + + if (!project->values("CONFIG").contains("static") && !project->values("CONFIG").contains("staticlib")) { + writeMmpFileLibraryPart(t); + } + + writeMmpFileCapabilityPart(t); + + writeMmpFileCompilerOptionPart(t); + + writeMmpFileBinaryVersionPart(t); + + writeMmpFileRulesPart(t); + } else { + PRINT_FILE_CREATE_ERROR(filename) + } +} + +void SymbianMakefileGenerator::writeMmpFileMacrosPart(QTextStream& t) +{ + t << endl; + + 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; +} + +void SymbianMakefileGenerator::addMacro(QTextStream& t, const QString& value) +{ + t << "MACRO" << "\t\t" << value << endl; +} + + +void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) +{ + if (targetType == TypeExe) { + t << MMP_TARGET << "\t\t" << fixedTarget << ".exe" << endl; + if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + t << MMP_TARGETTYPE << "\t\t" << "STDEXE" << endl; + else + t << MMP_TARGETTYPE << "\t\t" << "EXE" << endl; + } else if (targetType == TypeDll || targetType == TypePlugin) { + t << MMP_TARGET << "\t\t" << fixedTarget << ".dll" << endl; + if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + t << MMP_TARGETTYPE << "\t\t" << "STDDLL" << endl; + else + t << MMP_TARGETTYPE << "\t\t" << "DLL" << endl; + } else if (targetType == TypeLib) { + t << MMP_TARGET << "\t\t" << fixedTarget << ".lib" << endl; + if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + t << MMP_TARGETTYPE << "\t\t" << "STDLIB" << endl; + else + t << MMP_TARGETTYPE << "\t\t" << "LIB" << endl; + } else { + fprintf(stderr, "Error: Unexpected targettype (%d) in SymbianMakefileGenerator::writeMmpFileTargetPart\n", targetType); + } + + t << endl; + + t << "UID" << "\t\t" << uid2 << " " << uid3 << endl; + + if (0 != project->values("TARGET.SID").size()) { + t << MMP_SECUREID << "\t\t" << project->values("TARGET.SID").join(" ") << endl; + } else { + if (0 == uid3.size()) + t << MMP_SECUREID << "\t\t" << "0" << endl; + else + t << MMP_SECUREID << "\t\t" << uid3 << endl; + } + + // default value used from mkspecs 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 == TypePlugin && !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; +} + + +/* + Application registration resource files should be installed to the + \private\10003a3f\import\apps directory. +*/ +void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) +{ + if ((targetType == TypeExe) && + !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + + QString locTarget = fixedTarget; + 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; + + QString regTarget = fixedTarget; + regTarget.append("_reg.rss"); + + t << "SOURCEPATH\t\t\t." << endl; + t << "START RESOURCE\t\t" << regTarget << endl; + if (isForSymbianSbsv2()) + t << "DEPENDS " << fixedTarget << ".rsg" << endl; + t << "TARGETPATH\t\t" REGISTRATION_RESOURCE_DIRECTORY_HW << endl; + t << "END" << endl << endl; + } +} + +void 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; +} + +void SymbianMakefileGenerator::writeMmpFileIncludePart(QTextStream& t) +{ + writeMmpFileSystemIncludePart(t); +} + +void SymbianMakefileGenerator::writeMmpFileLibraryPart(QTextStream& t) +{ + QStringList &libs = project->values("LIBS"); + libs << project->values("QMAKE_LIBS") << project->values("QMAKE_LIBS_PRIVATE"); + + 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 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; +} + +void 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; +} + +void 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; + + t << endl; +} + +void 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; +} + +void 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; + } + } + } +} + +void 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("."), 4, Option::mmp_ext); + 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 we 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(Option::mmp_ext, Option::pro_ext); + QString uid = generate_uid(fullProFilename); + + QString cleanMmpName = fullProFilename; + cleanMmpName.replace(Option::pro_ext, 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 + 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 (targetType == TypeSubdirs) { + mmpProjects.removeOne(mmpfilename); + } else { + QString shortProFilename = project->projectFile(); + shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString("")); + shortProFilename.replace(Option::pro_ext, QString("")); + + QString mmpFilename = shortProFilename + QString("_") + uid3 + Option::mmp_ext; + + 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; + } +} + +void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) +{ + QString filename(fixedTarget); + 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 <" << fixedTarget << ".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=\"" << fixedTarget << "\";" << endl; + t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; + t << endl; + + foreach(QString item, userItems) + t << "\t" << item << endl; + t << "\t}" << endl; + } else { + PRINT_FILE_CREATE_ERROR(filename) + } +} + +void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) +{ + QString filename(fixedTarget); + 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 \"" << fixedTarget << ".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 { + PRINT_FILE_CREATE_ERROR(filename); + } +} + +void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes) +{ + QString filename(fixedTarget); + 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 << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; + foreach(QString lang, symbianLangCodes) { + t << "#elif defined LANGUAGE_" << lang << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; + } + t << "#else" << endl; + t << "#define STRING_r_short_caption \"" << fixedTarget << "\"" << endl; + t << "#define STRING_r_caption \"" << fixedTarget << "\"" << endl; + t << "#endif" << endl; + } else { + PRINT_FILE_CREATE_ERROR(filename); + } +} + +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; +} + +void 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 + } +} + +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("_")); +} + +void SymbianMakefileGenerator::writeSisxTargets(QTextStream &t) +{ + t << SISX_TARGET ": " RESTORE_BUILD_TARGET << endl; + QString sisxcommand = QString("\t$(if $(wildcard %1_template.%2),$(if $(wildcard %3)," \ + "$(MAKE) -s -f $(MAKEFILE) %4,$(MAKE) -s -f $(MAKEFILE) %5)," \ + "$(MAKE) -s -f $(MAKEFILE) %6)") + .arg(fixedTarget) + .arg("pkg") + .arg(MAKE_CACHE_NAME) + .arg(OK_SISX_TARGET) + .arg(FAIL_SISX_NOCACHE_TARGET) + .arg(FAIL_SISX_NOPKG_TARGET); + t << sisxcommand << endl; + t << endl; + + t << OK_SISX_TARGET ":" << endl; + + QString pkgcommand = QString("\tcreatepackage.bat $(QT_SISX_OPTIONS) %1_template.%2 $(QT_SISX_TARGET) " \ + "$(QT_SISX_CERTIFICATE) $(QT_SISX_KEY) $(QT_SISX_PASSPHRASE)") + .arg(fixedTarget) + .arg("pkg"); + t << pkgcommand << endl; + t << endl; + + t << FAIL_SISX_NOPKG_TARGET ":" << endl; + t << "\t$(error PKG file does not exist, 'SISX' target is only supported for executables or projects with DEPLOYMENT statement)" << endl; + t << endl; + + t << FAIL_SISX_NOCACHE_TARGET ":" << endl; + t << "\t$(error Project has to be build before calling 'SISX' target)" << endl; + t << endl; + + + t << RESTORE_BUILD_TARGET ":" << endl; + t << "-include " MAKE_CACHE_NAME << endl; + t << endl; +} + +void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& 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.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; +} diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h new file mode 100644 index 0000000..ce65822 --- /dev/null +++ b/qmake/generators/symbian/symmake.h @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SYMMAKEFILE_H +#define SYMMAKEFILE_H + +#include <makefile.h> + +QT_BEGIN_NAMESPACE + +#define BLD_INF_FILENAME "bld.inf" +#define MAKEFILE_DEPENDENCY_SEPARATOR " \\\n\t" + +#define QT_EXTRA_INCLUDE_DIR "tmp" +#define MAKE_CACHE_NAME ".make.cache" + +class SymbianMakefileGenerator : public MakefileGenerator +{ +protected: + enum TargetType { + TypeExe, + TypeDll, + TypeLib, + TypePlugin, + TypeSubdirs + }; + + QString platform; + QString uid2; + QString uid3; + QString privateDirUid; + TargetType 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; + + QString fixedTarget; + + void removeSpecialCharacters(QString& str); + QString fixPathForMmp(const QString& origPath, const QDir& parentDir); + QString canonizePath(const QString& origPath); + + virtual bool writeMakefile(QTextStream &t); + void generatePkgFile(const QString &iconFile); + bool containsStartWithItem(const QChar &c, const QStringList& src); + + virtual void init(); + + QString getTargetExtension(); + + QString generateUID3(); + + void initMmpVariables(); + + void writeHeader(QTextStream &t); + void writeBldInfContent(QTextStream& t, bool addDeploymentExtension); + + static bool removeDuplicatedStrings(QStringList& stringList); + + void writeMmpFileHeader(QTextStream &t); + void writeMmpFile(QString &filename, QStringList &symbianLangCodes); + void writeMmpFileMacrosPart(QTextStream& t); + void addMacro(QTextStream& t, const QString& value); + void writeMmpFileTargetPart(QTextStream& t); + void writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes); + void writeMmpFileSystemIncludePart(QTextStream& t); + void writeMmpFileIncludePart(QTextStream& t); + void writeMmpFileLibraryPart(QTextStream& t); + void writeMmpFileCapabilityPart(QTextStream& t); + void writeMmpFileCompilerOptionPart(QTextStream& t); + void writeMmpFileBinaryVersionPart(QTextStream& t); + void writeMmpFileRulesPart(QTextStream& t); + + void writeCustomDefFile(); + + void writeRegRssFile(QStringList &useritems); + void writeRssFile(QString &numberOfIcons, QString &iconfile); + void writeLocFile(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); + void generateCleanCommands(QTextStream& t, + const QStringList& toClean, + const QString& cmd, + const QString& cmdOptions, + const QString& itemPrefix, + const QString& itemSuffix); + + void writeSisxTargets(QTextStream &t); + void generateDistcleanTargets(QTextStream& t); + + // Subclass implements + virtual void writeBldInfExtensionRulesPart(QTextStream& t) = 0; + virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension) = 0; + virtual void 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..49cd7ed --- /dev/null +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -0,0 +1,452 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $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" +#define STORE_BUILD_TARGET "store_build" + +SymbianAbldMakefileGenerator::SymbianAbldMakefileGenerator() : SymbianMakefileGenerator() { } +SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } + +void 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 << "VISUAL_CFG = RELEASE" << endl; + t << "ifeq \"$(CFG)\" \"UDEB\"" << endl; + t << "VISUAL_CFG = DEBUG" << endl; + t << "endif" << 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(STORE_BUILD_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 + << STORE_BUILD_TARGET; + } else { + buildDeps.append(CREATE_TEMPS_TARGET " " PRE_TARGETDEPS_TARGET " " STORE_BUILD_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 + << STORE_BUILD_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 << " QT_SISX_TARGET=$(VISUAL_CFG)-$(PLATFORM)" << endl << endl; + } + + t << endl; + } // if(ft.open(QIODevice::WriteOnly)) +} + +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 + + 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; + + t << "MAKEFILE = " << wrapperFile.fileName() << 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 << "MOVE = " << var("QMAKE_MOVE") << 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 (targetType != TypeSubdirs) { + writeExtraTargets(t); + writeExtraCompilerTargets(t); + + t << CREATE_TEMPS_TARGET ":" << endl; + // generate command lines like this ... + // -@ if NOT EXIST ".\somedir" mkdir ".\somedir" + QStringList dirsToClean; + for (QMap<QString, QStringList>::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { + QStringList values = it.value(); + for (int i = 0; i < values.size(); ++i) { + if (values.at(i).endsWith("/" QT_EXTRA_INCLUDE_DIR)) { + QString fixedValue(QDir::toNativeSeparators(values.at(i))); + dirsToClean << fixedValue; + t << "\t-@ if NOT EXIST \"" << fixedValue << "\" mkdir \"" + << fixedValue << "\"" << 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; + generateCleanCommands(t, dirsToClean, var("QMAKE_DEL_DIR"), " /S /Q ", "", ""); + 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); + + writeSisxTargets(t); + + writeStoreBuildTarget(t); + + generateDistcleanTargets(t); + + t << "clean: $(ABLD)" << endl; + t << "\t-$(ABLD)" << testClause << " reallyclean" << endl; + t << "\t-bldmake clean" << endl; + t << endl; + + // Create execution target + if (debugPlatforms.contains("winscw") && targetType == TypeExe) { + t << "run:" << endl; + t << "\t-call " << epocRoot() << "epoc32\\release\\winscw\\udeb\\" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; + } +} + +void SymbianAbldMakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t) +{ + // We don't use extensions for anything in abld + Q_UNUSED(t); +} + +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::writeStoreBuildTarget(QTextStream &t) +{ + t << STORE_BUILD_TARGET ":" << endl; + t << "\t@echo # ============================================================================== > " MAKE_CACHE_NAME << endl; + t << "\t@echo # This file is generated by make and should not be modified by the user >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Name : " << MAKE_CACHE_NAME << " >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Part of : " << project->values("TARGET").join(" ") << " >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Description : This file is used to cache last build target for >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # make sisx target. >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # Version : >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # >> " MAKE_CACHE_NAME << endl; + t << "\t@echo # ============================================================================== >> " MAKE_CACHE_NAME << endl; + t << "\t@echo. >> " MAKE_CACHE_NAME << endl; + t << "\t@echo QT_SISX_TARGET ?= $(QT_SISX_TARGET) >> " MAKE_CACHE_NAME << endl; + t << endl; + + generatedFiles << MAKE_CACHE_NAME; +} + +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 (targetType != TypeSubdirs || 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..67da43e --- /dev/null +++ b/qmake/generators/symbian/symmake_abld.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $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 void writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); + virtual void writeMkFile(const QString& wrapperFileName, bool deploymentOnly); + virtual void writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile); + + void writeStoreBuildTarget(QTextStream &t); + 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..9891a2e --- /dev/null +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -0,0 +1,416 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $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; + } +} + +void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) +{ + // Can't use extension makefile with sbsv2 + Q_UNUSED(wrapperFileName); + Q_UNUSED(deploymentOnly); +} + +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 + + 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; + t << "MAKEFILE = " << wrapperFile.fileName() << 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 << "MOVE = " << var("QMAKE_MOVE") << 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 (targetType != TypeSubdirs) { + t << extraTargetsCache; + t << extraCompilersCache; + } else { + QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets(); + writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets); + qDeleteAll(subtargets); + } + + writeSisxTargets(t); + + generateDistcleanTargets(t); + + t << "clean: " << BLD_INF_FILENAME << endl; + t << "\t-$(SBS) reallyclean" << endl; + t << endl; + + // create execution target + if (debugPlatforms.contains("winscw") && targetType == TypeExe) { + t << "run:" << endl; + t << "\t-call " << epocRoot() << "epoc32/release/winscw/udeb/" << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".exe")) << endl << endl; + } +} + +void 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_INTERNAL_ET_PARSED_TARGETS.") + item)) { + // Make sure targetpath is absolute + QString absoluteTarget = fileInfo(targetItem).absoluteFilePath(); + if (allPreDeps.contains(absoluteTarget)) { + QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem); + QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_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; + + 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; + + // 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'.", qPrintable(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; + } + + // Generate temp dirs + QString tempDirs; + 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 value = values.at(i); + if (value.endsWith("/" QT_EXTRA_INCLUDE_DIR)) { + value = fileInfo(value).absoluteFilePath(); + tempDirs.append(value); + tempDirs.append(" "); + } + } + } + + if (tempDirs.size()) + tempDirs.chop(1); // Remove final space + + t << "START EXTENSION qt/qmake_generate_temp_dirs" << endl; + t << "OPTION DIRS " << tempDirs << endl; + t << "END" << endl; + t << endl; + + t << "START EXTENSION qt/qmake_store_build" << endl; + t << "END" << endl; + t << endl; + + t << endl; +} + +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..7f78834 --- /dev/null +++ b/qmake/generators/symbian/symmake_sbsv2.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake application 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 http://qt.nokia.com/contact. +** $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 void writeBldInfExtensionRulesPart(QTextStream& t); + virtual void writeBldInfMkFilePart(QTextStream& t, bool addDeploymentExtension); + virtual void 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/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 2e6397b..f6b6469 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -1,11 +1,11 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the qmake application of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:LGPL$ +** +** This file is part of the qmake application 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 @@ -36,11 +36,8 @@ ** ** ** $QT_END_LICENSE$ - ** - ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - ** - ****************************************************************************/ +** +****************************************************************************/ #include "unixmake.h" #include "option.h" @@ -127,6 +124,7 @@ UnixMakefileGenerator::init() project->values("QMAKE_ORIG_TARGET") = project->values("TARGET"); project->values("QMAKE_ORIG_DESTDIR") = project->values("DESTDIR"); project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); + project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); if((!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib")) || (project->isActiveConfig("qt") && project->isActiveConfig("plugin"))) { if(configs.indexOf("dll") == -1) configs.append("dll"); @@ -261,7 +259,7 @@ UnixMakefileGenerator::init() bundle += project->first("QMAKE_BUNDLE_EXTENSION"); else if(!bundle.endsWith(".plugin")) bundle += ".plugin"; - if(!project->isEmpty("QMAKE_BUNDLE_LOCATION")) + if(project->isEmpty("QMAKE_BUNDLE_LOCATION")) project->values("QMAKE_BUNDLE_LOCATION").append("Contents/MacOS"); } else { if(!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) @@ -441,7 +439,7 @@ UnixMakefileGenerator::findLibraries() QList<QMakeLocalFileName> libdirs, frameworkdirs; frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks")); frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks")); - const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LFLAGS", "QMAKE_LIBS", QString() }; + const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LFLAGS", "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() }; for(int i = 0; !lflags[i].isNull(); i++) { QStringList &l = project->values(lflags[i]); for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { @@ -763,7 +761,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) if(!project->isEmpty("QMAKE_RANLIB")) ret += QString("\n\t$(RANLIB) \"") + dst_targ + "\""; } else if(!project->isActiveConfig("debug") && !project->isActiveConfig("nostrip") && !project->isEmpty("QMAKE_STRIP")) { - ret += "\n\t-" + var("QMAKE_STRIP"); + ret += "\n\t-$(STRIP)"; if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB")) ret += " " + var("QMAKE_STRIPFLAGS_LIB"); else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP")) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 03884a7..2b63f3f 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -149,7 +149,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "LINK = " << var("QMAKE_LINK") << endl; t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_FRAMEWORKDIR_FLAGS") << " " - << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; + << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << " " << var("QMAKE_LIBS_PRIVATE") << endl; } t << "AR = " << var("QMAKE_AR") << endl; @@ -163,6 +163,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl; t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; + t << "STRIP = " << var("QMAKE_STRIP") << endl; t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; @@ -1423,13 +1424,6 @@ UnixMakefileGenerator::writePkgConfigFile() t << "Version: " << project->first("VERSION") << endl; // libs - QStringList libs; - if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) { - libs = project->values("QMAKE_INTERNAL_PRL_LIBS"); - } else { - libs << "QMAKE_LIBS"; //obvious one - } - libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? t << "Libs: "; QString pkgConfiglibDir; QString pkgConfiglibName; @@ -1449,6 +1443,15 @@ UnixMakefileGenerator::writePkgConfigFile() pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length()); } t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl; + + QStringList libs; + if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) { + libs = project->values("QMAKE_INTERNAL_PRL_LIBS"); + } else { + libs << "QMAKE_LIBS"; //obvious one + } + libs << "QMAKE_LIBS_PRIVATE"; + libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? t << "Libs.private: "; for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) { t << project->values((*it)).join(" ") << " "; diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index a743e47..a8a138f 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -82,7 +82,12 @@ QString MingwMakefileGenerator::getLibTarget() bool MingwMakefileGenerator::findLibraries() { - QStringList &l = project->values("QMAKE_LIBS"); + return findLibraries("QMAKE_LIBS") && findLibraries("QMAKE_LIBS_PRIVATE"); +} + +bool MingwMakefileGenerator::findLibraries(const QString &where) +{ + QStringList &l = project->values(where); QList<QMakeLocalFileName> dirs; { @@ -258,6 +263,7 @@ void MingwMakefileGenerator::init() // LIBS defined in Profile comes first for gcc project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); + project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); QString targetfilename = project->values("TARGET").first(); QStringList &configs = project->values("CONFIG"); @@ -344,7 +350,8 @@ void MingwMakefileGenerator::writeLibsPart(QTextStream &t) t << "LIBS = "; if(!project->values("QMAKE_LIBDIR").isEmpty()) writeLibDirPart(t); - t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl; + t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << ' ' + << var("QMAKE_LIBS_PRIVATE").replace(QRegExp("(\\slib|^lib)")," -l") << endl; } } diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 94cb06a..e044e63 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -72,6 +72,7 @@ private: QString preCompHeaderOut; virtual bool findLibraries(); + bool findLibraries(const QString &where); void fixTargetExt(); bool init_flag; diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 15bdbd4..3245cc2 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp @@ -682,7 +682,7 @@ void DspMakefileGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; subdirs.append(profile); } else { QMakeProject tmp_proj; diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index c016a7f..a45ea0e 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -172,6 +172,7 @@ void NmakeMakefileGenerator::init() } project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); + project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); processVars(); if (!project->values("RES_FILE").isEmpty()) { diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index b3f5908..03d70b6 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -49,9 +49,9 @@ QT_BEGIN_NAMESPACE // XML Tags --------------------------------------------------------- const char _Configuration[] = "Configuration"; const char _Configurations[] = "Configurations"; -const char _File[] = "File"; +const char q_File[] = "File"; const char _FileConfiguration[] = "FileConfiguration"; -const char _Files[] = "Files"; +const char q_Files[] = "Files"; const char _Filter[] = "Filter"; const char _Globals[] = "Globals"; const char _Platform[] = "Platform"; @@ -484,7 +484,7 @@ bool VCCLCompilerTool::parseOption(const char* option) QString opt(option); if (opt.contains('a') && !opt.contains('s') && !opt.contains('c')) ExceptionHandling = ehSEH; - else if (!opt.contains('a') && opt.contains("s-") && opt.contains("c-")) + else if (!opt.contains('a') && opt.contains("s-") && opt.contains("c-")) ExceptionHandling = ehNone; else if (!opt.contains('a') && opt.contains('s') && opt.contains('c')) ExceptionHandling = ehNoSEH; @@ -2381,11 +2381,11 @@ XmlOutput &operator<<(XmlOutput &xml, VCFilter &tool) } for (int i = 0; i < tool.Files.count(); ++i) { const VCFilterFile &info = tool.Files.at(i); - xml << tag(_File) + xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)) << data(); // In case no custom builds, to avoid "/>" endings tool.outputFileConfig(xml, tool.Files.at(i).file); - xml << closetag(_File); + xml << closetag(q_File); } if (!tool.Name.isEmpty()) xml << closetag(_Filter); @@ -2421,7 +2421,7 @@ XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool) << tag(_Configurations) << tool.Configuration; xml << closetag(_Configurations) - << tag(_Files); + << tag(q_Files); // Add this configuration into a multi-config project, since that's where we have the flat/tree // XML output functionality VCProject tempProj; @@ -2437,7 +2437,7 @@ XmlOutput &operator<<(XmlOutput &xml, const VCProjectSingleConfig &tool) tempProj.outputFilter(xml, tempProj.ExtraCompilers.at(x)); } tempProj.outputFilter(xml, "RootFiles"); - xml << closetag(_Files) + xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag return xml; @@ -2492,7 +2492,7 @@ void VCProject::outputFileConfigs(XmlOutput &xml, const VCFilterFile &info, const QString &filtername) { - xml << tag(_File) + xml << tag(q_File) << attrS(_RelativePath, Option::fixPathToLocalOS(info.file)); for (int i = 0; i < SingleProjects.count(); ++i) { VCFilter filter; @@ -2520,7 +2520,7 @@ void VCProject::outputFileConfigs(XmlOutput &xml, if (filter.Config) // only if the filter is not empty filter.outputFileConfig(xml, info.file); } - xml << closetag(_File); + xml << closetag(q_File); } // outputs a given filter for all existing configurations of a project @@ -2615,7 +2615,7 @@ XmlOutput &operator<<(XmlOutput &xml, VCProject &tool) for (int i = 0; i < tool.SingleProjects.count(); ++i) xml << tool.SingleProjects.at(i).Configuration; xml << closetag(_Configurations) - << tag(_Files); + << tag(q_Files); tool.outputFilter(xml, "Sources"); tool.outputFilter(xml, "Headers"); tool.outputFilter(xml, "GeneratedFiles"); @@ -2627,7 +2627,7 @@ XmlOutput &operator<<(XmlOutput &xml, VCProject &tool) tool.outputFilter(xml, tool.ExtraCompilers.at(x)); } tool.outputFilter(xml, "RootFiles"); - xml << closetag(_Files) + xml << closetag(q_Files) << tag(_Globals) << data(); // No "/>" end tag return xml; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 66c2248..26afb68 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -120,14 +120,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QString rSubkeyPath = keyPath(rSubkey); HKEY handle = 0; - LONG res; - QT_WA( { - res = RegOpenKeyExW(parentHandle, (WCHAR*)rSubkeyPath.utf16(), - 0, KEY_READ, &handle); - } , { - res = RegOpenKeyExA(parentHandle, rSubkeyPath.toLocal8Bit(), - 0, KEY_READ, &handle); - } ); + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, KEY_READ, &handle); if (res != ERROR_SUCCESS) return QString(); @@ -135,11 +128,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the size and type of the value DWORD dataType; DWORD dataSize; - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, &dataType, 0, &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -147,13 +136,8 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) // get the value QByteArray data(dataSize, 0); - QT_WA( { - res = RegQueryValueExW(handle, (WCHAR*)rSubkeyName.utf16(), 0, 0, - reinterpret_cast<unsigned char*>(data.data()), &dataSize); - }, { - res = RegQueryValueExA(handle, rSubkeyName.toLocal8Bit(), 0, 0, - reinterpret_cast<unsigned char*>(data.data()), &dataSize); - } ); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, + reinterpret_cast<unsigned char*>(data.data()), &dataSize); if (res != ERROR_SUCCESS) { RegCloseKey(handle); return QString(); @@ -163,11 +147,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) switch (dataType) { case REG_EXPAND_SZ: case REG_SZ: { - QT_WA( { - result = QString::fromUtf16(((const ushort*)data.constData())); - }, { - result = QString::fromLatin1(data.constData()); - } ); + result = QString::fromWCharArray(((const wchar_t *)data.constData())); break; } @@ -175,12 +155,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) QStringList l; int i = 0; for (;;) { - QString s; - QT_WA( { - s = QString::fromUtf16((const ushort*)data.constData() + i); - }, { - s = QString::fromLatin1(data.constData() + i); - } ); + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); i += s.length() + 1; if (s.isEmpty()) @@ -193,11 +168,7 @@ static QString readRegistryKey(HKEY parentHandle, const QString &rSubkey) case REG_NONE: case REG_BINARY: { - QT_WA( { - result = QString::fromUtf16((const ushort*)data.constData(), data.size()/2); - }, { - result = QString::fromLatin1(data.constData(), data.size()); - } ); + result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); break; } @@ -524,7 +495,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) QString profile = tmp; if(!profile.endsWith(Option::dir_sep)) profile += Option::dir_sep; - profile += fi.baseName() + ".pro"; + profile += fi.baseName() + Option::pro_ext; subdirs.append(profile); } else { QMakeProject tmp_proj; @@ -652,7 +623,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) } // Add all unknown libs to the deps - QStringList where("QMAKE_LIBS"); + QStringList where = QStringList() << "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE"; if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; for(QStringList::iterator wit = where.begin(); @@ -1268,9 +1239,8 @@ void VcprojGenerator::initDeploymentTool() foreach(QString item, project->values("DEPLOYMENT")) { // get item.path QString devicePath = project->first(item + ".path"); - // if the path does not exist, skip it if (devicePath.isEmpty()) - continue; + devicePath = targetPath; // check if item.path is relative (! either /,\ or %) if (!(devicePath.at(0) == QLatin1Char('/') || devicePath.at(0) == QLatin1Char('\\') @@ -1291,7 +1261,13 @@ void VcprojGenerator::initDeploymentTool() searchPath = info.absoluteFilePath(); } else { nameFilter = source.split('\\').last(); - searchPath = info.absolutePath(); + if (source.contains('*')) { + source = source.split('*').first(); + info = QFileInfo(source); + } + searchPath = info.absolutePath(); + if (!info.exists()) + fprintf(stderr, "Deployment file is missing %s\n", source.toLatin1().constData()); } int pathSize = searchPath.size(); @@ -1580,6 +1556,7 @@ void VcprojGenerator::initOld() } project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS")); + project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE")); // Get filename w/o extension ----------------------------------- QString msvcproj_project = ""; @@ -1623,6 +1600,7 @@ void VcprojGenerator::initOld() // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS"); + project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS_PRIVATE"); project->values("MSVCPROJ_LFLAGS") += project->values("QMAKE_LFLAGS"); if(!project->values("QMAKE_LIBDIR").isEmpty()) { QStringList strl = project->values("QMAKE_LIBDIR"); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 2d7151b..ba97c50 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -708,7 +708,7 @@ void Win32MakefileGenerator::writeLibsPart(QTextStream &t) if(!project->values("QMAKE_LIBDIR").isEmpty()) writeLibDirPart(t); t << var("QMAKE_LFLAGS") << endl; - t << "LIBS = " << var("QMAKE_LIBS") << endl; + t << "LIBS = " << var("QMAKE_LIBS") << " " << var("QMAKE_LIBS_PRIVATE") << endl; } } diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 4219eed..25dd9dc 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -89,7 +89,7 @@ inline Win32MakefileGenerator::~Win32MakefileGenerator() { } inline bool Win32MakefileGenerator::findLibraries() -{ return findLibraries("QMAKE_LIBS"); } +{ return findLibraries("QMAKE_LIBS") && findLibraries("QMAKE_LIBS_PRIVATE"); } QT_END_NAMESPACE diff --git a/qmake/main.cpp b/qmake/main.cpp index 662e67c..02e0540 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -98,17 +98,6 @@ int runQMake(int argc, char **argv) return 0; } - // report Qt usage for commercial customers with a "metered license" (currently experimental) -#if QT_EDITION != QT_EDITION_OPENSOURCE - QString reporterPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator() - + "qtusagereporter"; -#if defined(Q_OS_WIN) - reporterPath += ".exe"; -#endif - if (QFile::exists(reporterPath)) - system(qPrintable(reporterPath + " qmake")); -#endif - QString oldpwd = qmake_getpwd(); #ifdef Q_WS_WIN if(!(oldpwd.length() == 3 && oldpwd[0].isLetter() && oldpwd.endsWith(":/"))) diff --git a/qmake/option.cpp b/qmake/option.cpp index 3af374c..6b6d18c 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -68,6 +68,7 @@ QString Option::obj_ext; QString Option::lex_ext; QString Option::yacc_ext; QString Option::pro_ext; +QString Option::mmp_ext; QString Option::dir_sep; QString Option::dirlist_sep; QString Option::h_moc_mod; @@ -99,8 +100,6 @@ QStringList Option::shellPath; Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE; #elif defined(Q_OS_MAC) Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE; -#elif defined(Q_OS_QNX6) -Option::TARG_MODE Option::target_mode = Option::TARG_QNX6_MODE; #else Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE; #endif @@ -152,6 +151,9 @@ bool usage(const char *a0) " In this mode qmake interprets files as files to\n" " be built,\n" " defaults to %s\n" + " Note: The created .pro file probably will \n" + " need to be edited. For example add the QT variable to \n" + " specify what modules are required.\n" " -makefile Put qmake into makefile generation mode%s\n" " In this mode qmake interprets files as project files to\n" " be processed, if skipped qmake will try to find a project\n" @@ -381,6 +383,7 @@ Option::init(int argc, char **argv) Option::lex_ext = ".l"; Option::yacc_ext = ".y"; Option::pro_ext = ".pro"; + Option::mmp_ext = ".mmp"; #ifdef Q_OS_WIN Option::dirlist_sep = ";"; Option::shellPath = detectShellPath(); @@ -716,16 +719,9 @@ QString qmake_libraryInfoFile() { QString ret; #if defined( Q_OS_WIN ) - QFileInfo filePath; - QT_WA({ - unsigned short module_name[256]; - GetModuleFileNameW(0, reinterpret_cast<wchar_t *>(module_name), sizeof(module_name)); - filePath = QString::fromUtf16(module_name); - }, { - char module_name[256]; - GetModuleFileNameA(0, module_name, sizeof(module_name)); - filePath = QString::fromLocal8Bit(module_name); - }); + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, MAX_PATH); + QFileInfo filePath = QString::fromWCharArray(module_name); ret = filePath.filePath(); #else QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0)); diff --git a/qmake/option.h b/qmake/option.h index 86cb8e0..26bedfa 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -92,6 +92,7 @@ struct Option static QString dirlist_sep; static QString sysenv_mod; static QString pro_ext; + static QString mmp_ext; static QString res_ext; static char field_sep; static const char *application_argv0; @@ -149,7 +150,7 @@ struct Option static int warn_level; static bool recursive; static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs; - enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_QNX6_MODE }; + enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE }; static TARG_MODE target_mode; static QString user_template, user_template_prefix; static QStringList shellPath; diff --git a/qmake/project.cpp b/qmake/project.cpp index a3c8cbb..f630801 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -44,6 +44,8 @@ #include "option.h" #include "cachekeys.h" +#include "epocroot.h" + #include <qdatetime.h> #include <qfile.h> #include <qfileinfo.h> @@ -76,7 +78,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_SIZE }; QMap<QString, ExpandFunc> qmake_expandFunctions() { static QMap<QString, ExpandFunc> *qmake_expand_functions = 0; @@ -107,6 +110,7 @@ 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("size", E_SIZE); } return *qmake_expand_functions; } @@ -153,91 +157,6 @@ QMap<QString, TestFunc> qmake_testFunctions() return *qmake_test_functions; } -QT_END_NAMESPACE - -#ifdef QTSCRIPT_SUPPORT -#include "qscriptvalue.h" -#include "qscriptengine.h" -#include "qscriptvalueiterator.h" - -QT_BEGIN_NAMESPACE - -static QScriptValue qscript_projectWrapper(QScriptEngine *eng, QMakeProject *project, - const QMap<QString, QStringList> &place); - -static bool qscript_createQMakeProjectMap(QMap<QString, QStringList> &vars, QScriptValue js) -{ - QScriptValueIterator it(js); - while(it.hasNext()) { - it.next(); - vars[it.name()] = qscriptvalue_cast<QStringList>(it.value()); - } - return true; -} - -static QScriptValue qscript_call_testfunction(QScriptContext *context, QScriptEngine *engine) -{ - QMakeProject *self = qscriptvalue_cast<QMakeProject*>(context->callee().property("qmakeProject")); - QString func = context->callee().property("functionName").toString(); - QStringList args; - for(int i = 0; i < context->argumentCount(); ++i) - args += context->argument(i).toString(); - QMap<QString, QStringList> place = self->variables(); - qscript_createQMakeProjectMap(place, engine->globalObject().property("qmake")); - QScriptValue ret(engine, self->doProjectTest(func, args, place)); - engine->globalObject().setProperty("qmake", qscript_projectWrapper(engine, self, place)); - return ret; -} - -static QScriptValue qscript_call_expandfunction(QScriptContext *context, QScriptEngine *engine) -{ - QMakeProject *self = qscriptvalue_cast<QMakeProject*>(context->callee().property("qmakeProject")); - QString func = context->callee().property("functionName").toString(); - QStringList args; - for(int i = 0; i < context->argumentCount(); ++i) - args += context->argument(i).toString(); - QMap<QString, QStringList> place = self->variables(); - qscript_createQMakeProjectMap(place, engine->globalObject().property("qmake")); - QScriptValue ret = qScriptValueFromValue(engine, self->doProjectExpand(func, args, place)); - engine->globalObject().setProperty("qmake", qscript_projectWrapper(engine, self, place)); - return ret; -} - -static QScriptValue qscript_projectWrapper(QScriptEngine *eng, QMakeProject *project, - const QMap<QString, QStringList> &place) -{ - QScriptValue ret = eng->newObject(); - { - QStringList testFuncs = qmake_testFunctions().keys() + project->userTestFunctions(); - for(int i = 0; i < testFuncs.size(); ++i) { - QString funcName = testFuncs.at(i); - QScriptValue fun = eng->newFunction(qscript_call_testfunction); - fun.setProperty("qmakeProject", eng->newVariant(qVariantFromValue(project))); - fun.setProperty("functionName", QScriptValue(eng, funcName)); - eng->globalObject().setProperty(funcName, fun); - } - } - { - QStringList testFuncs = qmake_expandFunctions().keys() + project->userExpandFunctions(); - for(int i = 0; i < testFuncs.size(); ++i) { - QString funcName = testFuncs.at(i); - QScriptValue fun = eng->newFunction(qscript_call_expandfunction); - fun.setProperty("qmakeProject", eng->newVariant(qVariantFromValue(project))); - fun.setProperty("functionName", QScriptValue(eng, funcName)); - eng->globalObject().setProperty(funcName, fun); - } - } - for(QMap<QString, QStringList>::ConstIterator it = place.begin(); it != place.end(); ++it) - ret.setProperty(it.key(), qScriptValueFromValue(eng, it.value())); - return ret; -} - -QT_END_NAMESPACE - -#endif - -QT_BEGIN_NAMESPACE - struct parser_info { QString file; int line_no; @@ -588,6 +507,68 @@ 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,19 +595,25 @@ 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"; break; - case Option::TARG_QNX6_MODE: //also a unix - concat << base_concat + QDir::separator() + "qnx6"; - concat << base_concat + QDir::separator() + "unix"; - break; } concat << base_concat; } @@ -1475,6 +1462,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); @@ -1521,8 +1511,8 @@ QMakeProject::read(uchar cmd) if(cmd & ReadProFile) { // parse project file debug_msg(1, "Project file: reading %s", pfile.toLatin1().constData()); - if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(".pro")) - pfile += ".pro"; + if(pfile != "-" && !QFile::exists(pfile) && !pfile.endsWith(Option::pro_ext)) + pfile += Option::pro_ext; if(!read(pfile, vars)) return false; } @@ -1609,25 +1599,32 @@ 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 || + if((Option::target_mode == Option::TARG_MACX_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; - 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 +1715,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); } @@ -1803,27 +1801,8 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL bool parsed = false; parser_info pi = parser; if(format == JSFormat) { -#ifdef QTSCRIPT_SUPPORT - eng.globalObject().setProperty("qmake", qscript_projectWrapper(&eng, this, place)); - QFile f(file); - if (f.open(QFile::ReadOnly)) { - QString code = f.readAll(); - QScriptValue r = eng.evaluate(code); - if(eng.hasUncaughtException()) { - const int lineNo = eng.uncaughtExceptionLineNumber(); - fprintf(stderr, "%s:%d: %s\n", file.toLatin1().constData(), lineNo, - r.toString().toLatin1().constData()); - } else { - parsed = true; - QScriptValue variables = eng.globalObject().property("qmake"); - if (variables.isValid() && variables.isObject()) - qscript_createQMakeProjectMap(place, variables); - } - } -#else warn_msg(WarnParser, "%s:%d: QtScript support disabled for %s.", pi.file.toLatin1().constData(), pi.line_no, orig_file.toLatin1().constData()); -#endif } else { QStack<ScopeBlock> sc = scope_blocks; IteratorBlock *it = iterator; @@ -2158,11 +2137,11 @@ 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; + FILE *proc = QT_POPEN(args[0].toLatin1(), "r"); while(proc && !feof(proc)) { int read_in = int(fread(buff, 1, 255, proc)); if(!read_in) @@ -2311,20 +2290,17 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list, ret += it->replace(before, after); } break; } - default: { -#ifdef QTSCRIPT_SUPPORT - { - QScriptValue jsFunc = eng.globalObject().property(func); - if(jsFunc.isFunction()) { - QScriptValueList jsArgs; - for(int i = 0; i < args.size(); ++i) - jsArgs += QScriptValue(&eng, args.at(i)); - QScriptValue jsRet = jsFunc.call(eng.globalObject(), jsArgs); - ret = qscriptvalue_cast<QStringList>(jsRet); - 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); } -#endif + break; } + default: { fprintf(stderr, "%s:%d: Unknown replace function: %s\n", parser.file.toLatin1().constData(), parser.line_no, func.toLatin1().constData()); @@ -2404,7 +2380,7 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt if(ok) { // do integer compare int lhs_int = lhs.toInt(&ok); if(ok) { - if(func == "greaterThan") + if(func_t == T_GREATERTHAN) return lhs_int > rhs_int; return lhs_int < rhs_int; } @@ -2699,10 +2675,15 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt case T_LOAD: { QString parseInto; const bool include_statement = (func_t == T_INCLUDE); - bool ignore_error = include_statement; - if(args.count() == 2) { + bool ignore_error = false; + if(args.count() >= 2) { if(func_t == T_INCLUDE) { parseInto = args[1]; + if (args.count() == 3){ + QString sarg = args[2]; + if (sarg.toLower() == "true" || sarg.toInt()) + ignore_error = true; + } } else { QString sarg = args[1]; ignore_error = (sarg.toLower() == "true" || sarg.toInt()); @@ -2744,8 +2725,8 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt if(stat == IncludeFeatureAlreadyLoaded) { warn_msg(WarnParser, "%s:%d: Duplicate of loaded feature %s", parser.file.toLatin1().constData(), parser.line_no, file.toLatin1().constData()); - } else if(stat == IncludeNoExist && include_statement) { - warn_msg(WarnParser, "%s:%d: Unable to find file for inclusion %s", + } else if(stat == IncludeNoExist && !ignore_error) { + warn_msg(WarnAll, "%s:%d: Unable to find file for inclusion %s", parser.file.toLatin1().constData(), parser.line_no, file.toLatin1().constData()); return false; } else if(stat >= IncludeFailure) { @@ -2788,20 +2769,6 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt #endif return true; } default: -#ifdef QTSCRIPT_SUPPORT - { - QScriptValue jsFunc = eng.globalObject().property(func); - if(jsFunc.isFunction()) { - QScriptValueList jsArgs; - for(int i = 0; i < args.size(); ++i) - jsArgs += QScriptValue(&eng, args.at(i)); - QScriptValue jsRet = jsFunc.call(eng.globalObject(), jsArgs); - if(eng.hasUncaughtException()) - return false; - return qscriptvalue_cast<bool>(jsRet); - } - } -#endif fprintf(stderr, "%s:%d: Unknown test function: %s\n", parser.file.toLatin1().constData(), parser.line_no, func.toLatin1().constData()); } @@ -3117,9 +3084,9 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList ret = "Windows"; } else if(type == "name") { DWORD name_length = 1024; - TCHAR name[1024]; - if(GetComputerName(name, &name_length)) - ret = QString::fromUtf16((ushort*)name, name_length); + wchar_t name[1024]; + if (GetComputerName(name, &name_length)) + ret = QString::fromWCharArray(name); } else if(type == "version" || type == "version_string") { QSysInfo::WinVersion ver = QSysInfo::WindowsVersion; if(type == "version") @@ -3185,6 +3152,9 @@ 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]; diff --git a/qmake/project.h b/qmake/project.h index 1c54250..21b693e 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -49,14 +49,6 @@ #include <qmap.h> #include <qmetatype.h> -#ifndef QT_BUILD_QMAKE_LIBRARY -# define QTSCRIPT_SUPPORT -#endif - -#ifdef QTSCRIPT_SUPPORT -# include <qscriptengine.h> -#endif - QT_BEGIN_NAMESPACE class QMakeProperty; @@ -80,9 +72,6 @@ class QMakeProject friend struct IteratorBlock; friend struct FunctionBlock; -#ifdef QTSCRIPT_SUPPORT - QScriptEngine eng; -#endif QStack<ScopeBlock> scope_blocks; QStack<FunctionBlock *> function_blocks; IteratorBlock *iterator; @@ -203,6 +192,10 @@ inline QString QMakeProject::first(const QString &v) inline QMap<QString, QStringList> &QMakeProject::variables() { return vars; } +// Helper functions needed for Symbian +bool isForSymbian(); +bool isForSymbianSbsv2(); + QT_END_NAMESPACE #endif // PROJECT_H diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 02ff38e..efe4f36 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -13,14 +13,24 @@ 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 + 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/epocroot.h \ + generators/symbian/initprojectdeploy_symbian.h contains(QT_EDITION, OpenSource) { DEFINES += QMAKE_OPENSOURCE_EDITION @@ -46,13 +56,15 @@ bootstrap { #Qt code qnumeric.cpp \ qhash.cpp \ qiodevice.cpp \ - qlistdata.cpp \ + qlist.cpp \ qlinkedlist.cpp \ qlocale.cpp \ qmalloc.cpp \ qmap.cpp \ qmetatype.cpp \ qregexp.cpp \ + qtextcodec.cpp \ + qutfcodec.cpp \ qstring.cpp \ qstringlist.cpp \ qtemporaryfile.cpp \ @@ -63,7 +75,9 @@ bootstrap { #Qt code qlibraryinfo.cpp \ qvariant.cpp \ qvector.cpp \ - qvsnprintf.cpp + qvsnprintf.cpp \ + qxmlstream.cpp \ + qxmlutils.cpp HEADERS+= \ qbitarray.h \ @@ -79,7 +93,6 @@ bootstrap { #Qt code qfile.h \ qabstractfileengine.h \ qfileinfo.h \ - qfileinfo_p.h \ qglobal.h \ qnumeric.h \ qhash.h \ @@ -91,6 +104,8 @@ bootstrap { #Qt code qmap.h \ qmetatype.h \ qregexp.h \ + qtextcodec.h \ + qutfcodec.h \ qstring.h \ qstringlist.h \ qstringmatcher.h \ @@ -98,13 +113,15 @@ 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 mac { SOURCES += qcore_mac.cpp qsettings_mac.cpp - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.3 #enables weak linking for 10.3 (exported) + QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported) LIBS += -framework ApplicationServices } } else:win32 { @@ -117,10 +134,9 @@ bootstrap { #Qt code LFLAGS += -lcpp } DEFINES *= QT_NO_QOBJECT - include($$QT_SOURCE_TREE/src/script/script.pri) } else { CONFIG += qt - QT = core script + QT = core } *-g++:profiling { QMAKE_CFLAGS = -pg diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 38c58fb..560aee9 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -15,11 +15,11 @@ MOC_DIR = . VPATH += $$QT_SOURCE_TREE/src/corelib/global \ $$QT_SOURCE_TREE/src/corelib/tools \ $$QT_SOURCE_TREE/src/corelib/kernel \ + $$QT_SOURCE_TREE/src/corelib/codecs \ $$QT_SOURCE_TREE/src/corelib/plugin \ - $$QT_SOURCE_TREE/src/corelib/io \ - $$QT_SOURCE_TREE/src/script -INCPATH += generators generators/unix generators/win32 generators/mac \ - $$QT_SOURCE_TREE/include $$QT_SOURCE_TREE/include/QtCore \ - $$QT_SOURCE_TREE/qmake $$QT_SOURCE_TREE/include/QtScript + $$QT_SOURCE_TREE/src/corelib/xml \ + $$QT_SOURCE_TREE/src/corelib/io +INCPATH += generators generators/unix generators/win32 generators/mac generators/symbian \ + $$QT_SOURCE_TREE/include $$QT_SOURCE_TREE/include/QtCore include(qmake.pri) |