/programs/develop/libraries/menuetlibc/linuxtools/Makefile |
---|
0,0 → 1,30 |
include $(MENUETDEV)/osrules.mak |
WAIT = |
ifdef ON_MINGW |
WAIT = -DWEXITSTATUS= |
endif |
TOOLS = mgcc$(EXESUFFIX) mld$(EXESUFFIX) mgpp$(EXESUFFIX) mmkdep$(EXESUFFIX) \ |
mchmem$(EXESUFFIX) |
all: $(TOOLS) |
mgcc$(EXESUFFIX): mgcc.c |
gcc mgcc.c -o mgcc$(EXESUFFIX) -DHAS_DEVENV=$(HAS_DEVENV) -s $(WAIT) |
mgpp$(EXESUFFIX): mgpp.c |
gcc mgpp.c -o mgpp$(EXESUFFIX) -DHAS_DEVENV=$(HAS_DEVENV) -s \ |
-DTOOLNAME=\"$(GPP_TOOLNAME)\" $(WAIT) |
mld$(EXESUFFIX): mld.c |
gcc mld.c -o mld$(EXESUFFIX) -DHAS_DEVENV=$(HAS_DEVENV) -s $(WAIT) |
mchmem$(EXESUFFIX): mchmem.c |
gcc mchmem.c -o mchmem$(EXESUFFIX) -DHAS_DEVENV=$(HAS_DEVENV) -s $(WAIT) |
mmkdep$(EXESUFFIX): mmkdep.c |
gcc mmkdep.c -o mmkdep$(EXESUFFIX) -DHAS_DEVENV=$(HAS_DEVENV) -s $(WAIT) |
clean: |
$(RM) $(TOOLS) |
/programs/develop/libraries/menuetlibc/linuxtools/mchmem.c |
---|
0,0 → 1,49 |
#define OFF 20 |
#include<stdio.h> |
#include<stdlib.h> |
#include<string.h> |
int main(int argc,char * argv[]) |
{ |
FILE * f; |
char * buf; |
unsigned long sz,newsz; |
if(argc<3) |
{ |
printf("Usage:\n"); |
printf("%s filename memsize_hex\n",argv[0]); |
printf("Example:\n\t%s test.app 100000\n",argv[0]); |
return -1; |
} |
sscanf(argv[2],"%x",&newsz); |
if(newsz<0x10000 || newsz>0x2000000) /* Min 64kB max 32MB */ |
{ |
printf("Impossibly large memory size %x\n",newsz); |
return -1; |
} |
f=fopen(argv[1],"rb"); |
if(!f) |
{ |
printf("Unable to open file\n"); |
return -1; |
} |
fseek(f,0,SEEK_END); |
sz=ftell(f); |
fseek(f,0,SEEK_SET); |
buf=malloc(sz); |
if(!buf) |
{ |
printf("Unable to allocate temporary buffer\n"); |
fclose(f); |
return -1; |
} |
fread(buf,1,sz,f); |
fclose(f); |
f=fopen(argv[1],"wb"); |
*((unsigned long *)(buf+OFF))=newsz; |
fwrite(buf,1,sz,f); |
fclose(f); |
free(buf); |
return 0; |
} |
/programs/develop/libraries/menuetlibc/linuxtools/mgcc.c |
---|
0,0 → 1,51 |
#include<stdio.h> |
#include<stdlib.h> |
#ifndef WEXITSTATUS |
#include <sys/wait.h> |
#endif |
char buf[32768]; |
#if (HAS_DEVENV == 0) |
char * __dev_env; |
#endif |
static void __env(void) |
{ |
char * p=getenv("MENUETDEV"); |
if(!p) |
{ |
printf("MENUETDEV system variable not set !!!\n"); |
exit(-1); |
} |
#if (HAS_DEVENV == 0) |
__dev_env=p; |
#endif |
} |
int main(int argc,char * argv[]) |
{ |
int u; |
__env(); |
if(argc<3) |
{ |
fprintf(stderr,"Usage: %s infile.c outfile.o\n",argv[0]); |
return 1; |
} |
#if (HAS_DEVENV==1) |
sprintf(buf,"gcc -c %s -o %s -Os -nostdinc -fno-builtin -I/dev/env/MENUETDEV/include " |
"-fno-common -DMENUETDEV='\"/dev/env/MENUETDEV\"' " |
"-D__DEV_CONFIG_H='</dev/env/MENUETDEV/config.h>' -D__MENUETOS__ ",argv[1],argv[2]); |
#else |
sprintf(buf,"gcc -c %s -o %s -Os -nostdinc -fno-builtin -I%s/include " |
"-fno-common -DMENUETDEV='\"%s\"' " |
"-D__DEV_CONFIG_H=\"<%s/config.h>\" -D__MENUETOS__ ",argv[1],argv[2],__dev_env,__dev_env,__dev_env); |
#endif |
if(argc>3) |
for(u=3;u<argc;u++) |
{ |
strcat(buf,argv[u]); |
strcat(buf," "); |
} |
return WEXITSTATUS(system(buf)); |
} |
/programs/develop/libraries/menuetlibc/linuxtools/mgpp.c |
---|
0,0 → 1,52 |
#include<stdio.h> |
#include<stdlib.h> |
#ifndef WEXITSTATUS |
#include <sys/wait.h> |
#endif |
char buf[32768]; |
#if (HAS_DEVENV==0) |
char * __dev_env; |
#endif |
static void __env(void) |
{ |
char * p=getenv("MENUETDEV"); |
if(!p) |
{ |
printf("MENUETDEV system variable not set !!!\n"); |
exit(-1); |
} |
#if (HAS_DEVENV==0) |
__dev_env=p; |
#endif |
} |
int main(int argc,char * argv[]) |
{ |
int u; |
__env(); |
if(argc<3) |
{ |
fprintf(stderr,"Usage: %s infile.cpp outfile.o\n",argv[0]); |
return 1; |
} |
#if (HAS_DEVENV==1) |
sprintf(buf,"%s -c %s -o %s -nostdinc -fno-builtin -I/dev/env/MENUETDEV/include -fno-common " |
"-I/dev/env/MENUETDEV/include/STL " |
"-O1 -fno-rtti -fno-exceptions -fomit-frame-pointer -D__MENUETOS__ ",TOOLNAME,argv[1],argv[2]); |
#else |
sprintf(buf,"%s -c %s -o %s -nostdinc -fno-builtin -I%s/include -fno-common " |
"-I%s/include/STL -D__MENUETOS__ " |
"-O1 -fno-rtti -fno-exceptions -fomit-frame-pointer ",TOOLNAME,argv[1],argv[2], |
__dev_env,__dev_env); |
#endif |
if(argc>3) |
for(u=3;u<argc;u++) |
{ |
strcat(buf,argv[u]); |
strcat(buf," "); |
} |
return WEXITSTATUS(system(buf)); |
} |
/programs/develop/libraries/menuetlibc/linuxtools/mld.c |
---|
0,0 → 1,51 |
#include<stdio.h> |
#include<stdlib.h> |
#ifndef WEXITSTATUS |
#include <sys/wait.h> |
#endif |
char buf[32768]; |
#if (HAS_DEVENV==0) |
char * __dev_env; |
#endif |
static void __env(void) |
{ |
char * p=getenv("MENUETDEV"); |
if(!p) |
{ |
printf("MENUETDEV system variable not set !!!\n"); |
exit(-1); |
} |
#if (HAS_DEVENV==0) |
__dev_env=p; |
#endif |
} |
int main(int argc,char * argv[]) |
{ |
int u; |
__env(); |
if(argc<3) |
{ |
fprintf(stderr,"Usage: %s outprogramname file1.o file2.o ...\n",argv[0]); |
return 1; |
} |
#if (HAS_DEVENV == 1) |
sprintf(buf,"ld -T/dev/env/MENUETDEV/include/scripts/menuetos_app_v01.ld " |
"-nostdlib -L/dev/env/MENUETDEV/lib -o %s " |
"/dev/env/MENUETDEV/stub/crt0.o ",argv[1]); |
#else |
sprintf(buf,"ld -T%s/include/scripts/menuetos_app_v01.ld " |
"-nostdlib -L%s/lib -o %s " |
"%s/stub/crt0.o ",__dev_env,__dev_env,argv[1],__dev_env); |
#endif |
for(u=2;u<argc;u++) |
{ |
strcat(buf,argv[u]); |
strcat(buf," "); |
} |
strcat(buf,"-lc"); |
return WEXITSTATUS(system(buf)); |
} |
/programs/develop/libraries/menuetlibc/linuxtools/mmkdep.c |
---|
0,0 → 1,46 |
#include<stdio.h> |
#include<stdlib.h> |
#ifndef WEXITSTATUS |
#include <sys/wait.h> |
#endif |
char buf[32768]; |
#if (HAS_DEVENV == 0) |
char * __dev_env; |
#endif |
static void __env(void) |
{ |
char * p=getenv("MENUETDEV"); |
if(!p) |
{ |
printf("MENUETDEV system variable not set !!!\n"); |
exit(-1); |
} |
#if (HAS_DEVENV == 0) |
__dev_env=p; |
#endif |
} |
int main(int argc,char * argv[]) |
{ |
int u; |
__env(); |
if(argc<2) |
{ |
fprintf(stderr,"Usage: %s file1.c file2.s ...\n",argv[0]); |
return 1; |
} |
#if (HAS_DEVENV == 0) |
sprintf(buf,"gcc -nostdinc -I%s/include -D__DEV_CONFIG_H=\"<%s/config.h>\" -M ",__dev_env,__dev_env); |
#else |
sprintf(buf,"gcc -nostdinc -I/dev/env/MENUETDEV/include -D__DEV_CONFIG_H='\"/dev/env/MENUETDEV/config.h\"' -M "); |
#endif |
for(u=1;u<argc;u++) |
{ |
strcat(buf,argv[u]); |
strcat(buf," "); |
} |
return WEXITSTATUS(system(buf)); |
} |