Changeset 78
- Timestamp:
- May 1, 2003, 4:23:49 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/misc/dllar.cmd
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r77 r78 65 65 inputFiles.0 = 0; 66 66 description = ''; 67 CCFLAGS = '-s -Zcrtdll'; 68 EXTRA_CCFLAGS = ''; 67 CC = 'gcc.exe'; 68 CFLAGS = '-s -Zcrtdll'; 69 EXTRA_CFLAGS = ''; 69 70 EXPORT_BY_ORDINALS = 0; 70 71 exclude_symbols = ''; … … 88 89 description = GetLongArg(); 89 90 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(); 91 94 when abbrev('help', substr(tmp, 2), 1) then 92 95 call PrintHelp; … … 98 101 library_flags = library_flags||GetLongArg()' '; 99 102 when abbrev('nocrtdll', substr(tmp, 2), 5) then 100 C CFLAGS = '-s';103 CFLAGS = '-s'; 101 104 otherwise 102 EXTRA_C CFLAGS = EXTRA_CCFLAGS' 'tmp;105 EXTRA_CFLAGS = EXTRA_CFLAGS' 'tmp; 103 106 end /*select*/ 104 107 end … … 198 201 end; 199 202 200 EXTRA_C CFLAGS = substr(EXTRA_CCFLAGS, 2);203 EXTRA_CFLAGS = substr(EXTRA_CFLAGS, 2); 201 204 202 205 defFile = outFile'.def'; … … 219 222 /* 220 223 * Create the def file. 221 */ 224 */ 222 225 call SysFileDelete(defFile); 223 226 call stream defFile, 'c', 'open write'; … … 238 241 if (EXPORT_BY_ORDINALS) then 239 242 do 240 line = line||copies(' 243 line = line||copies(' ',(71-length(line))%8)'@'ordinal' NONAME'; 241 244 ordinal = ordinal + 1; 242 245 end; … … 256 259 * We just apply long cmdline hack here to save us trouble with slashes and such. 257 260 * The hack is to make a shell script for we execute using sh.exe. (.exe is of vital importance!) 258 * OLD: call doCommand('gcc 'C CFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CCFLAGS);261 * OLD: call doCommand('gcc 'CFLAGS' -Zdll -o 'dllFile defFile||gccCmdl' 'EXTRA_CFLAGS); 259 262 */ 260 263 sTmpFile = SysTempFileName('.\dllar-??.???'); 261 264 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, '/', '\'); 263 266 do I = 1 to inputFiles.0 264 267 if (left(inputFiles.I, 1) \= '!') then 265 268 call charout sTmpFile, ' 'translate(inputFiles.I, '/', '\');; 266 269 end; 267 call lineout sTmpFile, ' 'EXTRA_C CFLAGS270 call lineout sTmpFile, ' 'EXTRA_CFLAGS 268 271 call stream dsTmpFile, 'c', 'close' 269 272 call doCommand 'sh.exe 'sTmpFile; … … 281 284 gccCmdl = gccCmdl' 'inputFiles.I; 282 285 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); 284 287 end 285 288 … … 304 307 PrintHelp: 305 308 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)"' 307 310 say ' [-libf[lags] "{INIT|TERM}{GLOBAL|INSTANCE}"] [-nocrt[dll]]' 308 311 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.' 314 318 say '*> -ord[inals] tells dllar to export entries by ordinals. Be careful.' 315 319 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*".' 317 321 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).' 319 323 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.' 321 325 say '*> -nocrtdll switch will disable linking the library against emx''s' 322 say ' C runtime DLLs '326 say ' C runtime DLLs.' 323 327 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.' 325 329 say '*> If you create a DLL from a library and you do not specify -o,' 326 330 say ' the basename for DLL and import library will be set to library name,' 327 331 say ' the initial library will be renamed to 'name'_s.a (_s for static)' 328 332 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.' 330 334 say '--------' 331 335 say 'Example:' … … 386 390 parse arg _cmd_; 387 391 say _cmd_; 388 389 392 if (length(_cmd_) > 1023) then 393 do 390 394 /* Trick: use a different shell to launch the command since CMD.EXE has a 391 395 * 1024 byte limit on the length of the command line ... … … 398 402 call value '__TMP__','','OS2ENVIRONMENT'; 399 403 end 400 401 do 402 404 else 405 do 406 Address CMD '@'_cmd_; 403 407 rcCmd = rc; 404 408 end 405 409 406 407 do 408 409 410 411 412 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... */ 413 417 return; 414 418 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.