aboutsummaryrefslogtreecommitdiff
path: root/makefiles
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-03-20 23:55:30 -0700
committerpx4dev <px4@purgatory.org>2013-03-20 23:55:30 -0700
commita457a452393308047e9b958906048049ac798081 (patch)
tree541539ab0505157ca7a615fd8ed7036f553b3086 /makefiles
parent08bed2c31fe60333ecb289f525072cf912e942d0 (diff)
downloadpx4-firmware-a457a452393308047e9b958906048049ac798081.tar.gz
px4-firmware-a457a452393308047e9b958906048049ac798081.tar.bz2
px4-firmware-a457a452393308047e9b958906048049ac798081.zip
Pass the module name in to the module makefile.
Refer to the module command name with MODULE_COMMAND to avoid confusion with the module's actual name.
Diffstat (limited to 'makefiles')
-rw-r--r--makefiles/firmware.mk1
-rw-r--r--makefiles/module.mk27
2 files changed, 18 insertions, 10 deletions
diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk
index 9128da8c5..dad57d531 100644
--- a/makefiles/firmware.mk
+++ b/makefiles/firmware.mk
@@ -218,6 +218,7 @@ $(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER)
MODULE_WORK_DIR=$(dir $@) \
MODULE_OBJ=$@ \
MODULE_MK=$(mkfile) \
+ MODULE_NAME=$(lastword $(subst /, ,$(@D))) \
module
# make a list of phony clean targets for modules
diff --git a/makefiles/module.mk b/makefiles/module.mk
index 4f7b8def4..8b01d0a12 100644
--- a/makefiles/module.mk
+++ b/makefiles/module.mk
@@ -45,20 +45,22 @@
#
#
# SRCS (required)
+#
# Lists the .c, cpp and .S files that should be compiled/assembled to
# produce the module.
#
-# MODULE_NAME (optional)
-# MODULE_ENTRYPOINT (optional if MODULE_NAME is set)
-# MODULE_STACKSIZE (optional if MODULE_NAME is set)
-# MODULE_PRIORITY (optional if MODULE_NAME is set)
+# MODULE_COMMAND (optional)
+# MODULE_ENTRYPOINT (optional if MODULE_COMMAND is set)
+# MODULE_STACKSIZE (optional if MODULE_COMMAND is set)
+# MODULE_PRIORITY (optional if MODULE_COMMAND is set)
+#
# Defines a single builtin command exported by the module.
-# MODULE_NAME must be unique for any configuration, but need not be the
+# MODULE_COMMAND must be unique for any configuration, but need not be the
# same as the module directory name.
#
# If MODULE_ENTRYPOINT is set, it names the function (which must be exported)
# that will be the entrypoint for the builtin command. It defaults to
-# $(MODULE_NAME)_main.
+# $(MODULE_COMMAND)_main.
#
# If MODULE_STACKSIZE is set, it is the size in bytes of the stack to be
# allocated for the builtin command. If it is not set, it defaults
@@ -67,11 +69,13 @@
# If MODULE_PRIORITY is set, it is the thread priority for the builtin
# command. If it is not set, it defaults to SCHED_PRIORITY_DEFAULT.
#
-# MODULE_COMMANDS (optional)
+# MODULE_COMMANDS (optional if MODULE_COMMAND is not set)
+#
# Defines builtin commands exported by the module. Each word in
# the list should be formatted as:
# <command>.<priority>.<stacksize>.<entrypoint>
#
+#
#
# Variables visible to the module's module.mk:
@@ -79,6 +83,8 @@
# CONFIG
# BOARD
# MODULE_WORK_DIR
+# MODULE_OBJ
+# MODULE_MK
# Anything set in setup.mk, board_$(BOARD).mk and the toolchain file.
# Anything exported from config_$(CONFIG).mk
#
@@ -107,6 +113,7 @@ include $(PX4_MK_DIR)/board_$(BOARD).mk
#
include $(MODULE_MK)
MODULE_SRC := $(dir $(MODULE_MK))
+$(info % MODULE_NAME = $(MODULE_NAME))
$(info % MODULE_SRC = $(MODULE_SRC))
$(info % MODULE_OBJ = $(MODULE_OBJ))
$(info % MODULE_WORK_DIR = $(MODULE_WORK_DIR))
@@ -120,11 +127,11 @@ GLOBAL_DEPS += $(MAKEFILE_LIST)
# Builtin command definitions
################################################################################
-ifneq ($(MODULE_NAME),)
-MODULE_ENTRYPOINT ?= $(MODULE_NAME)_main
+ifneq ($(MODULE_COMMAND),)
+MODULE_ENTRYPOINT ?= $(MODULE_COMMAND)_main
MODULE_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT
MODULE_PRIORITY ?= SCHED_PRIORITY_DEFAULT
-MODULE_COMMANDS += $(MODULE_NAME).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT)
+MODULE_COMMANDS += $(MODULE_COMMAND).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT)
endif
ifneq ($(MODULE_COMMANDS),)