Ignore:
Timestamp:
Mar 11, 2010, 3:04:05 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

qmake: os2/gnumake: Replaced hard-coded DEF_FILE generation target with more flexible and consistent code in default_post.prf.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qmake/generators/os2/gnumake.cpp

    r671 r673  
    558558    }
    559559
    560     if (project->isEmpty("DEF_FILE")) {
    561         /* no DEF file supplied, we will generate one */
    562         if (mode == DLL) {
    563             t << "DEF_FILE      = $(basename $(DESTDIR_TARGET)).def" << endl;
    564             project->values("QMAKE_CLEAN").append("$(DEF_FILE)");
    565             project->values("POST_TARGETDEPS") += escapeFileVars("$(DEF_FILE)");
    566             if (!project->isEmpty("DEF_FILE_VERSION"))
    567                 t << "DEF_FILE_VERSION = " << var("DEF_FILE_VERSION") << endl;
    568             if (!project->isEmpty("DEF_FILE_DESCRIPTION"))
    569                 t << "DEF_FILE_DESCRIPTION = " << var("DEF_FILE_DESCRIPTION") << endl;
    570             if (!project->isEmpty("DEF_FILE_VENDOR"))
    571                 t << "DEF_FILE_VENDOR = " << var("DEF_FILE_VENDOR") << endl;
     560    if (mode != StaticLib) {
     561        if (project->isEmpty("DEF_FILE")) {
     562            /* no DEF file supplied, emit handy variable definitions to simplify
     563             * DEF generation rules defined somewhere in default_post.prf */
     564            bool haveSomething = false;
     565            if (!project->isEmpty("DEF_FILE_VERSION")) {
     566                t << "DEF_FILE_VERSION        = " << var("DEF_FILE_VERSION") << endl;
     567                haveSomething = true;
     568            }
     569            if (!project->isEmpty("DEF_FILE_DESCRIPTION")) {
     570                t << "DEF_FILE_DESCRIPTION    = " << var("DEF_FILE_DESCRIPTION") << endl;
     571                haveSomething = true;
     572            }
     573            if (!project->isEmpty("DEF_FILE_VENDOR")) {
     574                t << "DEF_FILE_VENDOR         = " << var("DEF_FILE_VENDOR") << endl;
     575                haveSomething = true;
     576            }
    572577            if (!project->isEmpty("DEF_FILE_TEMPLATE")) {
    573                 t << "DEF_FILE_TEMPLATE = " << escapeFilePath(var("DEF_FILE_TEMPLATE")) << endl;
    574                 project->values("QMAKE_GENDEF_DEPS") += "$(DEF_FILE_TEMPLATE)";
     578                t << "DEF_FILE_TEMPLATE = " << escapeFilePath(var("DEF_FILE_TEMPLATE")) << endl;
     579                ;
    575580            }
    576581            if (!project->isEmpty("DEF_FILE_MAP")) {
    577                 t << "DEF_FILE_MAP  = " << escapeFilePath(var("DEF_FILE_MAP")) << endl;
    578                 project->values("QMAKE_GENDEF_DEPS") += "$(DEF_FILE_MAP)";
    579             }
    580         }
    581     } else {
    582         if (!project->isEmpty("DEF_FILE_TEMPLATE")) {
    583             fprintf(stderr, "Both DEF_FILE and DEF_FILE_TEMPLATE are specified.\n");
    584             fprintf(stderr, "Please specify one of them, not both.");
    585             exit(1);
    586         }
    587         t << "DEF_FILE      = " << escapeFilePath(var("DEF_FILE")) << endl;
    588         project->values("POST_TARGETDEPS") += "$(DEF_FILE)";
     582                t << "DEF_FILE_MAP            = " << escapeFilePath(var("DEF_FILE_MAP")) << endl;
     583                haveSomething = true;
     584            }
     585            if (mode == DLL) {
     586                // the DLL needs a file in any case
     587                t << "DEF_FILE      = $(basename $(DESTDIR_TARGET)).def" << endl;
     588            } else if (haveSomething) {
     589                // the EXE needs it only if there's a description info
     590                t << "DEF_FILE_EXETYPE        = " << escapeFilePath(var("DEF_FILE_EXETYPE")) << endl;
     591                t << "DEF_FILE      = $(OBJECTS_DIR)\\$(TARGET).def" << endl;
     592            }
     593        } else {
     594            if (!project->isEmpty("DEF_FILE_TEMPLATE")) {
     595                fprintf(stderr, "Both DEF_FILE and DEF_FILE_TEMPLATE are specified.\n");
     596                fprintf(stderr, "Please specify one of them, not both.");
     597                exit(1);
     598            }
     599            t << "DEF_FILE      = " << escapeFilePath(var("DEF_FILE")) << endl;
     600        }
    589601    }
    590602
     
    601613        t << escapeFileVars("$(RES_FILE): $(RC_FILE)\n\t");
    602614        t << var("QMAKE_RUN_RC2RES") << endl;
    603     }
    604 
    605     if (mode == DLL) {
    606         if (project->isEmpty("DEF_FILE")) {
    607             /* generate a DEF file for the DLL when not supplied */
    608             t << escapeFileVars("$(DEF_FILE): ") << escapeFileVars(var("QMAKE_GENDEF_DEPS"));
    609             t << valGlue(var("QMAKE_RUN_GENDEF").split(";;"), "\n\t", "\n\t", "") << endl;
    610         }
    611615    }
    612616}
Note: See TracChangeset for help on using the changeset viewer.