From fd314a4ca8308cd6dc46169a830b907538d06070 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 7 Oct 2018 22:48:15 +0100 Subject: [PATCH] sh: fix all the build messes --- Applications/V7/cmd/sh/Makefile.6502 | 10 ++++++---- Applications/V7/cmd/sh/Makefile.6809 | 6 +++--- Applications/V7/cmd/sh/Makefile.z80 | 2 +- Applications/V7/cmd/sh/defs.h | 8 ++++++++ Applications/V7/cmd/sh/macro.c | 2 +- Applications/V7/cmd/sh/main.c | 2 +- Applications/V7/cmd/sh/name.c | 2 +- Applications/V7/cmd/sh/xec.c | 2 +- 8 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Applications/V7/cmd/sh/Makefile.6502 b/Applications/V7/cmd/sh/Makefile.6502 index 1e59fd12..cbff2c5a 100644 --- a/Applications/V7/cmd/sh/Makefile.6502 +++ b/Applications/V7/cmd/sh/Makefile.6502 @@ -17,7 +17,7 @@ SRCS = args.c blok.c builtin.c cmd.c ctype.c error.c expand.c fault.c io.c \ INCS = brkincr.h ctype.h defs.h mac.h mode.h name.h stak.h sym.h timeout.h OBJS = $(SRCS:.c=.o) -FOBJS = $(patsubst %.c,fshbuild/%.o, $(SRCS)) +FOBJS = $(patsubst %.c,fshbuild_%.o, $(SRCS)) LIBS = ../../../../Library/libs/c6502.lib @@ -36,12 +36,14 @@ $(FOBJS): $(INCS) $(OBJS): %.o : %.c $(CC) -c $(CFLAGS) $(COPT) $< -$(FOBJS): fshbuild/%.o: %.c - $(CC) -c $(CFLAGS) -c -DBUILD_FSH $< -o $@ +$(FOBJS): fshbuild_%.o: %.c + # -c and -o is busted if used together in cc65 + cp $< fshbuild_$< + $(CC) -c $(CFLAGS) -c -DBUILD_FSH fshbuild_$< clean: - rm -f $(OBJS) fsh sh *~ core + rm -f $(OBJS) $(FOBJS) fsh sh *~ core rmbak: rm -f *~ core diff --git a/Applications/V7/cmd/sh/Makefile.6809 b/Applications/V7/cmd/sh/Makefile.6809 index 2677e511..acf9f3ee 100644 --- a/Applications/V7/cmd/sh/Makefile.6809 +++ b/Applications/V7/cmd/sh/Makefile.6809 @@ -37,13 +37,13 @@ $(FOBJS): fshbuild/%.o: %.c $(CC) -c $(CFLAGS) $(COPT) -DBUILD_FSH $< -o $@ sh: $(OBJS) $(CRT0) - $(LINKER) -o $@ $(LINKER_OPT) $^ + $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $^ fsh: $(FOBJS) - $(LINKER) -o $@ $(LINKER_OPT) $^ -lreadline6809 + $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $^ -lreadline6809 clean: - rm -f $(OBJS) fsh sh $(SRCS:.c=) core *~ + rm -f $(OBJS) $(FOBJS) fsh sh $(SRCS:.c=) core *~ rmbak: rm -f *~ core diff --git a/Applications/V7/cmd/sh/Makefile.z80 b/Applications/V7/cmd/sh/Makefile.z80 index c661a795..6d377670 100644 --- a/Applications/V7/cmd/sh/Makefile.z80 +++ b/Applications/V7/cmd/sh/Makefile.z80 @@ -30,7 +30,7 @@ $(FOBJS): fshbuild/%.rel: %.c $(FCC) $(Z80_PLATFORM) -c -DBUILD_FSH $< -o $@ clean: - rm -f $(OBJS) sh $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin + rm -f $(OBJS) fsh sh $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin rmbak: rm -f *~ core diff --git a/Applications/V7/cmd/sh/defs.h b/Applications/V7/cmd/sh/defs.h index 4a2fa70f..8cea066f 100644 --- a/Applications/V7/cmd/sh/defs.h +++ b/Applications/V7/cmd/sh/defs.h @@ -10,6 +10,14 @@ #include #include +/* Figure out if we have to deal with bigger buffers specially due to cc65 + limits. Really cc65 needs fixing. */ +#if defined(__CC65__) && defined(BUILD_FSH) +#define static6502 static +#else +#define static6502 +#endif + /* * UNIX shell */ diff --git a/Applications/V7/cmd/sh/macro.c b/Applications/V7/cmd/sh/macro.c index 534a87a4..89beac5a 100644 --- a/Applications/V7/cmd/sh/macro.c +++ b/Applications/V7/cmd/sh/macro.c @@ -258,7 +258,7 @@ static void comsubst(void) void subst(int in, int ot) { register char c; - FILEBLK fb; + static6502 FILEBLK fb; register int count = CPYSIZ; push(&fb); diff --git a/Applications/V7/cmd/sh/main.c b/Applications/V7/cmd/sh/main.c index 94a13e0b..17bdda97 100644 --- a/Applications/V7/cmd/sh/main.c +++ b/Applications/V7/cmd/sh/main.c @@ -38,7 +38,7 @@ static unsigned int inleft; static char *inptr; static char ineof; -static int line_input(char *prmpt) +static int line_input(const char *prmpt) { int l; if (!isatty(standin->fdes)) diff --git a/Applications/V7/cmd/sh/name.c b/Applications/V7/cmd/sh/name.c index 7bd9a9f6..ece5e338 100644 --- a/Applications/V7/cmd/sh/name.c +++ b/Applications/V7/cmd/sh/name.c @@ -108,7 +108,7 @@ void assign(NAMPTR n, const char *v) int readvar(char **names) { - FILEBLK fb; + static6502 FILEBLK fb; register FILE f = &fb; register char c; register int rc = 0; diff --git a/Applications/V7/cmd/sh/xec.c b/Applications/V7/cmd/sh/xec.c index 98f62304..c31a2781 100644 --- a/Applications/V7/cmd/sh/xec.c +++ b/Applications/V7/cmd/sh/xec.c @@ -438,7 +438,7 @@ int execute(TREPTR argt, int execflg, int *pf1, int *pf2) void execexp(char *s, UFD f) { - FILEBLK fb; + static6502 FILEBLK fb; push(&fb); if (s) { estabf(s); -- 2.34.1