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
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
-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