diff --git a/scripts/xbuild/build.mk b/scripts/xbuild/build.mk
index 7521a0a6023cff3f9283fb15622e6660dfa7636c..6dd49dac521655c8df81bcbb2815f147308d46d4 100644
--- a/scripts/xbuild/build.mk
+++ b/scripts/xbuild/build.mk
@@ -26,6 +26,8 @@ else
SRC := *.S *.c *.asm
endif # ifneq ($(wildcard $(srctree)/$(src)/Makefile),)
+SRC += $(src-y)
+
ifeq ($(ISMODULE),0)
X_BUILTIN := $(obj)/built-in.o
endif
diff --git a/src/drivers/Makefile b/src/drivers/Makefile
index 7ddb67bf31ec8c43a7ce13b97f5fd7bf6de1b74b..48d20d599445c1bebe76b0c3af668c32e5d57df9 100644
--- a/src/drivers/Makefile
+++ b/src/drivers/Makefile
@@ -1,13 +1,13 @@
-SRC += null/
-SRC += zero/
-SRC += dummy/
-SRC += console/
-SRC += block/
-SRC += meminfo/
-SRC += cpuinfo/
-SRC += udriver/
-SRC += pmem/
-SRC += vmem/
-SRC += cpustat/
-SRC += dtree/
-SRC += virtio/
+src-$(CONFIG_NX_DRIVER_NULL) += null/
+src-$(CONFIG_NX_DRIVER_ZERO) += zero/
+src-$(CONFIG_NX_DRIVER_DUMMY) += dummy/
+src-y += console/
+src-$(CONFIG_NX_DRIVER_ROMDISK) += block/
+src-$(CONFIG_NX_DRIVER_MEMINFO) += meminfo/
+src-$(CONFIG_NX_DRIVER_CPUINFO) += cpuinfo/
+src-y += udriver/
+src-$(CONFIG_NX_DRIVER_PMEM) += pmem/
+src-$(CONFIG_NX_DRIVER_VMEM) += vmem/
+src-y += cpustat/
+src-$(CONFIG_NX_DRIVER_DTREE) += dtree/
+src-y += virtio/
diff --git a/src/drivers/block/romdisk.c b/src/drivers/block/romdisk.c
index 55736f662a9e007abbdd652b5f390490e5a7d05b..549a0f134864d390895d62fe48345d7b16492715 100644
--- a/src/drivers/block/romdisk.c
+++ b/src/drivers/block/romdisk.c
@@ -13,8 +13,6 @@
#include
#include
-#ifdef CONFIG_NX_DRIVER_ROMDISK
-
#define NX_LOG_NAME "romdisk driver"
#include
@@ -99,5 +97,3 @@ NX_PRIVATE void RomdiskDriverExit(void)
NX_DRV_INIT(RomdiskDriverInit);
NX_DRV_EXIT(RomdiskDriverExit);
-
-#endif
diff --git a/src/drivers/cpuinfo/cpuinfo.c b/src/drivers/cpuinfo/cpuinfo.c
index 62825cb71c75d74dac76b574125c5bb72d62d76c..a8be4dbec83151333242bfe5bc910e011b7427b1 100644
--- a/src/drivers/cpuinfo/cpuinfo.c
+++ b/src/drivers/cpuinfo/cpuinfo.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_DRIVER_CPUINFO
-
#define NX_LOG_NAME "cpu info driver"
#include
#include
@@ -89,5 +87,3 @@ NX_PRIVATE void CpuInfoDriverExit(void)
NX_DRV_INIT(CpuInfoDriverInit);
NX_DRV_EXIT(CpuInfoDriverExit);
-
-#endif
diff --git a/src/drivers/dtree/drv-dtree.c b/src/drivers/dtree/drv-dtree.c
index 1d9bd8e7eacea8d99c05a49f9ab6a14e3735b9da..556a508eed2c4f6836701c1adbb4d7de408880bf 100644
--- a/src/drivers/dtree/drv-dtree.c
+++ b/src/drivers/dtree/drv-dtree.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_DRIVER_DTREE
-
#define NX_LOG_NAME "tree"
#include
#include
@@ -139,5 +137,3 @@ NX_PRIVATE void TreeDriverExit(void)
NX_DRV_INIT(TreeDriverInit);
NX_DRV_EXIT(TreeDriverExit);
-
-#endif
diff --git a/src/drivers/dummy/dummy.c b/src/drivers/dummy/dummy.c
index bd47ed09e18015af059299c3122c187fe809417f..970fb56876189e4bd644c24e0a69ae207198fd09 100644
--- a/src/drivers/dummy/dummy.c
+++ b/src/drivers/dummy/dummy.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_DRIVER_DUMMY
-
#define NX_LOG_NAME "dummy driver"
#include
@@ -105,5 +103,3 @@ NX_PRIVATE void DummyDriverExit(void)
NX_DRV_INIT(DummyDriverInit);
NX_DRV_EXIT(DummyDriverExit);
-
-#endif
diff --git a/src/drivers/meminfo/meminfo.c b/src/drivers/meminfo/meminfo.c
index 5de55bea4788f8933697a509b5ef89d79c43b295..3974ca9f36be9a7140e6b8b3549f7a5458834feb 100644
--- a/src/drivers/meminfo/meminfo.c
+++ b/src/drivers/meminfo/meminfo.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_DRIVER_MEMINFO
-
#define NX_LOG_NAME "mem info driver"
#include
#include
@@ -92,5 +90,3 @@ NX_PRIVATE void MemInfoDriverExit(void)
NX_DRV_INIT(MemInfoDriverInit);
NX_DRV_EXIT(MemInfoDriverExit);
-
-#endif
diff --git a/src/drivers/null/null.c b/src/drivers/null/null.c
index d34b0bcbd6ee74c7d53dfb0fb7c3da2fe98517f3..92669617f26489f6064cfe77a39f1490e0d254c0 100644
--- a/src/drivers/null/null.c
+++ b/src/drivers/null/null.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_DRIVER_NULL
-
#define NX_LOG_NAME "null driver"
#include
@@ -69,5 +67,3 @@ NX_PRIVATE void NullDriverExit(void)
NX_DRV_INIT(NullDriverInit);
NX_DRV_EXIT(NullDriverExit);
-
-#endif
diff --git a/src/drivers/pmem/pmem.c b/src/drivers/pmem/pmem.c
index a09d9a3e48b5acebd2fc89966feecc9b256bc5a0..f1d186d5e3dff88c78bccac3ac12eb29e2ef619b 100644
--- a/src/drivers/pmem/pmem.c
+++ b/src/drivers/pmem/pmem.c
@@ -10,9 +10,6 @@
*/
#include
-
-#ifdef CONFIG_NX_DRIVER_PMEM
-
#include
#include
#include
@@ -162,5 +159,3 @@ NX_PRIVATE void PmemDriverExit(void)
NX_DRV_INIT(PmemDriverInit);
NX_DRV_EXIT(PmemDriverExit);
-
-#endif
diff --git a/src/drivers/vmem/vmem.c b/src/drivers/vmem/vmem.c
index 5aa261adea3c4f18f9f192f9a2fad5b140fcf702..44d8b4376308faa97db1c1835b9110b5dce2408a 100644
--- a/src/drivers/vmem/vmem.c
+++ b/src/drivers/vmem/vmem.c
@@ -10,9 +10,6 @@
*/
#include
-
-#ifdef CONFIG_NX_DRIVER_VMEM
-
#include
#include
#include
@@ -106,5 +103,3 @@ NX_PRIVATE void VmemDriverExit(void)
NX_DRV_INIT(VmemDriverInit);
NX_DRV_EXIT(VmemDriverExit);
-
-#endif
diff --git a/src/drivers/zero/zero.c b/src/drivers/zero/zero.c
index d6e7f741eb892aeb83b3d736969fc898beeca35a..371403c442ec71856b9ac70ef1e0329b24c0c879 100644
--- a/src/drivers/zero/zero.c
+++ b/src/drivers/zero/zero.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_DRIVER_ZERO
-
#define NX_LOG_NAME "zero driver"
#include
#include
@@ -71,5 +69,3 @@ NX_PRIVATE void ZeroDriverExit(void)
NX_DRV_INIT(ZeroDriverInit);
NX_DRV_EXIT(ZeroDriverExit);
-
-#endif
diff --git a/src/fs/Makefile b/src/fs/Makefile
index 3b61bc16477e2a692af8ca0fddc9c84119c3003f..682212468337938dade24cfc031567f0c4dd1930 100644
--- a/src/fs/Makefile
+++ b/src/fs/Makefile
@@ -1,4 +1,4 @@
-SRC += *.c
-SRC += cpio/
-SRC += devfs/
-SRC += fat/
+src-y += fs.c
+src-$(CONFIG_NX_FS_CPIO) += cpio/
+src-$(CONFIG_NX_FS_DEVFS) += devfs/
+src-$(CONFIG_NX_FS_FATFS) += fat/
diff --git a/src/fs/cpio/Makefile b/src/fs/cpio/Makefile
index 7858e6537c6cb1881f59e2bec469c0d176aecb24..33e5510ee4106c15dade0f3f8592fadc1558e882 100644
--- a/src/fs/cpio/Makefile
+++ b/src/fs/cpio/Makefile
@@ -1 +1 @@
-SRC += *.c
+src-y += cpio.c
diff --git a/src/fs/cpio/cpio.c b/src/fs/cpio/cpio.c
index dd1c979061e08edb6dbb467f9c4eca8398dc404a..2ad983ee37e37b18d593fb2b87ae43c9184a6872 100644
--- a/src/fs/cpio/cpio.c
+++ b/src/fs/cpio/cpio.c
@@ -16,8 +16,6 @@
#include
-#ifdef CONFIG_NX_FS_CPIO
-
#include
#include
#include
@@ -476,5 +474,3 @@ NX_PRIVATE void NX_FileSystemCpioExit(void)
NX_FS_INIT(NX_FileSystemCpioInit);
NX_FS_EXIT(NX_FileSystemCpioExit);
-
-#endif
diff --git a/src/fs/devfs/Makefile b/src/fs/devfs/Makefile
index 7858e6537c6cb1881f59e2bec469c0d176aecb24..34a928e69f655816adbb51a5f45429be90c2a358 100644
--- a/src/fs/devfs/Makefile
+++ b/src/fs/devfs/Makefile
@@ -1 +1 @@
-SRC += *.c
+src-y += devfs.c
diff --git a/src/fs/devfs/devfs.c b/src/fs/devfs/devfs.c
index 38125cff06f861246c181233b5f77e8181e8de5f..d2ae3ebaf5d924ef8f6a67ae0ac26634de35a789 100644
--- a/src/fs/devfs/devfs.c
+++ b/src/fs/devfs/devfs.c
@@ -11,7 +11,6 @@
#include
-#ifdef CONFIG_NX_FS_DEVFS
#include
#include
#define NX_LOG_NAME "devfs"
@@ -223,5 +222,3 @@ NX_PRIVATE void NX_FileSystemDevExit(void)
NX_FS_INIT(NX_FileSystemDevInit);
NX_FS_EXIT(NX_FileSystemDevExit);
-
-#endif /* CONFIG_NX_FS_DEVFS */
diff --git a/src/fs/fat/Makefile b/src/fs/fat/Makefile
index 7858e6537c6cb1881f59e2bec469c0d176aecb24..ac25864012650d13be448e5ca5ef1ce447e43f01 100644
--- a/src/fs/fat/Makefile
+++ b/src/fs/fat/Makefile
@@ -1 +1 @@
-SRC += *.c
+src-y += fat.c fat-node.c fat-control.c
diff --git a/src/test/Makefile b/src/test/Makefile
index f36d4044ee12b78710e52454e7126623d1d0e575..d589ba7afd8aad936d8f56da06a45f29adbbc303 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,5 +1,4 @@
-SRC += *.c
-ifeq ($(TC),y)
-SRC += utests/
-SRC += integrations/
-endif
\ No newline at end of file
+src-$(CONFIG_NX_ENABLE_TEST_INTEGRATION) += integration.c
+src-$(CONFIG_NX_ENABLE_TEST_UTEST) += utest.c
+src-$(TC) += utests/
+src-$(TC) += integrations/
\ No newline at end of file
diff --git a/src/test/integration.c b/src/test/integration.c
index 00fc165d8a91237732e74e73fa62a0d5d9eb8897..cf58a4f29544a5bd91ef0b4ec9a9be949d42f352 100644
--- a/src/test/integration.c
+++ b/src/test/integration.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_ENABLE_TEST_INTEGRATION
-
#include
#include
#include
@@ -70,5 +68,3 @@ NX_PRIVATE void IntegrationInit(void)
}
NX_INIT_TEST(IntegrationInit);
-
-#endif
diff --git a/src/test/integrations/ipc/Makefile b/src/test/integrations/ipc/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..c2948f47ab4e5cd702a03fb73406eae5cd2053d8 100644
--- a/src/test/integrations/ipc/Makefile
+++ b/src/test/integrations/ipc/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_TEST_INTEGRATION_MSG_QUEUE) += msgqueue.c
diff --git a/src/test/integrations/ipc/msgqueue.c b/src/test/integrations/ipc/msgqueue.c
index 122b52eb747666d1f297fd1cbcd7144c323f1929..3d1ebba997feb83c125d502e9dfe26f209885abf 100644
--- a/src/test/integrations/ipc/msgqueue.c
+++ b/src/test/integrations/ipc/msgqueue.c
@@ -17,8 +17,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_MSG_QUEUE
-
NX_PRIVATE NX_MsgQueue *mq0 = NX_NULL;
NX_PRIVATE void Thread1(void *arg)
@@ -127,5 +125,3 @@ NX_INTEGRATION_TEST(NX_MsgQueue)
NX_ThreadWait(t1, NX_NULL);
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/mm/Makefile b/src/test/integrations/mm/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..a411d09e9c77686e511bc9cc5c800c8fb5d739e1 100644
--- a/src/test/integrations/mm/Makefile
+++ b/src/test/integrations/mm/Makefile
@@ -1 +1,3 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_TEST_INTEGRATION_HEAP_CACHE) += heap_cache.c
+src-$(CONFIG_NX_TEST_INTEGRATION_PAGE) += page.c
+src-$(CONFIG_NX_TEST_INTEGRATION_PAGE_CACHE) += page_cache.c
diff --git a/src/test/integrations/mm/heap_cache.c b/src/test/integrations/mm/heap_cache.c
index e39c769487719e04c8b74cb85a1d3e8410cb52c1..2ded213cf0610cc8d497d222d0b5a3732792d82b 100644
--- a/src/test/integrations/mm/heap_cache.c
+++ b/src/test/integrations/mm/heap_cache.c
@@ -14,8 +14,6 @@
#define NX_LOG_NAME "TestHeapCache"
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_HEAP_CACHE
-
NX_PRIVATE void LargeObjectTest(void)
{
/* large object */
@@ -189,5 +187,3 @@ NX_INTEGRATION_TEST(NX_HeapCache)
SmallObjectTest();
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/mm/page.c b/src/test/integrations/mm/page.c
index a85f566cd9102fa94ba14e067bc8e80118d94b14..a6727620c9c8a4433714b1e5f500db0b921bce15 100644
--- a/src/test/integrations/mm/page.c
+++ b/src/test/integrations/mm/page.c
@@ -15,8 +15,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_PAGE
-
NX_INTEGRATION_TEST(NX_PageAlloc)
{
/* alloc memory */
@@ -88,5 +86,3 @@ NX_INTEGRATION_TEST(NX_PageAlloc)
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/mm/page_cache.c b/src/test/integrations/mm/page_cache.c
index 41af030b84dc8144c477b0d534c5bae30f78dd4d..4a14225ef5c174278fa260aed3b24258f7cfa4f4 100644
--- a/src/test/integrations/mm/page_cache.c
+++ b/src/test/integrations/mm/page_cache.c
@@ -17,8 +17,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_PAGE_CACHE
-
NX_PRIVATE void NX_PageCacheLarge(void)
{
void *span = NX_PageCacheAlloc(128);
@@ -196,5 +194,3 @@ NX_INTEGRATION_TEST(NX_PageCacheTest)
NX_PageCacheOnePage();
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/sched/Makefile b/src/test/integrations/sched/Makefile
index 7858e6537c6cb1881f59e2bec469c0d176aecb24..686bc2eee047fa7adb49e289348bab482234caf3 100644
--- a/src/test/integrations/sched/Makefile
+++ b/src/test/integrations/sched/Makefile
@@ -1 +1,5 @@
-SRC += *.c
+src-$(CONFIG_NX_TEST_INTEGRATION_CONDITION) += condition.c
+src-$(CONFIG_NX_TEST_INTEGRATION_MUTEX) += mutex.c
+src-$(CONFIG_NX_TEST_INTEGRATION_SEMAPHORE) += semaphore.c
+src-$(CONFIG_NX_TEST_INTEGRATION_THREAD) += thread.c
+src-$(CONFIG_NX_TEST_INTEGRATION_THREAD_ID) += thread_id.c
diff --git a/src/test/integrations/sched/condition.c b/src/test/integrations/sched/condition.c
index 698bd08a156668c5f529dc48ac5af8ab8a5717fe..5bcc7667af2a80d08d324936ef9501cc52769928 100644
--- a/src/test/integrations/sched/condition.c
+++ b/src/test/integrations/sched/condition.c
@@ -14,8 +14,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_CONDITION
-
#define PRODUCT_NR 5
#define WAIT_TIMES 15
NX_PRIVATE int productNumber;
@@ -139,5 +137,3 @@ NX_INTEGRATION_TEST(NX_ConditionTest)
ProducerConsumerTest2();
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/sched/mutex.c b/src/test/integrations/sched/mutex.c
index 7b7a2342968153175acb1ad7d1b1dd9e1b40c1a7..0a645bb859792dd41fdbae00f8fdd6b3b8482f44 100644
--- a/src/test/integrations/sched/mutex.c
+++ b/src/test/integrations/sched/mutex.c
@@ -18,8 +18,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_MUTEX
-
#define MUTEX_THREAD_NR 10
NX_PRIVATE NX_Mutex mutex;
@@ -174,5 +172,3 @@ NX_INTEGRATION_TEST(NX_Mutex)
#endif
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/sched/semaphore.c b/src/test/integrations/sched/semaphore.c
index 7e34ec70685b4466af9aa9e490e2bcfdfa54ee8f..c76cc6fdc49e4fe0136b0686645d4bb56a128106 100644
--- a/src/test/integrations/sched/semaphore.c
+++ b/src/test/integrations/sched/semaphore.c
@@ -16,8 +16,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_SEMAPHORE
-
/* Producer And Consumer test */
#define PC_TEST_TIME 10 /* 10 s */
@@ -181,5 +179,3 @@ NX_INTEGRATION_TEST(NX_Semaphore)
ProducerAndConsumer();
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/sched/thread.c b/src/test/integrations/sched/thread.c
index de50eb7cab29dcc1ae8b695175bab8524b3831ae..278134bd1a42f3ec7ef5546318aef6f970903c0c 100644
--- a/src/test/integrations/sched/thread.c
+++ b/src/test/integrations/sched/thread.c
@@ -16,8 +16,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_THREAD
-
NX_PRIVATE NX_VOLATILE int threadTick = 0;
NX_PRIVATE void TestThread1(void *arg)
@@ -171,5 +169,3 @@ NX_INTEGRATION_TEST(TestThread)
NX_LOG_D("thread test done.");
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/sched/thread_id.c b/src/test/integrations/sched/thread_id.c
index 602cc0908dcd6df3549261292e859aa53be58c58..331facfa0f0fc2fa094977ef531df7e6d16ce262 100644
--- a/src/test/integrations/sched/thread_id.c
+++ b/src/test/integrations/sched/thread_id.c
@@ -13,8 +13,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_THREAD_ID
-
NX_INTEGRATION_TEST(TestThreadID)
{
int i;
@@ -33,5 +31,3 @@ NX_INTEGRATION_TEST(TestThreadID)
}
return NX_EOK;
}
-
-#endif
diff --git a/src/test/integrations/time/Makefile b/src/test/integrations/time/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..d7eabf79ea80b9dcb52aa1ab3690992ba8b5988f 100644
--- a/src/test/integrations/time/Makefile
+++ b/src/test/integrations/time/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_TEST_INTEGRATION_TIMER) += timer.c
diff --git a/src/test/integrations/time/timer.c b/src/test/integrations/time/timer.c
index 637c8618ed00d688cb239b45487017e2424eae7a..3ab8adf918118501d486af14c3593fe00abf96ba 100644
--- a/src/test/integrations/time/timer.c
+++ b/src/test/integrations/time/timer.c
@@ -15,8 +15,6 @@
#include
#include
-#ifdef CONFIG_NX_TEST_INTEGRATION_TIMER
-
NX_PRIVATE NX_Bool NX_TimerHandler1(NX_Timer *timer, void *arg)
{
NX_LOG_I("Timer#%s timeout\n", (char *)arg);
@@ -90,5 +88,3 @@ NX_INTEGRATION_TEST(NX_Timer)
NX_LOG_I("timerCounter:%d", timerCounter);
return NX_EOK;
}
-
-#endif
diff --git a/src/test/utest.c b/src/test/utest.c
index 7d8eb5f5fc2c9b07b045f3603837257f0a566779..d117f859a4170cf291c18106775f9dafd15d8389 100644
--- a/src/test/utest.c
+++ b/src/test/utest.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_ENABLE_TEST_UTEST
-
#include
#include
#include
@@ -235,5 +233,3 @@ NX_PRIVATE void NX_UTestInit(void)
}
NX_INIT_TEST(NX_UTestInit);
-
-#endif
diff --git a/src/test/utests/io/Makefile b/src/test/utests/io/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..40d9442f05977c94b64a69d43a961b517a62dfac 100644
--- a/src/test/utests/io/Makefile
+++ b/src/test/utests/io/Makefile
@@ -1 +1,2 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_IO_DRIVER) += driver.c
+src-$(CONFIG_NX_UTEST_IO_QUEUE) += ioqueue.c
diff --git a/src/test/utests/io/driver.c b/src/test/utests/io/driver.c
index e613ab00876eb487b7ae89f58c4e2e11a03d550f..40467335e45c5a0d27bb89e1c5b0848125731e63 100644
--- a/src/test/utests/io/driver.c
+++ b/src/test/utests/io/driver.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_IO_DRIVER
-
#define DRV_NAME "utest_driver"
#define DRV_NAME2 "utest_driver2"
@@ -526,5 +524,3 @@ NX_TEST_CASE_CLEAN(NX_Driver)
}
NX_TEST_CASE(NX_Driver);
-
-#endif
diff --git a/src/test/utests/io/ioqueue.c b/src/test/utests/io/ioqueue.c
index 2eff9212456277bed99aea15548c1b0b430ae0de..0e57d21839baefd76682f33c2fb5b72d30f7be3c 100644
--- a/src/test/utests/io/ioqueue.c
+++ b/src/test/utests/io/ioqueue.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_IO_QUEUE
-
NX_TEST(NX_IoQueueCreate)
{
NX_Error err;
@@ -134,5 +132,3 @@ NX_TEST_TABLE(NX_IoQueue)
};
NX_TEST_CASE(NX_IoQueue);
-
-#endif
diff --git a/src/test/utests/ipc/Makefile b/src/test/utests/ipc/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..d72338918e0a07c2180a6cd438f9157baa67bcce 100644
--- a/src/test/utests/ipc/Makefile
+++ b/src/test/utests/ipc/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_MSG_QUEUE) += msgqueue.c
diff --git a/src/test/utests/ipc/msgqueue.c b/src/test/utests/ipc/msgqueue.c
index eebc6dc9f5ee4ed6bebdcb185d00fc5fc8ac6db0..26405dc083ea056f5c8457a39ab20460b941c391 100644
--- a/src/test/utests/ipc/msgqueue.c
+++ b/src/test/utests/ipc/msgqueue.c
@@ -14,8 +14,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_MSG_QUEUE
-
NX_TEST(NX_MsgQueueCreate)
{
NX_MsgQueue *mq;
@@ -239,5 +237,3 @@ NX_TEST_TABLE(NX_MsgQueue)
};
NX_TEST_CASE(NX_MsgQueue);
-
-#endif
diff --git a/src/test/utests/mm/Makefile b/src/test/utests/mm/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..0c83b6b0aa04f6d01801222a1cd00525cf6a47cd 100644
--- a/src/test/utests/mm/Makefile
+++ b/src/test/utests/mm/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_HEAP_CACHE) += heap_cache.c
diff --git a/src/test/utests/mm/heap_cache.c b/src/test/utests/mm/heap_cache.c
index 6313cb8e6f5fb790b6b23819b1ad316e17607249..d7cb9f99bbe66981fee635f70a236d7f7d205b1a 100644
--- a/src/test/utests/mm/heap_cache.c
+++ b/src/test/utests/mm/heap_cache.c
@@ -13,8 +13,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_HEAP_CACHE
-
NX_TEST(HeapAllocAndFree)
{
NX_ASSERT_NULL(NX_HeapAlloc(0));
@@ -52,5 +50,3 @@ NX_TEST_TABLE(NX_HeapCache)
};
NX_TEST_CASE(NX_HeapCache);
-
-#endif
diff --git a/src/test/utests/sched/Makefile b/src/test/utests/sched/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..b382040ddadffee86fd7c0ab1d339d0285c08af7 100644
--- a/src/test/utests/sched/Makefile
+++ b/src/test/utests/sched/Makefile
@@ -1 +1,5 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_SCHED_CONDITION) += condition.c
+src-$(CONFIG_NX_UTEST_SCHED_MUTEX) += mutex.c
+src-$(CONFIG_NX_UTEST_SCHED_SEMAPHORE) += semaphore.c
+src-$(CONFIG_NX_UTEST_SCHED_SPIN) += spin.c
+src-$(CONFIG_NX_UTEST_SCHED_THREAD) += thread.c
diff --git a/src/test/utests/sched/condition.c b/src/test/utests/sched/condition.c
index 9ba3398fb47ba04af8f92f395bd851f8c753a6e9..c58bc8846386cc5719b5a3d4a2affebaf2d35fe0 100644
--- a/src/test/utests/sched/condition.c
+++ b/src/test/utests/sched/condition.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_SCHED_CONDITION
-
NX_TEST(NX_ConditionInit)
{
NX_Condition cond;
@@ -77,5 +75,3 @@ NX_TEST_TABLE(NX_Condition)
};
NX_TEST_CASE(NX_Condition);
-
-#endif
diff --git a/src/test/utests/sched/mutex.c b/src/test/utests/sched/mutex.c
index c8fe892ffc1dfdb5706adc40bebb7ad7ef06002d..f212158e9dcfb3245ddda556e00e1bc1aeba2067 100644
--- a/src/test/utests/sched/mutex.c
+++ b/src/test/utests/sched/mutex.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_SCHED_MUTEX
-
NX_TEST(NX_MutexInit)
{
NX_Mutex lock;
@@ -73,5 +71,3 @@ NX_TEST_TABLE(NX_Mutex)
};
NX_TEST_CASE(NX_Mutex);
-
-#endif
diff --git a/src/test/utests/sched/process.c b/src/test/utests/sched/process.c
index f14ee67507a8cb68781fad6d9f631d8da239262e..2d50f7c1e4053c961a6e114e9deda7fd073af3af 100644
--- a/src/test/utests/sched/process.c
+++ b/src/test/utests/sched/process.c
@@ -13,8 +13,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_SCHED_PROCESS
-
NX_TEST(ProcessExecute)
{
NX_EXPECT_EQ(NX_ProcessLaunch("/test", NX_THREAD_CREATE_NORMAL, NX_NULL,
@@ -27,5 +25,3 @@ NX_TEST_TABLE(Process)
};
NX_TEST_CASE(Process);
-
-#endif
diff --git a/src/test/utests/sched/semaphore.c b/src/test/utests/sched/semaphore.c
index 172997fdbe0e982dedbe5c8e59bdeb437785cf42..7093d856969be93ed60eba164aadf020e7f68f06 100644
--- a/src/test/utests/sched/semaphore.c
+++ b/src/test/utests/sched/semaphore.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_SCHED_SEMAPHORE
-
NX_TEST(NX_SemaphoreInit)
{
NX_Semaphore sem;
@@ -65,5 +63,3 @@ NX_TEST_TABLE(NX_Semaphore)
};
NX_TEST_CASE(NX_Semaphore);
-
-#endif
diff --git a/src/test/utests/sched/spin.c b/src/test/utests/sched/spin.c
index 27ab2a3bc3ea1ba3f015edcd4a3a8ee65ff7731c..9608452139400cdfcb5502c12c62c89708459c9a 100644
--- a/src/test/utests/sched/spin.c
+++ b/src/test/utests/sched/spin.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_SCHED_SPIN
-
NX_TEST(NX_SpinInit)
{
NX_Spin lock;
@@ -73,5 +71,3 @@ NX_TEST_TABLE(NX_Spin)
};
NX_TEST_CASE(NX_Spin);
-
-#endif
diff --git a/src/test/utests/sched/thread.c b/src/test/utests/sched/thread.c
index efbb2ead15422c8bc116ddbd3e9bb7a34eb6cfd0..46e2a8097f7d93e7d9cca396ea453eacc2a61d13 100644
--- a/src/test/utests/sched/thread.c
+++ b/src/test/utests/sched/thread.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_SCHED_THREAD
-
NX_TEST(NX_ThreadSleep)
{
NX_TimeVal s, e;
@@ -72,5 +70,3 @@ NX_TEST_TABLE(NX_Thread)
};
NX_TEST_CASE(NX_Thread);
-
-#endif
diff --git a/src/test/utests/time/Makefile b/src/test/utests/time/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..4b60eac927ec1914e6b40c6e9caa5dd282bdcb46 100644
--- a/src/test/utests/time/Makefile
+++ b/src/test/utests/time/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_MODS_TIMER) += timer.c
diff --git a/src/test/utests/time/timer.c b/src/test/utests/time/timer.c
index 8c37214f8e3d4ab39fed4e82fa197b751fc9390a..1d73fc71516077987ff8b3cf47f50f4bb38779b8 100644
--- a/src/test/utests/time/timer.c
+++ b/src/test/utests/time/timer.c
@@ -13,8 +13,6 @@
#include
-#ifdef CONFIG_NX_UTEST_MODS_TIMER
-
NX_PRIVATE int timerOneshotFlags = 0;
NX_PRIVATE NX_Bool NX_TimerHandler(NX_Timer *timer, void *arg)
@@ -125,5 +123,3 @@ NX_TEST_TABLE(NX_Timer)
};
NX_TEST_CASE(NX_Timer);
-
-#endif
diff --git a/src/test/utests/utest/Makefile b/src/test/utests/utest/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..fce4e92035abe3c954fcd774782c01e563905c40 100644
--- a/src/test/utests/utest/Makefile
+++ b/src/test/utests/utest/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_MODS_UTEST) += utest.c
diff --git a/src/test/utests/utest/utest.c b/src/test/utests/utest/utest.c
index 49a3096c5e695090e0e479238766d323d1261e31..9d3bd36445e8445f3f46cbf2bcf332fd0902e17f 100644
--- a/src/test/utests/utest/utest.c
+++ b/src/test/utests/utest/utest.c
@@ -11,8 +11,6 @@
#include
-#ifdef CONFIG_NX_UTEST_MODS_UTEST
-
NX_TEST(Test)
{
NX_ASSERT_TRUE(1);
@@ -101,5 +99,3 @@ NX_TEST_CASE_CLEAN(UTest)
}
NX_TEST_CASE(UTest);
-
-#endif
diff --git a/src/test/utests/utils/Makefile b/src/test/utests/utils/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..68d8b0bef6e310e2ac9c049f670b7bcc0f356efe 100644
--- a/src/test/utests/utils/Makefile
+++ b/src/test/utests/utils/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_UTILS_STRING) += string.c
diff --git a/src/test/utests/utils/string.c b/src/test/utests/utils/string.c
index fc5273fb800bc2e5fbd60a7c71b1f5643b74b5fd..f78cd4033ef76b9b0ded5755f7bb0bdcf64d2cb8 100644
--- a/src/test/utests/utils/string.c
+++ b/src/test/utests/utils/string.c
@@ -13,8 +13,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_UTILS_STRING
-
NX_TEST(NX_StrCmp)
{
const char *str = "abc";
@@ -49,5 +47,3 @@ NX_TEST_TABLE(String)
};
NX_TEST_CASE(String);
-
-#endif
diff --git a/src/test/utests/xbook/Makefile b/src/test/utests/xbook/Makefile
index 487d0cbafebfb4deb693f5d1195e5e24168fd0f5..b7889419890d73e98f85a8e2eb93e7ad81a3e62e 100644
--- a/src/test/utests/xbook/Makefile
+++ b/src/test/utests/xbook/Makefile
@@ -1 +1 @@
-SRC += *.c
\ No newline at end of file
+src-$(CONFIG_NX_UTEST_XBOOK_ATOMIC) += atomic.c
diff --git a/src/test/utests/xbook/atomic.c b/src/test/utests/xbook/atomic.c
index 3b19e43a6ba6798220ad13db67d471807372c65b..22c93a0712f320f8a4b28efdd47fc7af75a39a89 100644
--- a/src/test/utests/xbook/atomic.c
+++ b/src/test/utests/xbook/atomic.c
@@ -12,8 +12,6 @@
#include
#include
-#ifdef CONFIG_NX_UTEST_XBOOK_ATOMIC
-
NX_TEST(NX_AtomicSetAndGet)
{
NX_Atomic val;
@@ -141,5 +139,3 @@ NX_TEST_TABLE(NX_Atomic)
};
NX_TEST_CASE(NX_Atomic);
-
-#endif
diff --git a/src/utils/Makefile b/src/utils/Makefile
index 030603e653fac1350ad98585d5e74aba43602955..e7e10dbd6a524eaa7edd921081aa728064d8cc39 100644
--- a/src/utils/Makefile
+++ b/src/utils/Makefile
@@ -1 +1,3 @@
-SRC += *.c
+src-y += compatible.c ctype.c div.c fifo.c log.c memory.c sprintf.c string.c
+
+src-$(CONFIG_NX_DEVICE_TREE_SUPPORT) += json.c
diff --git a/src/utils/json.c b/src/utils/json.c
index 35a37e7c116b4faa75763b114b167925ed2befaa..7199e440e696fccc1cc8769c5774ce86fb5e9581 100644
--- a/src/utils/json.c
+++ b/src/utils/json.c
@@ -10,9 +10,6 @@
*/
#include
-
-#ifdef CONFIG_NX_DEVICE_TREE_SUPPORT
-
#include
#include
#include
@@ -885,4 +882,3 @@ void JSON_Free(struct JSON_Value * value)
NX_MemFree(v);
}
}
-#endif