exit(1);
}
cpu = mstrdup(p);
- if (strcmp(cpu, "z80") && strcmp(cpu, "z180")) {
- fprintf(stderr,"fcc: only z80 and z180 targets currently handled.\n");
+ if (strcmp(cpu, "z80") && strcmp(cpu, "z180") && strcmp(cpu, "r2k") && strcmp(cpu, "r3ka")) {
+ fprintf(stderr,"fcc: only Zilog z80, z180 and Rabbit r2k/r3ka targets currently handled.\n");
exit(1);
}
}
# IMHO beats forking the library or building a private copy.
#
#
-CPU=z80
+CPU=$1
LIBZ80=$(../../Kernel/tools/findsdcc $CPU)
cp $LIBZ80/$CPU.lib tmp.lib
sdar d tmp.lib tolower.rel toupper.rel _ltoa.rel _itoa.rel abs.rel atoi.rel
# Added in 3.7.0rc so we can't rely on it yet and must always use our own
sdar d tmp.lib strtoul.rel
-mv tmp.lib sdccz80.lib
+mv tmp.lib sdcc$CPU.lib
#include "syscall_name.h"
static char namebuf[128];
+static char *cpu;
static void write_call(int n)
{
FILE *fp;
- snprintf(namebuf, 128, "fuzix/syscall_%s.s", syscall_name[n]);
+ snprintf(namebuf, 128, "fuzix%s/syscall_%s.s", cpu, syscall_name[n]);
fp = fopen(namebuf, "w");
if (fp == NULL) {
perror(namebuf);
static void write_makefile(void)
{
int i;
- FILE *fp = fopen("fuzix/Makefile", "w");
+ char path[256];
+ FILE *fp;
+
+ snprintf(path, 256, "fuzix%s/Makefile", cpu);
+
+ fp = fopen(path, "w");
if (fp == NULL) {
perror("Makefile");
exit(1);
}
fprintf(fp, "# Autogenerated by tools/syscall\n");
- fprintf(fp, "CROSS_AS=sdasz80\nCROSS_LD=sdldz80\nCROSS_AR=sdar\n");
+ if (*cpu == 'z')
+ fprintf(fp, "CROSS_AS=sdasz80\nCROSS_LD=sdldz80\nCROSS_AR=sdar\n");
+ else
+ fprintf(fp, "CROSS_AS=sdasrab\nCROSS_LD=sdldz80\nCROSS_AR=sdar\n");
fprintf(fp, "ASOPTS=\n\n");
fprintf(fp, "ASYS=syscall$(PLATFORM).s\n");
fprintf(fp, "ASRCS = syscall_%s.s\n", syscall_name[0]);
int main(int argc, char *argv[])
{
+ cpu = argv[1];
+ if (cpu == NULL)
+ cpu = "z80";
write_makefile();
write_call_table();
exit(0);