-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index cbe2014..9bb6f6b 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp | |||
@@ -76,13 +76,13 @@ void | |||
76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) | 76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) |
77 | { | 77 | { |
78 | QString deps = fileFixify(Option::output.name()), prl; | 78 | QString deps = fileFixify(Option::output.name()), prl; |
79 | bool do_incremental = (project->isActiveConfig("incremental") && | 79 | bool do_incremental = (project->isActiveConfig("incremental") && |
80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && | 80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && |
81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || | 81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || |
82 | !project->isActiveConfig("staticlib"))), | 82 | !project->isActiveConfig("staticlib"))), |
83 | src_incremental=FALSE, moc_incremental=FALSE; | 83 | src_incremental=FALSE, moc_incremental=FALSE; |
84 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 84 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); |
85 | 85 | ||
86 | t << "####### Compiler, tools and options" << endl << endl; | 86 | t << "####### Compiler, tools and options" << endl << endl; |
87 | t << "CC = "; | 87 | t << "CC = "; |
88 | if (project->isActiveConfig("thread") && | 88 | if (project->isActiveConfig("thread") && |
@@ -133,12 +133,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
133 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; | 133 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; |
134 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; | 134 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; |
135 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 135 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
136 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; | 136 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; |
137 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 137 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
138 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 138 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
139 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; | ||
139 | t << endl; | 140 | t << endl; |
140 | 141 | ||
141 | t << "####### Output directory" << endl << endl; | 142 | t << "####### Output directory" << endl << endl; |
142 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | 143 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) |
143 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; | 144 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; |
144 | else | 145 | else |
@@ -527,13 +528,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
527 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 528 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
528 | if(!project->isEmpty("QMAKE_RANLIB")) | 529 | if(!project->isEmpty("QMAKE_RANLIB")) |
529 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; | 530 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; |
530 | t << endl << endl; | 531 | t << endl << endl; |
531 | } | 532 | } |
532 | } else { | 533 | } else { |
533 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " | 534 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " |
534 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" | 535 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" |
535 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; | 536 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; |
536 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { | 537 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { |
537 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; | 538 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; |
538 | if(!project->isEmpty("DESTDIR")) { | 539 | if(!project->isEmpty("DESTDIR")) { |
539 | QString destdir = project->first("DESTDIR"); | 540 | QString destdir = project->first("DESTDIR"); |
@@ -542,31 +543,31 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
542 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 543 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
543 | << var("QMAKE_AR_CMD") << "\n"; | 544 | << var("QMAKE_AR_CMD") << "\n"; |
544 | if(!project->isEmpty("QMAKE_POST_LINK")) | 545 | if(!project->isEmpty("QMAKE_POST_LINK")) |
545 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 546 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
546 | if(!project->isEmpty("QMAKE_RANLIB")) | 547 | if(!project->isEmpty("QMAKE_RANLIB")) |
547 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; | 548 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; |
548 | if(!project->isEmpty("DESTDIR")) | 549 | if(!project->isEmpty("DESTDIR")) |
549 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" | 550 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" |
550 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; | 551 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; |
551 | } else { | 552 | } else { |
552 | int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); | 553 | int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); |
553 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], | 554 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], |
554 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; | 555 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; |
555 | libs.prepend("$(TARGET)"); | 556 | libs.prepend("$(TARGET)"); |
556 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); | 557 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); |
557 | libit != libs.end(); ++libit) { | 558 | libit != libs.end(); ++libit) { |
558 | QStringList build; | 559 | QStringList build; |
559 | for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) | 560 | for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) |
560 | build << (*objit); | 561 | build << (*objit); |
561 | QString ar; | 562 | QString ar; |
562 | if((*libit) == "$(TARGET)") { | 563 | if((*libit) == "$(TARGET)") { |
563 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " | 564 | t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " |
564 | << valList(build) << "\n\t"; | 565 | << valList(build) << "\n\t"; |
565 | ar = project->variables()["QMAKE_AR_CMD"].first(); | 566 | ar = project->variables()["QMAKE_AR_CMD"].first(); |
566 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", | 567 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", |
567 | build.join(" ")); | 568 | build.join(" ")); |
568 | } else { | 569 | } else { |
569 | t << (*libit) << ": " << valList(build) << "\n\t"; | 570 | t << (*libit) << ": " << valList(build) << "\n\t"; |
570 | ar = "$(AR) " + (*libit) + " " + build.join(" "); | 571 | ar = "$(AR) " + (*libit) + " " + build.join(" "); |
571 | } | 572 | } |
572 | if(!project->isEmpty("DESTDIR")) { | 573 | if(!project->isEmpty("DESTDIR")) { |
@@ -576,13 +577,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
576 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" | 577 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" |
577 | << ar << "\n"; | 578 | << ar << "\n"; |
578 | if(!project->isEmpty("QMAKE_POST_LINK")) | 579 | if(!project->isEmpty("QMAKE_POST_LINK")) |
579 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 580 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
580 | if(!project->isEmpty("QMAKE_RANLIB")) | 581 | if(!project->isEmpty("QMAKE_RANLIB")) |
581 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; | 582 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; |
582 | if(!project->isEmpty("DESTDIR")) | 583 | if(!project->isEmpty("DESTDIR")) |
583 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" | 584 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" |
584 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; | 585 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; |
585 | } | 586 | } |
586 | } | 587 | } |
587 | t << endl << endl; | 588 | t << endl << endl; |
588 | } | 589 | } |
@@ -593,13 +594,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
593 | //this is an implicity depend on moc, so it will be built if necesary, however | 594 | //this is an implicity depend on moc, so it will be built if necesary, however |
594 | //moc itself shouldn't have this dependancy - this is a little kludgy but it is | 595 | //moc itself shouldn't have this dependancy - this is a little kludgy but it is |
595 | //better than the alternative for now. | 596 | //better than the alternative for now. |
596 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); | 597 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); |
597 | fixEnvVariables(target); | 598 | fixEnvVariables(target); |
598 | fixEnvVariables(moc); | 599 | fixEnvVariables(moc); |
599 | if(target != moc) | 600 | if(target != moc) |
600 | t << "$(MOC): \n\t" | 601 | t << "$(MOC): \n\t" |
601 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; | 602 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; |
602 | } | 603 | } |
603 | 604 | ||
604 | writeMakeQmake(t); | 605 | writeMakeQmake(t); |
605 | 606 | ||
@@ -639,13 +640,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
639 | if(!project->isEmpty("TRANSLATIONS")) | 640 | if(!project->isEmpty("TRANSLATIONS")) |
640 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; | 641 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; |
641 | if(!project->isEmpty("FORMS")) { | 642 | if(!project->isEmpty("FORMS")) { |
642 | QStringList &forms = project->variables()["FORMS"], ui_headers; | 643 | QStringList &forms = project->variables()["FORMS"], ui_headers; |
643 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | 644 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { |
644 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | 645 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); |
645 | if(QFile::exists(ui_h) ) | 646 | if(QFile::exists(ui_h) ) |
646 | ui_headers << ui_h; | 647 | ui_headers << ui_h; |
647 | } | 648 | } |
648 | if(!ui_headers.isEmpty()) | 649 | if(!ui_headers.isEmpty()) |
649 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; | 650 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; |
650 | } | 651 | } |
651 | t << "( cd `dirname " << ddir_c << "` && " | 652 | t << "( cd `dirname " << ddir_c << "` && " |
@@ -802,13 +803,13 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
802 | if(ofile.findRev(Option::dir_sep) != -1) | 803 | if(ofile.findRev(Option::dir_sep) != -1) |
803 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); | 804 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); |
804 | t << "MAKEFILE =" << var("MAKEFILE") << endl; | 805 | t << "MAKEFILE =" << var("MAKEFILE") << endl; |
805 | t << "QMAKE =" << var("QMAKE") << endl; | 806 | t << "QMAKE =" << var("QMAKE") << endl; |
806 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 807 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
807 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory | 808 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory |
808 | for( it.toFirst(); it.current(); ++it) | 809 | for( it.toFirst(); it.current(); ++it) |
809 | t << " \\\n\t\t" << it.current()->target; | 810 | t << " \\\n\t\t" << it.current()->target; |
810 | t << endl << endl; | 811 | t << endl << endl; |
811 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; | 812 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; |
812 | 813 | ||
813 | // generate target rules | 814 | // generate target rules |
814 | for( it.toFirst(); it.current(); ++it) { | 815 | for( it.toFirst(); it.current(); ++it) { |
@@ -831,13 +832,13 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
831 | } | 832 | } |
832 | 833 | ||
833 | if (project->isActiveConfig("ordered")) { // generate dependencies | 834 | if (project->isActiveConfig("ordered")) { // generate dependencies |
834 | for( it.toFirst(); it.current(); ) { | 835 | for( it.toFirst(); it.current(); ) { |
835 | QString tar = it.current()->target; | 836 | QString tar = it.current()->target; |
836 | ++it; | 837 | ++it; |
837 | if (it.current()) | 838 | if (it.current()) |
838 | t << it.current()->target << ": " << tar << endl; | 839 | t << it.current()->target << ": " << tar << endl; |
839 | } | 840 | } |
840 | t << endl; | 841 | t << endl; |
841 | } | 842 | } |
842 | 843 | ||
843 | writeMakeQmake(t); | 844 | writeMakeQmake(t); |
@@ -854,13 +855,13 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
854 | t << (*it)->makefile; | 855 | t << (*it)->makefile; |
855 | } | 856 | } |
856 | for( it.toFirst(); it.current(); ++it) { | 857 | for( it.toFirst(); it.current(); ++it) { |
857 | t << "\n\t ( "; | 858 | t << "\n\t ( "; |
858 | if(!(*it)->directory.isEmpty()) | 859 | if(!(*it)->directory.isEmpty()) |
859 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 860 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
860 | t << "grep \"^qmake_all:\" " << (*it)->makefile | 861 | t << "grep \"^qmake_all:\" " << (*it)->makefile |
861 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; | 862 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; |
862 | } | 863 | } |
863 | t << endl; | 864 | t << endl; |
864 | t << "clean uninstall install uiclean mocclean: qmake_all FORCE"; | 865 | t << "clean uninstall install uiclean mocclean: qmake_all FORCE"; |
865 | for( it.toFirst(); it.current(); ++it) { | 866 | for( it.toFirst(); it.current(); ++it) { |
866 | t << "\n\t ( "; | 867 | t << "\n\t ( "; |
@@ -919,29 +920,29 @@ void UnixMakefileGenerator::init2() | |||
919 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 920 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); |
920 | if( project->isActiveConfig("plugin") ) { | 921 | if( project->isActiveConfig("plugin") ) { |
921 | project->variables()["TARGET_x.y.z"].append("lib" + | 922 | project->variables()["TARGET_x.y.z"].append("lib" + |
922 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); | 923 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); |
923 | if(project->isActiveConfig("lib_version_first")) | 924 | if(project->isActiveConfig("lib_version_first")) |
924 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 925 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
925 | project->first("VER_MAJ") + "." + | 926 | project->first("VER_MAJ") + "." + |
926 | project->first("QMAKE_EXTENSION_SHLIB")); | 927 | project->first("QMAKE_EXTENSION_SHLIB")); |
927 | else | 928 | else |
928 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 929 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
929 | project->first("QMAKE_EXTENSION_SHLIB") + | 930 | project->first("QMAKE_EXTENSION_SHLIB") + |
930 | "." + project->first("VER_MAJ")); | 931 | "." + project->first("VER_MAJ")); |
931 | 932 | ||
932 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 933 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
933 | if(project->isActiveConfig("qt")) | 934 | if(project->isActiveConfig("qt")) |
934 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 935 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
935 | } else if ( os == "hpux" ) { | 936 | } else if ( os == "hpux" ) { |
936 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); | 937 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); |
937 | if(project->isActiveConfig("lib_version_first")) | 938 | if(project->isActiveConfig("lib_version_first")) |
938 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + | 939 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + |
939 | project->first("TARGET")); | 940 | project->first("TARGET")); |
940 | else | 941 | else |
941 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 942 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
942 | project->first("VER_MAJ")); | 943 | project->first("VER_MAJ")); |
943 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; | 944 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; |
944 | } else if ( os == "aix" ) { | 945 | } else if ( os == "aix" ) { |
945 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); | 946 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); |
946 | if(project->isActiveConfig("lib_version_first")) { | 947 | if(project->isActiveConfig("lib_version_first")) { |
947 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 948 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |