# !WinEdit Makefile

# ****** EDIT MAKEPROTO, NOT MAKEFILE ******
# Then construct Makefile using "amu -f MakeProto depend"

# Pass INSTDIR set to the directory into which you wish to install !WinEdit

# Can set:
#  CFLAGS     -  additional cc options
#  INCLUDES   -  locations to search for "included" files
#  AFLAGS     -  additional objasm options
#  LDFLAGS    -  additional link options

INCLUDES = -IC:

CPFLAGS = A~C~DF~L~N~P~Q~R~S~T~V

LIBS = C:o.Stubs

CFILES = main.c message.c error.c registry.c document.c wimp.c interactor.c debug.c menu.c selection.c dragdrop.c template.c grid.c data.c resize.c dbox.c winflags.c extent.c props.c justify.c genheader.c sort.c saveas.c dbmalloc.c align.c colours.c version.c

OFILES = main.o message.o swicall.o error.o o.registry document.o wimp.o interactor.o debug.o menu.o selection.o dragdrop.o template.o grid.o data.o resize.o dbox.o winflags.o extent.o props.o justify.o genheader.o sort.o saveas.o dbmalloc.o align.o colours.o

FILES = !Boot !Run !RunImage !Sprites Messages Palette Sprites Templates

all: !RunImage
        @echo *** Build complete

!RunImage: $(OFILES)
        cc -c $(CFLAGS) $(INCLUDES) -o o.version c.version
        link $(LDFLAGS) -o $@ $(OFILES) o.version $(LIBS)
        settype $@ Absolute
        squeeze $@

.c.o:
        cc -c $(CFLAGS) $(INCLUDES) -o $@ $<

.s.o:
        objasm -quit -CloseExec $(AFLAGS) -from $< -to $@

install: $(FILES)
        cdir $(INSTDIR).!WinEdit
        copy !Boot $(INSTDIR).!WinEdit.!Boot $(CPFLAGS)
        copy !Run $(INSTDIR).!WinEdit.!Run $(CPFLAGS)
        copy !RunImage $(INSTDIR).!WinEdit.!RunImage $(CPFLAGS)
        copy !Sprites $(INSTDIR).!WinEdit.!Sprites $(CPFLAGS)
        copy Messages $(INSTDIR).!WinEdit.Messages $(CPFLAGS)
        copy Palette $(INSTDIR).!WinEdit.Palette $(CPFLAGS)
        copy Sprites $(INSTDIR).!WinEdit.Sprites $(CPFLAGS)
        copy Templates $(INSTDIR).!WinEdit.Templates $(CPFLAGS)
        @echo *** Installation complete

depend:
        copy MakeProto Makefile1 $(CPFLAGS)
        cc -c -M $(INCLUDES) $(CFILES) >> Makefile1
        remove Makefile0
        -rename Makefile Makefile0
        rename Makefile1 Makefile
        @echo *** Dependencies established

clean:
        create o.foo
        wipe o.* ~CRF~V
        remove !RunImage
        @echo *** Cleaned

# Dependencies following this line provided by make depend

