#
# Global makefile
#

#
# Select your host
#
#HOST = mingw32-linux
#HOST = djgpp-msdos
HOST = mingw32-windows

include rules.mak

#
# Required to run the system
#
COMPONENTS = iface_native ntoskrnl
#DLLS = ntdll kernel32 crtdll user32 fmifs gdi32
DLLS = ntdll kernel32 crtdll fmifs gdi32
#DLLS = crtdll mingw32
SUBSYS = win32k

#
# Select the server(s) you want to build
#
SERVERS = win32
# SERVERS = posix linux os2

#
# Select the loader(s) you want to build
#
LOADERS = dos
# LOADERS = boot

#
# Select the device drivers and filesystems you want
#
DEVICE_DRIVERS = blue ide keyboard mouse null parallel serial vidport
# DEVICE_DRIVERS = beep event floppy ide_test sound test test1
FS_DRIVERS = vfat
# FS_DRIVERS = minix ext2 template
KERNEL_SERVICES = $(DEVICE_DRIVERS) $(FS_DRIVERS)
		  
APPS = args hello shell test cat bench
# APPS = cmd

all: $(COMPONENTS) $(DLLS) $(SUBSYS) $(LOADERS) $(KERNEL_SERVICES) $(APPS)
.PHONY: all

clean: $(COMPONENTS:%=%_clean) $(DLLS:%=%_clean) $(LOADERS:%=%_clean) \
       $(KERNEL_SERVICES:%=%_clean) $(APPS:%=%_clean)
.PHONY: clean

#
# Applications
#
$(APPS): %:
	make -C apps/$*

$(APPS:%=%_clean): %_clean:
	make -C apps/$* clean

.PHONY: $(APPS) $(APPS:%=%_clean)

#
# Interfaces
#
iface_native:
	make -C iface/native

iface_native_clean:
	make -C iface/native clean

.PHONY: iface_native iface_native_clean

#
# Device driver rules
#
$(DEVICE_DRIVERS): %:
	make -C services/dd/$*

$(DEVICE_DRIVERS:%=%_clean): %_clean:
	make -C services/dd/$* clean

.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_clean)

$(FS_DRIVERS): %:
	make -C services/fs/$*

$(FS_DRIVERS:%=%_clean): %_clean:
	make -C services/fs/$* clean

.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_clean)

#
# Kernel loaders
#

$(LOADERS): %:
	make -C loaders/$*

$(LOADERS:%=%_clean): %_clean:
	make -C loaders/$* clean

.PHONY: $(LOADERS) $(LOADERS:%=%_clean)

#
# Required system components
#

ntoskrnl:
	make -C ntoskrnl

ntoskrnl_clean:
	make -C ntoskrnl clean

.PHONY: ntoskrnl ntoskrnl_clean

#
# Required DLLs
#

$(DLLS): %:
	make -C lib/$*

$(DLLS:%=%_clean): %_clean:
	make -C lib/$* clean

.PHONY: $(DLLS) $(DLLS:%=%_clean)

#
# Kernel Subsystems
#
$(SUBSYS): %:
	make -C subsys/$*

$(SUBSYS:%=%_clean): %_clean:
	make -C lib/$* clean

.PHONY: $(SUBSYS) $(SUBSYS:%=%_clean)


