# Acess2 Build Configuration
#
-CC = gcc
-LD = ld
-AS = nasm
-OBJDUMP = objdump
-RM = @rm -f
-STRIP = strip
-MKDIR = mkdir
-RMDIR = rm -rf
-
-ARCH = i386
-ARCHDIR = x86
-
-FILESYSTEMS = fat ext2
-DRIVERS = ata_x86
-MODULES = FDD NE2000 BochsVBE
-
-DISTROOT = /mnt/AcessHDD/Acess2
-ACESSDIR = /home/hodgeja/Projects/Acess2
+# Install destination configuration
+DISTROOT := a:/Acess2
+xCP := mcopy -D o
+xMKDIR := mmd -D s
+
+ACESSDIR := $(dir $(lastword $(MAKEFILE_LIST)))
+ACESSDIR := $(shell cd $(ACESSDIR) && pwd)
+
+# Default build programs
+#CC := gcc
+#LD := ld
+AS := nasm
+DISASM := objdump -d -S
+RM := @rm -f
+STRIP := strip
+MKDIR := mkdir -p
+RMDIR := rm -rf
+lCP := cp
+
+
+# Load Architecture settings
+ifeq ($(ARCH),)
+ ARCH := i386
+endif
+include $(ACESSDIR)/Makefile.$(ARCH).cfg
+ifeq ($(ARCHDIR),)
+ ARCHDIR := x86
+endif
+ifneq ($(ARCH),host)
+include $(ACESSDIR)/Makefile.$(ARCHDIR).cfg
+endif
+
+# Makefile.user.cfg is not part of the Acess git repo,
+# It is for overriding the options in this file
+-include $(ACESSDIR)/Makefile.user.cfg
+
+FILESYSTEMS :=
+DRIVERS :=
+MODULES :=
+MODULES += Filesystems/Ext2
+MODULES += Filesystems/FAT
+MODULES += Filesystems/NTFS
+
+ifeq ($(ARCHDIR),x86)
+MODULES += Storage/ATA Storage/FDD
+MODULES += Network/NE2000 Network/RTL8139
+MODULES += Display/VESA
+MODULES += Display/BochsGA
+MODULES += Interfaces/UDI
+MODULES += Input/PS2KbMouse
+MODULES += x86/ISADMA x86/VGAText
+endif
+
+ifeq ($(ARCHDIR),x86_64)
+MODULES += Storage/ATA Storage/FDD
+MODULES += Network/NE2000 Network/RTL8139
+MODULES += Display/BochsGA
+MODULES += Interfaces/UDI
+MODULES += Input/PS2KbMouse
+MODULES += x86/ISADMA x86/VGAText
+endif
+
+MODULES += IPStack # So the other modules are loaded before it
+DYNMODS := USB/Core
+#DYNMODS += Filesystems/InitRD