#
# Makefile
# Copyright (C) 1996, Onno Hovers
#

TOPSRC=..
include ../Make.global

ASMSOURCES = ilocked.S

CSOURCES = debug.c envir.c error.c file.c findfile.c fs.c handle.c \
           init.c module.c object.c peload.c process.c profile.c \
           rtlmem.c run.c security.c segment.c signal.c \
           sysinfo.c thread.c time.c virtual.c 

OBJS = $(CSOURCES:.c=.o) $(ASMSOURCES:.S=.o)

# implicit rules

.SUFFIXES: .exp

.c.o:
	$(CC) $(CFLAGS)  -c $<	 
.S.o:
	$(CC) $(CFLAGS)	 -c $<

all: kernel.o

kernel.o: $(OBJS)
	$(LDR) $(OBJS) -o kernel.o


clean:
	$(RM) *.s *.o *.bak *~ .depend errors

errors error err:
	$(RM) errors	
	for i in $(CSOURCES); \
	do ( $(CC) -c -o /dev/null $(CFLAGS) $$i 2>> errors );\
	done

.depend depend dep:
	$(RM) .depend 
	for i in $(CSOURCES); \
	do ( $(CC) $(CFLAGS) $(CDEPEND) $$i >> .depend; echo >> .depend ) ; \
	done

ifeq (.depend,$(wildcard .depend))
include .depend
endif