Subversion Repositories Kolibri OS

Rev

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

  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #ifndef WEXITSTATUS
  4. #include <sys/wait.h>
  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 infile.c outfile.o\n",argv[0]);
  33.   return 1;
  34.  }
  35. #if (HAS_DEVENV==1)
  36.  sprintf(buf,"gcc -c %s -o %s -Os -nostdinc -fno-builtin -I/dev/env/MENUETDEV/include "
  37.              "-fno-common -DMENUETDEV='\"/dev/env/MENUETDEV\"' "
  38.              "-D__DEV_CONFIG_H='</dev/env/MENUETDEV/config.h>' -D__MENUETOS__ ",argv[1],argv[2]);
  39. #else
  40.  sprintf(buf,"gcc -c %s -o %s -Os -nostdinc -fno-builtin -I%s/include "
  41.              "-fno-common -DMENUETDEV='\"%s\"' "
  42.              "-D__DEV_CONFIG_H=\"<%s/config.h>\" -D__MENUETOS__ ",argv[1],argv[2],__dev_env,__dev_env,__dev_env);
  43. #endif
  44.  if(argc>3)
  45.   for(u=3;u<argc;u++)
  46.   {
  47.    strcat(buf,argv[u]);
  48.    strcat(buf," ");
  49.   }
  50.  return WEXITSTATUS(system(buf));
  51. }
  52.