-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 | |||
@@ -66,33 +66,33 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) | |||
66 | writeMakeParts(t); | 66 | writeMakeParts(t); |
67 | return MakefileGenerator::writeMakefile(t); | 67 | return MakefileGenerator::writeMakefile(t); |
68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { | 68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { |
69 | writeSubdirs(t); | 69 | writeSubdirs(t); |
70 | return TRUE; | 70 | return TRUE; |
71 | } | 71 | } |
72 | return FALSE; | 72 | return FALSE; |
73 | } | 73 | } |
74 | 74 | ||
75 | void | 75 | 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") && |
89 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) | 89 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) |
90 | t << var("QMAKE_CC_THREAD") << endl; | 90 | t << var("QMAKE_CC_THREAD") << endl; |
91 | else | 91 | else |
92 | t << var("QMAKE_CC") << endl; | 92 | t << var("QMAKE_CC") << endl; |
93 | 93 | ||
94 | t << "CXX = "; | 94 | t << "CXX = "; |
95 | if (project->isActiveConfig("thread") && | 95 | if (project->isActiveConfig("thread") && |
96 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) | 96 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) |
97 | t << var("QMAKE_CXX_THREAD") << endl; | 97 | t << var("QMAKE_CXX_THREAD") << endl; |
98 | else | 98 | else |
@@ -123,32 +123,33 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | t << "AR = " << var("QMAKE_AR") << endl; | 125 | t << "AR = " << var("QMAKE_AR") << endl; |
126 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; | 126 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; |
127 | t << "MOC = " << var("QMAKE_MOC") << endl; | 127 | t << "MOC = " << var("QMAKE_MOC") << endl; |
128 | t << "UIC = "<< var("QMAKE_UIC") << endl; | 128 | t << "UIC = "<< var("QMAKE_UIC") << endl; |
129 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 129 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
130 | t << "TAR = "<< var("QMAKE_TAR") << endl; | 130 | t << "TAR = "<< var("QMAKE_TAR") << endl; |
131 | t << "GZIP = " << var("QMAKE_GZIP") << endl; | 131 | t << "GZIP = " << var("QMAKE_GZIP") << endl; |
132 | t << "COPY = " << var("QMAKE_COPY") << endl; | 132 | t << "COPY = " << var("QMAKE_COPY") << endl; |
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 |
145 | t << "OBJECTS_DIR = ./" << endl; | 146 | t << "OBJECTS_DIR = ./" << endl; |
146 | t << endl; | 147 | t << endl; |
147 | 148 | ||
148 | /* files */ | 149 | /* files */ |
149 | t << "####### Files" << endl << endl; | 150 | t << "####### Files" << endl << endl; |
150 | t << "HEADERS = " << varList("HEADERS") << endl; | 151 | t << "HEADERS = " << varList("HEADERS") << endl; |
151 | t << "SOURCES = " << varList("SOURCES") << endl; | 152 | t << "SOURCES = " << varList("SOURCES") << endl; |
152 | if(do_incremental) { | 153 | if(do_incremental) { |
153 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; | 154 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; |
154 | t << "OBJECTS = "; | 155 | t << "OBJECTS = "; |
@@ -517,99 +518,99 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
517 | 518 | ||
518 | if (! project->isActiveConfig("plugin")) { | 519 | if (! project->isActiveConfig("plugin")) { |
519 | t << "staticlib: $(TARGETA)" << endl << endl; | 520 | t << "staticlib: $(TARGETA)" << endl << endl; |
520 | t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 521 | t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
521 | if(do_incremental) | 522 | if(do_incremental) |
522 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 523 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
523 | t << var("TARGETDEPS") << "\n\t" | 524 | t << var("TARGETDEPS") << "\n\t" |
524 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" | 525 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" |
525 | << var("QMAKE_AR_CMD"); | 526 | << var("QMAKE_AR_CMD"); |
526 | if(do_incremental) | 527 | if(do_incremental) |
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"); |
540 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 541 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
541 | } | 542 | } |
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")) { |
573 | QString destdir = project->first("DESTDIR"); | 574 | QString destdir = project->first("DESTDIR"); |
574 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 575 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
575 | } | 576 | } |
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 | } |
589 | 590 | ||
590 | t << "mocables: $(SRCMOC)" << endl << endl; | 591 | t << "mocables: $(SRCMOC)" << endl << endl; |
591 | 592 | ||
592 | if(!project->isActiveConfig("no_mocdepend")) { | 593 | if(!project->isActiveConfig("no_mocdepend")) { |
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 | ||
606 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { | 607 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { |
607 | QString pkginfo = project->first("QMAKE_PKGINFO"); | 608 | QString pkginfo = project->first("QMAKE_PKGINFO"); |
608 | QString destdir = project->first("DESTDIR"); | 609 | QString destdir = project->first("DESTDIR"); |
609 | t << pkginfo << ": " << "\n\t"; | 610 | t << pkginfo << ": " << "\n\t"; |
610 | if(!destdir.isEmpty()) | 611 | if(!destdir.isEmpty()) |
611 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 612 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
612 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" | 613 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" |
613 | << "@echo \"APPL????\" >" << pkginfo << endl; | 614 | << "@echo \"APPL????\" >" << pkginfo << endl; |
614 | } | 615 | } |
615 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { | 616 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { |
@@ -629,33 +630,33 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
629 | } | 630 | } |
630 | } | 631 | } |
631 | 632 | ||
632 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : | 633 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : |
633 | project->first("QMAKE_DISTDIR"); | 634 | project->first("QMAKE_DISTDIR"); |
634 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : | 635 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : |
635 | project->first("OBJECTS_DIR")) + ddir); | 636 | project->first("OBJECTS_DIR")) + ddir); |
636 | t << "dist: " << "\n\t" | 637 | t << "dist: " << "\n\t" |
637 | << "@mkdir -p " << ddir_c << " && " | 638 | << "@mkdir -p " << ddir_c << " && " |
638 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; | 639 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; |
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 << "` && " |
652 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " | 653 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " |
653 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " | 654 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " |
654 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " | 655 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " |
655 | << "$(DEL_DIR) " << ddir_c | 656 | << "$(DEL_DIR) " << ddir_c |
656 | << endl << endl; | 657 | << endl << endl; |
657 | 658 | ||
658 | QString clean_targets; | 659 | QString clean_targets; |
659 | if(mocAware()) { | 660 | if(mocAware()) { |
660 | t << "mocclean:" << "\n"; | 661 | t << "mocclean:" << "\n"; |
661 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { | 662 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { |
@@ -792,85 +793,85 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
792 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 793 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
793 | } | 794 | } |
794 | sd->target = "sub-" + (*it); | 795 | sd->target = "sub-" + (*it); |
795 | sd->target.replace('/', '-'); | 796 | sd->target.replace('/', '-'); |
796 | sd->target.replace('.', '_'); | 797 | sd->target.replace('.', '_'); |
797 | } | 798 | } |
798 | } | 799 | } |
799 | QPtrListIterator<SubDir> it(subdirs); | 800 | QPtrListIterator<SubDir> it(subdirs); |
800 | 801 | ||
801 | QString ofile = Option::output.name(); | 802 | QString ofile = Option::output.name(); |
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) { |
815 | bool have_dir = !(*it)->directory.isEmpty(); | 816 | bool have_dir = !(*it)->directory.isEmpty(); |
816 | QString mkfile = (*it)->makefile, out; | 817 | QString mkfile = (*it)->makefile, out; |
817 | if(have_dir) | 818 | if(have_dir) |
818 | mkfile.prepend((*it)->directory + Option::dir_sep); | 819 | mkfile.prepend((*it)->directory + Option::dir_sep); |
819 | if(direct || (*it)->makefile != "$(MAKEFILE)") | 820 | if(direct || (*it)->makefile != "$(MAKEFILE)") |
820 | out = " -o " + (*it)->makefile; | 821 | out = " -o " + (*it)->makefile; |
821 | //qmake it | 822 | //qmake it |
822 | t << mkfile << ": " << "\n\t"; | 823 | t << mkfile << ": " << "\n\t"; |
823 | if(have_dir) | 824 | if(have_dir) |
824 | t << "cd " << (*it)->directory << " && "; | 825 | t << "cd " << (*it)->directory << " && "; |
825 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; | 826 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; |
826 | //actually compile | 827 | //actually compile |
827 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; | 828 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; |
828 | if(have_dir) | 829 | if(have_dir) |
829 | t << "cd " << (*it)->directory << " && "; | 830 | t << "cd " << (*it)->directory << " && "; |
830 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; | 831 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; |
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); |
844 | 845 | ||
845 | if(project->isEmpty("SUBDIRS")) { | 846 | if(project->isEmpty("SUBDIRS")) { |
846 | t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl; | 847 | t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl; |
847 | } else { | 848 | } else { |
848 | t << "all: $(SUBTARGETS)" << endl; | 849 | t << "all: $(SUBTARGETS)" << endl; |
849 | t << "qmake_all:"; | 850 | t << "qmake_all:"; |
850 | for( it.toFirst(); it.current(); ++it) { | 851 | for( it.toFirst(); it.current(); ++it) { |
851 | t << " "; | 852 | t << " "; |
852 | if(!(*it)->directory.isEmpty()) | 853 | if(!(*it)->directory.isEmpty()) |
853 | t << (*it)->directory << Option::dir_sep; | 854 | t << (*it)->directory << Option::dir_sep; |
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 ( "; |
867 | if(!(*it)->directory.isEmpty()) | 868 | if(!(*it)->directory.isEmpty()) |
868 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 869 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
869 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; | 870 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; |
870 | } | 871 | } |
871 | t << endl; | 872 | t << endl; |
872 | t << "distclean: qmake_all FORCE"; | 873 | t << "distclean: qmake_all FORCE"; |
873 | for( it.toFirst(); it.current(); ++it) { | 874 | for( it.toFirst(); it.current(); ++it) { |
874 | t << "\n\t ( "; | 875 | t << "\n\t ( "; |
875 | if(!(*it)->directory.isEmpty()) | 876 | if(!(*it)->directory.isEmpty()) |
876 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 877 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
@@ -909,49 +910,49 @@ void UnixMakefileGenerator::init2() | |||
909 | project->variables()["TARGET"].first().prepend("lib"); | 910 | project->variables()["TARGET"].first().prepend("lib"); |
910 | project->variables()["TARGET"].first() += ".a"; | 911 | project->variables()["TARGET"].first() += ".a"; |
911 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) | 912 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) |
912 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); | 913 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); |
913 | } else { | 914 | } else { |
914 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); | 915 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); |
915 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) | 916 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) |
916 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); | 917 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); |
917 | else | 918 | else |
918 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); | 919 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); |
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") + "." + |
948 | project->first("VER_MAJ") + "." + | 949 | project->first("VER_MAJ") + "." + |
949 | project->first("QMAKE_EXTENSION_SHLIB")); | 950 | project->first("QMAKE_EXTENSION_SHLIB")); |
950 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 951 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
951 | project->first("VER_MAJ") + | 952 | project->first("VER_MAJ") + |
952 | "." + project->first("VER_MIN") + "." + | 953 | "." + project->first("VER_MIN") + "." + |
953 | project->first("QMAKE_EXTENSION_SHLIB")); | 954 | project->first("QMAKE_EXTENSION_SHLIB")); |
954 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 955 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
955 | project->first("VER_MAJ") + "." + | 956 | project->first("VER_MAJ") + "." + |
956 | project->first("VER_MIN") + "." + | 957 | project->first("VER_MIN") + "." + |
957 | project->first("VER_PAT") + "." + | 958 | project->first("VER_PAT") + "." + |