Skip to content

Commit 732221c

Browse files
committed
Platform: allow no_platform
make target_platform=no make platform "optional" It allows to implement the platform part in a different repo, and just use the c-mesh-api generic part from this repo Note: linux is still the default target platform
1 parent d883bbe commit 732221c

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

lib/platform/linux/makefile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Sources for platform module
2+
PLATFORM_MODULE = $(SOURCEPREFIX)platform/linux
3+
4+
SOURCES += $(PLATFORM_MODULE)/platform.c
5+
SOURCES += $(PLATFORM_MODULE)/serial.c
6+
SOURCES += $(PLATFORM_MODULE)/serial_termios2.c
7+
SOURCES += $(PLATFORM_MODULE)/logger.c
8+
9+
# Add the reentrant flag as using pthread lib
10+
CFLAGS += -D_REENTRANT

lib/platform/makefile

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Sources for platform module
22
PLATFORM_MODULE = $(SOURCEPREFIX)platform/
33

4-
# For now, only support linux platform
5-
SOURCES += $(PLATFORM_MODULE)linux/platform.c
6-
SOURCES += $(PLATFORM_MODULE)linux/serial.c
7-
SOURCES += $(PLATFORM_MODULE)linux/serial_termios2.c
8-
SOURCES += $(PLATFORM_MODULE)linux/logger.c
4+
CFLAGS += -I$(PLATFORM_MODULE)
95

10-
# Add the reentrant flag as using pthread lib
11-
CFLAGS += -D_REENTRANT
6+
target_platform?=linux
127

13-
CFLAGS += -I$(PLATFORM_MODULE)
8+
ifeq ($(target_platform),no)
9+
$(warning No plaftform selected)
10+
else ifneq ($(target_platform),)
11+
# Include the target_platform part
12+
include $(PLATFORM_MODULE)$(target_platform)/makefile
13+
else
14+
$(warning No plaftform selected)
15+
endif

0 commit comments

Comments
 (0)