Changeset 672


Ignore:
Timestamp:
Mar 11, 2010, 2:57:32 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

emxexpw.cmd: Added -exe option to generate a .DEF for an executable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mkspecs/os2-g++/emxexpw.cmd

    r655 r672  
    3535G.!eol          = '0D0A'x
    3636
    37 G.!DefaultTemplate =,
     37G.!DefaultDllTemplate =,
    3838    "LIBRARY ${name} INITINSTANCE TERMINSTANCE"G.!eol||,
    3939    "DESCRIPTION '${bldlevel}'"G.!eol||,
    40     "DATA MULTIPLE NONSHARED"G.!eol||,
    41     "EXPORTS"
    42     /* <-- ${exports} go here */
     40    "DATA MULTIPLE NONSHARED"
     41    /* <-- EXPORTS + ${exports} go here */
     42
     43G.!DefaultExeTemplate =,
     44    "NAME ${name} ${exetype}"G.!eol||,
     45    "DESCRIPTION '${bldlevel}'"
     46    /* <-- EXPORTS + ${exports} go here */
    4347
    4448G.!StatsTemplate =,
     
    6367Opt.!DefTemplate     = ''
    6468Opt.!DefMap          = ''
     69Opt.!ExeType         = ''
    6570Opt.!Quiet           = 0
    6671Opt.!Objects.0       = 0
     
    95100/* check options */
    96101if (Opt.!DefFile == '') then call Error "E_NoDefFile"
     102if (Opt.!ExeType \== '' & Opt.!DefMap \== '') then
     103    call Error "E_UnexpectedOption", "-map "Opt.!DefMap
    97104if (Opt.!DefMap \== '') then
    98105    if (Opt.!Objects.0 == 0) then call Error "E_NoObjectFiles"
     
    102109    parse value filespec('N', Opt.!DefFile) with Opt.!LibName '.' .
    103110end
     111if (Opt.!ExeType \== '') then
     112    G.!DefaultTemplate = G.!DefaultExeTemplate
     113else
     114    G.!DefaultTemplate = G.!DefaultDllTemplate
    104115
    105116/* check emxexp.exe existence */
     
    160171        exports_tail = ''
    161172
    162         /* write stuff before ${exports} */
    163         if (Opt.!DefTemplate = '') then do
    164             call lineout Opt.!DefFile, ReplaceMacros(G.!DefaultTemplate)
    165             have_exports_macro = 1
    166         end
    167         else do
    168             parse value WriteTemplatedDEF('B') with have_exports_macro' 'exports_tail
    169         end
    170 
    171         call lineout Opt.!DefFile
    172        
    173173        /* if there are no object files, jsut leave the EXPORTS section empty */
    174174        if (Opt.!Objects.0 == 0) then
    175175                have_exports_macro = 0
     176
     177        /* write stuff before ${exports} */
     178        if (Opt.!DefTemplate == '') then do
     179            call lineout Opt.!DefFile, ReplaceMacros(G.!DefaultTemplate)
     180            if (have_exports_macro) then
     181                call lineout Opt.!DefFile, 'EXPORTS'
     182        end
     183        else do
     184            parse value WriteTemplatedDEF('B') with have_exports_macro' 'exports_tail
     185        end
     186
     187        call lineout Opt.!DefFile
    176188
    177189        if (have_exports_macro) then do
     
    261273        if (Opt.!DefTemplate == '') then do
    262274            call lineout Opt.!DefFile, ReplaceMacros(G.!DefaultTemplate)
     275            call lineout Opt.!DefFile, 'EXPORTS'
    263276            have_exports_macro = 1
    264277        end
     
    298311    str = Replace(str, '${vendor}', Opt.!LibVendor)
    299312    str = Replace(str, '${bldlevel}', Opt.!LibBldLevel)
     313    str = Replace(str, '${exetype}', Opt.!ExeType)
    300314
    301315    return str
     
    666680                    Opt.!DefMap = G.!opts.i
    667681                end
     682                when (o == 'exe') then do
     683                    i = i + 1
     684                    Opt.!ExeType = G.!opts.i
     685                end
    668686                when (o == 'q') then do
    669687                    Opt.!Quiet = 1
     
    747765    say '   -template <file>        : DEF file template [default: none]'
    748766    say '   -map <file>             : Input/output map file [default: none]'
     767    say '   -exe <string>           : Executable type [default: none]'
    749768/*     say '   -q                      : Be quiet [default: be loud]' */
    750769    say
    751770    say '<input_file> is one or more object files to process (wildcards'
    752     say 'are NOT supported).'
     771    say 'are NOT supported). This argument may be omitted in -exe mode (see below)'
     772    say 'or if it is only necessary to attach the description to the DLL. If'
     773    say '-map is specified, this argument may not be omitted.'
    753774    say
    754775    say '<response_file> contains options and input files delimited with'
     
    767788    say 'make these assignments persistent from build to build.'
    768789    say
    769     say 'If -template option is not empty, the given file is used as a template'
     790    say 'If the -exe option is given, the script generates a .DEF file for the'
     791    say 'executable rather than for the DLL, which is useful for specifying the'
     792    say 'executable type (passed as an option value, either WINDOWCOMPAT or WINDOWAPI)'
     793    say 'and for embedding the application description into the executable. The -map'
     794    say 'option is not allowed in -exe mode.'
     795    say
     796    say 'If the -template option is not empty, the given file is used as a template'
    770797    say 'to generate the resulting DEF file.  The following macros are recognized:'
    771798    say
     
    775802    say '-  ${vendor} is replaced with the library vendor string;'
    776803    say '-  ${exports} is replaced with the list of exported entries.'
     804    say
     805    say 'In -exe mode, the following macro is additionally recognized:'
     806    say
     807    say '-  ${exetype} is replaced with the specified EXE type.'
    777808    say
    778809    say 'In addition to the above, there is also the ${bldlevel} macro that is'
     
    938969    e.E_CantDeleteFile   = 'Cannot delete file ''%1'' (RC = %2).'
    939970    e.E_InvalidOption    = 'Invalid option: ''%1''.'
     971    e.E_UnexpectedOption = 'Unexpected option: ''%1''.'
    940972    e.E_FileNotFound     = 'File not found: ''%1''.'
    941973    e.E_NoDefFile        = 'No output DEF file.'
Note: See TracChangeset for help on using the changeset viewer.