瀏覽代碼

* updated

peter 24 年之前
父節點
當前提交
c3cbe78c27
共有 1 個文件被更改,包括 49 次插入10 次删除
  1. 49 10
      compiler/utils/fpimpdef.pp

+ 49 - 10
compiler/utils/fpimpdef.pp

@@ -1,6 +1,15 @@
+{$APPTYPE CONSOLE}
 program FPimpdef;
+{$DEFINE STANDALONE}
+{$IFNDEF FPC}
 uses
-ImpDef;
+ dmisc,
+ ImpDef;
+{$ELSE}
+uses
+ DOS,
+ ImpDef;
+{$ENDIF}
 var
 binname:string;
 function Ofound(const short,full:string):longint;
@@ -39,22 +48,52 @@ begin
     end;
   writeln('Usage: ',fn,' [options]');
   writeln('Options:');
-  writeln('-i | --input  <file> - set input file;');
-  writeln('-o | --output <file> - set output file');
-  writeln('-h | --help          - show this screen');
+  writeln('-i | --input     <file> - set input file;');
+  writeln('-o | --output    <file> - set output .def file');
+  writeln('-l | --library   <file> - set output static library');
+  writeln('-s | --assembler <name> - use <name> for assembler (default asw)');
+  writeln('-r | --archiver  <name> - use <name> for archiver (default arw)');
+  writeln('-h | --help             - show this screen');
   halt;
 end;
+{$ifndef UNIX}
+procedure AddExt(var s:string);
+ var
+  s1:string;
+  i:longint;
+ begin
+  s1:=copy(s,length(s)-3,4);
+  for i:=1 to length(s1)do
+   s1[i]:=upcase(s1[i]);
+  if s1<>'.EXE'then
+   s:=s+'.EXE';
+ end;
+{$endif}
+var
+ EnvPath:string;
 begin
 binname:=GetOption('-i','--input');
 if(binname='')or(Ofound('-h','--help')>0)then
   help_info;
-if not makedef(binname,GetOption('-o','--output'))then
+ asw_name:=GetOption('-s','--assembler');
+ if asw_name='' then
+  asw_name:='asw';
+ arw_name:=GetOption('-r','--archiver');
+ if arw_name='' then
+  arw_name:='arw';
+{$ifndef UNIX}
+ AddExt(asw_name);
+ AddExt(arw_name);
+{$endif}
+ EnvPath:=GetEnv('Path');
+ if EnvPath='' then
+  EnvPath:=GetEnv('PATH');
+ asw_name:=FSearch(asw_name,EnvPath);
+ arw_name:=FSearch(arw_name,EnvPath);
+if not makedef(binname,GetOption('-o','--output'),GetOption('-l','--library'))then
   begin
    writeln('Export names not found');
    halt(1);
   end;
-end.  $Log$
-end.  Revision 1.2  2000-07-13 11:32:55  michael
-end.  + removed logs
-end. 
-}
+end.
+