Changeset 78


Ignore:
Timestamp:
May 1, 2003, 4:23:49 PM (22 years ago)
Author:
bird
Message:

Added 'cc' flag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/misc/dllar.cmd

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r77 r78  
    6565    inputFiles.0 = 0;
    6666    description = '';
    67     CCFLAGS = '-s -Zcrtdll';
    68     EXTRA_CCFLAGS = '';
     67    CC = 'gcc.exe';
     68    CFLAGS = '-s -Zcrtdll';
     69    EXTRA_CFLAGS = '';
    6970    EXPORT_BY_ORDINALS = 0;
    7071    exclude_symbols = '';
     
    8889                description = GetLongArg();
    8990            when abbrev('flags', substr(tmp, 2), 1) then
    90                 CCFLAGS = GetLongArg();
     91                CFLAGS = GetLongArg();
     92            when abbrev('cc', substr(tmp, 2), 1) then
     93                CC = GetLongArg();
    9194            when abbrev('help', substr(tmp, 2), 1) then
    9295                call PrintHelp;
     
    98101                library_flags = library_flags||GetLongArg()' ';
    99102            when abbrev('nocrtdll', substr(tmp, 2), 5) then
    100                 CCFLAGS = '-s';
     103                CFLAGS = '-s';
    101104            otherwise
    102                 EXTRA_CCFLAGS = EXTRA_CCFLAGS' 'tmp;
     105                EXTRA_CFLAGS = EXTRA_CFLAGS' 'tmp;
    103106            end /*select*/
    104107        end
     
    198201    end;
    199202
    200     EXTRA_CCFLAGS = substr(EXTRA_CCFLAGS, 2);
     203    EXTRA_CFLAGS = substr(EXTRA_CFLAGS, 2);
    201204
    202205    defFile = outFile'.def';
     
    219222    /*
    220223     * Create the def file.
    221      */                                                                         
     224     */
    222225    call SysFileDelete(defFile);
    223226    call stream defFile, 'c', 'open write';
     
    238241            if (EXPORT_BY_ORDINALS) then
    239242            do
    240                 line = line||copies('   ',(71-length(line))%8)'@'ordinal' NONAME';
     243                line = line||copies('    ',(71-length(line))%8)'@'ordinal' NONAME';
    241244                ordinal = ordinal + 1;
    242245            end;
     
    256259     *  We just apply long cmdline hack here to save us trouble with slashes and such.
    257260     *  The hack is to make a shell script for we execute using sh.exe. (.exe is of vital importance!)
    258      *  OLD: call doCommand('gcc 'CCFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CCFLAGS);
     261     *  OLD: call doCommand('gcc 'CFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CFLAGS);
    259262     */
    260263    sTmpFile = SysTempFileName('.\dllar-??.???');
    261264    call lineout sTmpFile, '#!/bin/sh'
    262     call charout sTmpFile, 'gcc 'CCFLAGS' -Zdll -o 'translate(dllFile defFile, '/', '\');
     265    call charout sTmpFile, CC CFLAGS' -Zdll -o 'translate(dllFile defFile, '/', '\');
    263266    do I = 1 to inputFiles.0
    264267        if (left(inputFiles.I, 1) \= '!') then
    265268            call charout sTmpFile, ' 'translate(inputFiles.I, '/', '\');;
    266269    end;
    267     call lineout sTmpFile, ' 'EXTRA_CCFLAGS
     270    call lineout sTmpFile, ' 'EXTRA_CFLAGS
    268271    call stream dsTmpFile, 'c', 'close'
    269272    call doCommand 'sh.exe 'sTmpFile;
     
    281284            gccCmdl = gccCmdl' 'inputFiles.I;
    282285    end;
    283     call doCommand('gcc 'CCFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CCFLAGS);
     286    call doCommand(CC CFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CFLAGS);
    284287end
    285288
     
    304307PrintHelp:
    305308 say 'Usage: dllar [-o[utput] output_file] [-d[escription] "dll descrption"]'
    306  say '       [-f[lags] "CCFLAGS"] [-ord[inals]] -ex[clude] "symbol(s)"'
     309 say '       [-cc "CC"] [-f[lags] "CFLAGS"] [-ord[inals]] -ex[clude] "symbol(s)"'
    307310 say '       [-libf[lags] "{INIT|TERM}{GLOBAL|INSTANCE}"] [-nocrt[dll]]'
    308311 say '       [*.o] [*.a]'
    309  say '*> "output_file" should have no extension'
    310  say '   If it has the .o, .a or .dll extension, it is automatically removed'
    311  say '   The import library name is derived from this and is set to "name".a'
    312  say '*> "flags" should be any set of valid GCC flags (default: -s -Zcrtdll)'
    313  say '   These flags will be put at the start of GCC command line'
     312 say '*> "output_file" should have no extension.'
     313 say '   If it has the .o, .a or .dll extension, it is automatically removed.'
     314 say '   The import library name is derived from this and is set to "name".a.'
     315 say '*> "cc" is used to use another GCC executable.   (default: gcc.exe)'
     316 say '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)'
     317 say '   These flags will be put at the start of GCC command line.'
    314318 say '*> -ord[inals] tells dllar to export entries by ordinals. Be careful.'
    315319 say '*> -ex[clude] defines symbols which will not be exported. You can define'
    316  say '   multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*"'
     320 say '   multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".'
    317321 say '   If the last character of a symbol is "*", all symbols beginning'
    318  say '   with the prefix before "*" will be exclude, (see _GLOBAL* above)'
     322 say '   with the prefix before "*" will be exclude, (see _GLOBAL* above).'
    319323 say '*> -libf[lags] can be used to add INITGLOBAL/INITINSTANCE and/or'
    320  say '   TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library'
     324 say '   TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.'
    321325 say '*> -nocrtdll switch will disable linking the library against emx''s'
    322  say '   C runtime DLLs'
     326 say '   C runtime DLLs.'
    323327 say '*> All other switches (for example -L./ or -lmylib) will be passed'
    324  say '   unchanged to GCC at the end of command line'
     328 say '   unchanged to GCC at the end of command line.'
    325329 say '*> If you create a DLL from a library and you do not specify -o,'
    326330 say '   the basename for DLL and import library will be set to library name,'
    327331 say '   the initial library will be renamed to 'name'_s.a (_s for static)'
    328332 say '   i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial'
    329  say '   library will be renamed into gcc_s.a'
     333 say '   library will be renamed into gcc_s.a.'
    330334 say '--------'
    331335 say 'Example:'
     
    386390    parse arg _cmd_;
    387391    say _cmd_;
    388         if (length(_cmd_) > 1023) then
    389         do
     392    if (length(_cmd_) > 1023) then
     393    do
    390394        /* Trick: use a different shell to launch the command since CMD.EXE has a
    391395         *  1024 byte limit on the length of the command line ...
     
    398402        call value '__TMP__','','OS2ENVIRONMENT';
    399403    end
    400         else
    401     do
    402             Address CMD '@'_cmd_;
     404    else
     405    do
     406        Address CMD '@'_cmd_;
    403407        rcCmd = rc;
    404408    end
    405409
    406         if (rcCmd \= 0) then
    407     do
    408             say 'command failed, exit code='rcCmd;
    409             call CleanUp;
    410             exit rcCmd;
    411         end;
    412         drop _cmd_;                            /* prevent running out of memory... */
     410    if (rcCmd \= 0) then
     411    do
     412        say 'command failed, exit code='rcCmd;
     413        call CleanUp;
     414        exit rcCmd;
     415    end;
     416    drop _cmd_;                            /* prevent running out of memory... */
    413417return;
    414418
Note: See TracChangeset for help on using the changeset viewer.