For 6809 build, allow Linux, VT52 and ANSI versions to co-exist, and build them
authornealcrook <neal@pippaluk.org.uk>
Mon, 7 Nov 2016 17:39:07 +0000 (17:39 +0000)
committernealcrook <neal@pippaluk.org.uk>
Mon, 7 Nov 2016 17:39:07 +0000 (17:39 +0000)
all.
May want to do the same for z80 if ANSI terminals are available there? The
Linux version is just for host testing purposes.
Expand package file to include both versions, if they exist, to add the man
page and to add appropriate links for ease-of-use.

Applications/levee/Makefile
Applications/levee/Makefile.6809
Applications/levee/fuzix-levee.pkg

index 5af43bb..0d6c057 100644 (file)
@@ -7,12 +7,12 @@ CSRCS += move.c rmxcall.c ucsd.c undo.c unixcall.c wildargs.c
 OBJS = $(CSRCS:.c=.rel)
 
 levee: $(OBJS)
-       fcc -o levee $(OBJS)
+       fcc -o levee-vt52 $(OBJS)
 
 $(OBJS): $(CSRCS)
 
 .c.rel:
-       fcc -O3 -c $(@:.rel=.c)
+       fcc -O3 -DVT52=1 -DANSI=0 -c $(@:.rel=.c)
 
 clean:
-       rm -rf $(OBJS) *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *~ *.rel *.asm levee levee.bin
\ No newline at end of file
+       rm -rf $(OBJS) *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *~ *.rel *.asm levee levee.bin
index 79da4f0..634acef 100644 (file)
@@ -6,8 +6,6 @@ AR = m6809-unknown-ar
 LINKER = lwlink
 CFLAGS = -I../../Library/include -I../../Library/include/6809
 COPT = -Os -fomit-frame-pointer
-# Workaround for gcc6809 bug - register copy propagation issue
-COPT += -fno-cprop-registers
 LINKER_OPT = --format=raw -L../../Library/libs -lc6809
 LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name))
 LINKER_OPT += -L$(LIBGCCDIR) -lgcc
@@ -15,19 +13,41 @@ LINKER_OPT += --script=../util/$(TARGET).link
 ASM_OPT = -o
 CRT0 = ../../Library/libs/crt0_6809.o
 
-.SUFFIXES: .c .o
+# 3 sets of objects co-exist: _l -> linux (host) _v -> vt52 _a -> ansi
+.SUFFIXES: .c .o-l .o-v .o-a
 
 CSRCS = beep.c blockio.c display.c doscall.c editcor.c exec.c find.c
 CSRCS += flexcall.c gemcall.c globals.c insert.c main.c misc.c modify.c
 CSRCS += move.c rmxcall.c ucsd.c undo.c unixcall.c wildargs.c
+HDRS  = extern.h grep.h levee.h proto.h
 
-OBJS = $(CSRCS:.c=.o)
+OBJSL = $(CSRCS:.c=.o-l)
+OBJSA = $(CSRCS:.c=.o-a)
+OBJSV = $(CSRCS:.c=.o-v)
 
-levee: $(OBJS) $(CRT0)
-       $(LINKER) -o levee $(LINKER_OPT) $^
+all: levee-l levee-a levee-v
 
-$(OBJS): %.o: %.c
-       $(CC) $(CFLAGS) $(COPT) -c $<
+# Linux version to run on Host system for debug purposes
+levee-l: $(OBJSL)
+       gcc -o levee-linux $(OBJSL)
+
+levee-a: $(OBJSA)
+       $(LINKER) -o levee-ansi $(LINKER_OPT) $(CRT0) $(OBJSA)
+
+levee-v: $(OBJSV) $(CRT0)
+       $(LINKER) -o levee-vt52 $(LINKER_OPT) $(CRT0) $(OBJSV)
+
+# Build for Linux - assume appropriate host tools exist with default names
+$(OBJSL): %.o-l: %.c $(HDRS)
+       gcc -O3 -c -DVT52=0 -DANSI=1 -o $*.o-l $*.c
+
+## need to change include file and add appropriate -D -- and to z80 version, too
+
+$(OBJSA): %.o-a: %.c $(HDRS)
+       $(CC) $(CFLAGS) $(COPT) -c -DVT52=0 -DANSI=1 -o $*.o-a $*.c
+
+$(OBJSV): %.o-v: %.c $(HDRS)
+       $(CC) $(CFLAGS) $(COPT) -c -DVT52=1 -DANSI=0 -o $*.o-v $*.c
 
 clean:
-       rm -rf $(OBJS) *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *~ *.o *.asm levee levee.bin
+       rm -rf $(OBJS) $(OBJSL) $(OBJSA) $(OBJSV) *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *~ *.o *.rel *.asm levee levee.bin
index e5d1a44..0e2a96f 100644 (file)
@@ -1,4 +1,15 @@
-package  levee
-if-file  levee
+# vt52 version is always built, so put common files with it
+package  levee-vt52
+if-file  levee-vt52
 
-f 0755 /bin/levee       ../../Applications/levee/levee
+f 0755 /bin/levee-vt52       levee-vt52
+l      /bin/levee-vt52       /bin/levee
+l      /bin/levee            /bin/vi
+f 0644 /usr/man/man1/levee.1 levee.1
+l      /usr/man/man1/levee.1 /usr/man/man1/vi.1
+
+
+package  levee-ansi
+if-file  levee-ansi
+
+f 0755 /bin/levee-ansi       levee-ansi