diff --git a/Makefile b/Makefile
index 9fcb92427b6a31f7e95467cdf767cca4346ce198..261308f28c12f1d3b48aee732c7217c372345426 100644
--- a/Makefile
+++ b/Makefile
@@ -35,8 +35,8 @@ TOKHELPSRC      = ${TOKENSOURCE}
 HELPSRC         = HelpStrs
 OBJS            = GetAll
 KERNEL_MODULE   = bin${SEP}${COMPONENT}
-ASFLAGS        += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}" -PD "USE_SYNCLIB SETL {${USE_SYNCLIB}}"
-CFLAGS         += -ff -APCS 3/32bit/nofp/noswst -DKERNEL
+ASFLAGS        += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}" -PD "USE_SYNCLIB SETL {${USE_SYNCLIB}}" -PD "RISCOS_KERNEL SETL {TRUE}"
+CFLAGS         += -ff -APCS 3/32bit/nofp/noswst -DRISCOS_KERNEL
 CUSTOMROM       = custom
 CUSTOMEXP       = custom
 CUSTOMSA        = custom
diff --git a/aborttrap/c/aborttrap b/aborttrap/c/aborttrap
index 233419cf10fb3c316db63bb2ac1ccaaeb2a59e8d..4cc4cc94e0ec64dd89ba8f74f6eee1a20ca89fb2 100644
--- a/aborttrap/c/aborttrap
+++ b/aborttrap/c/aborttrap
@@ -52,7 +52,7 @@
 edfsr_type dfsr_type;
 bool loadwritepc_interworking;
 
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 #include "swis.h"
 
 uint32_t g_ProcessorFlags;
@@ -88,7 +88,7 @@ static inline bool get_loadwritepc_interworking(void)
 void aborttrap_init(void)
 {
 	dfsr_type = get_dfsr_type();
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 	_swix(OS_PlatformFeatures,_IN(0)|_OUT(0),OSPlatformFeatures_ReadCodeFeatures,&g_ProcessorFlags);
 #endif
 	loadwritepc_interworking = get_loadwritepc_interworking();
diff --git a/aborttrap/c/atmem b/aborttrap/c/atmem
index f50b54d57b7cfb5d17d0666262c534122f0df814..5549704c9f4b1159d49a13485371a4c5db047d42 100644
--- a/aborttrap/c/atmem
+++ b/aborttrap/c/atmem
@@ -32,7 +32,7 @@
 #endif
 
 #include "kernel.h"
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 #include "swis.h"
 #endif
 
@@ -151,7 +151,7 @@ static inline _kernel_oserror *mem_access_via_aborttrap(int flags,uint8_t *buf,u
 
 static inline _kernel_oserror *mem_access_internal(uint8_t *buf,uint32_t addr,int len,int flags)
 {
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 	int mem24_flags=0;
 	if ((flags & AbortTrap_Reason_Mask) == AbortTrap_Reason_MemMap)
 	{
@@ -195,7 +195,7 @@ static inline _kernel_oserror *mem_access_internal(uint8_t *buf,uint32_t addr,in
 #endif
 	while (len > 0)
 	{
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 		if(addr < 512<<20)
 		{
 			/* Application space, skip to avoid fighting against lazy task swapping */
@@ -211,7 +211,7 @@ static inline _kernel_oserror *mem_access_internal(uint8_t *buf,uint32_t addr,in
 		bool have_permission;
 		_kernel_oserror *e;
 		int flags2 = flags;
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 		uint32_t access;
 		e = _swix(OS_Memory,_INR(0,2)|_OUT(1),OSMemReason_CheckMemoryAccess,addr,addr+chunk,&access);
 		if (e)