Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
#include
2
#include
3
#ifndef WEXITSTATUS
4
#include 
5
#endif
6
 
7
char buf[32768];
8
 
9
#if (HAS_DEVENV==0)
10
char * __dev_env;
11
#endif
12
 
13
static void __env(void)
14
{
15
 char * p=getenv("MENUETDEV");
16
 if(!p)
17
 {
18
  printf("MENUETDEV system variable not set !!!\n");
19
  exit(-1);
20
 }
21
#if (HAS_DEVENV==0)
22
 __dev_env=p;
23
#endif
24
}
25
 
26
int main(int argc,char * argv[])
27
{
28
 int u;
29
 __env();
30
 if(argc<3)
31
 {
32
  fprintf(stderr,"Usage: %s outprogramname file1.o file2.o ...\n",argv[0]);
33
  return 1;
34
 }
35
#if (HAS_DEVENV == 1)
36
 sprintf(buf,"ld -T/dev/env/MENUETDEV/include/scripts/menuetos_app_v01.ld "
37
	      "-nostdlib -L/dev/env/MENUETDEV/lib -o %s "
38
              "/dev/env/MENUETDEV/stub/crt0.o ",argv[1]);
39
#else
40
 sprintf(buf,"ld -T%s/include/scripts/menuetos_app_v01.ld "
41
	      "-nostdlib -L%s/lib -o %s "
42
              "%s/stub/crt0.o ",__dev_env,__dev_env,argv[1],__dev_env);
43
#endif
44
 for(u=2;u
45
 {
46
  strcat(buf,argv[u]);
47
  strcat(buf," ");
48
 }
49
 strcat(buf,"-lc");
50
 return WEXITSTATUS(system(buf));
51
}