include ../user/Makefile.inc

STDLIB	= ../lib/pekoe64.a
CRT	= ../lib/crt64.o
CFINCLUDE	= -I../include

.cpp.o:
	$(CC) $(CFLAGS) $(CFINCLUDE) $*.cpp

all: chkdsk.com hello.com

clean:
	-rm -f *.o *.elf *.com *.tek *.exe 

chkdsk.o: chkdsk.cpp ../include/stdio.h ../include/pekoe.h \
  ../include/sys/types.h ../include/sys/dos.h ../include/sys/leafapi.h \
  ../include/stdarg.h ../include/iostream ../include/pekoe64.h \
  ../include/string.h ../include/types.h ../include/windows.h \
  ../include/IStorageDevice.h
hello.o: hello.cpp ../include/iostream ../include/pekoe64.h \
  ../include/pekoe.h ../include/sys/types.h ../include/sys/dos.h \
  ../include/sys/leafapi.h

chkdsk.com: chkdsk.o $(STDLIB) $(CRT)
	$(LD) $(LFLAGS) -o chkdsk.elf chkdsk.o $(CRT) $(STDLIB)
	$(ELF2COM) chkdsk.elf chkdsk.exe
	$(BIM2BIN) -osacmp -tek1 BS:0 in:chkdsk.exe out:chkdsk.tek
	$(BINDCOM) tek ../tools/sfx64.bin chkdsk.tek chkdsk.com


hello.com: hello.o $(STDLIB) $(CRT)
	$(LD) $(LFLAGS) -o hello.elf hello.o $(CRT) $(STDLIB)
	$(ELF2COM) hello.elf hello.exe
	$(BIM2BIN) -osacmp -tek1 BS:0 in:hello.exe out:hello.tek
	$(BINDCOM) tek ../tools/sfx64.bin hello.tek hello.com

