Commit 46fe17eb authored by Lucas Russo's avatar Lucas Russo

Makefile: add support for multiple apps compilation

With this we could build multiple apps
simultaneously, with a single make, like:

make APPS='"ebpm pbpm"' <other options> or
sudo ./compile.sh '"ebpm pbpm"' <other options>
parent f2a2793e
......@@ -14,7 +14,7 @@ MAKE ?= make
# Select board in which we will work. Options are: ml605 or afcv3
BOARD ?= ml605
# Select which application we want to generate. Options are: ebpm
APP ?= ebpm
APPS ?= ebpm
# Select if we want to have the AFCv3 DDR memory shrink to 2^28 or the full size 2^32. Options are: (y)es ot (n)o.
# This is a TEMPORARY fix until the AFCv3 FPGA firmware is fixed. If unsure, select (y)es.
SHRINK_AFCV3_DDR_SIZE ?= y
......@@ -187,6 +187,9 @@ OBJS_PLATFORM =
# Source directory
SRC_DIR = src
# Prepare "apps" include
APPS_MKS = $(foreach mk,$(APPS),$(SRC_DIR)/apps/$(mk)/$(mk).mk)
# Include other Makefiles as needed here
include $(SRC_DIR)/sm_io/sm_io.mk
include $(SRC_DIR)/dev_mngr/dev_mngr.mk
......@@ -194,7 +197,7 @@ include $(SRC_DIR)/dev_io/dev_io.mk
include $(SRC_DIR)/msg/msg.mk
include $(SRC_DIR)/revision/revision.mk
include $(SRC_DIR)/boards/$(BOARD)/board.mk
include $(SRC_DIR)/apps/$(APP)/$(APP).mk
include $(APPS_MKS)
# Project boards
boards_INCLUDE_DIRS = -Iinclude/boards/$(BOARD)
......@@ -211,20 +214,21 @@ override CFLAGS += $(CFLAGS_USR) $(CFLAGS_PLATFORM) $(CFLAGS_DEBUG) $(CPPFLAGS)
override LDFLAGS += $(LDFLAGS_PLATFORM)
# Output modules
OUT = $(dev_mngr_OUT) $($(APP)_OUT)
OUT = $(dev_mngr_OUT)
# Get each APP OUT module
OUT += $(foreach out,$(APPS),$($(out)_OUT))
# All possible output modules
ALL_OUT = $(dev_mngr_all_OUT) $($(APP)_all_OUT)
ALL_OUT = $(dev_mngr_all_OUT)
# Get each APP all possible output modules
ALL_OUT += $(foreach all_out,$(APPS),$($(all_out)_all_OUT))
# Out objects
dev_mngr_OBJS += $(dev_mngr_core_OBJS) $(debug_OBJS) \
$(exp_ops_OBJS) $(thsafe_msg_zmq_OBJS) \
$(ll_io_utils_OBJS) $(dev_io_core_utils_OBJS)
$(APP)_OBJS += $(dev_io_core_OBJS) $(ll_io_OBJS) \
$(sm_io_OBJS) $(msg_OBJS) $(board_OBJS)
$(APP)_cfg_OBJS += $(dev_io_core_OBJS) $(ll_io_OBJS) \
common_app_OBJS = $(dev_io_core_OBJS) $(ll_io_OBJS) \
$(sm_io_OBJS) $(msg_OBJS) $(board_OBJS)
.SECONDEXPANSION:
......@@ -238,8 +242,7 @@ OBJS_all = $(ll_io_OBJS) \
$(sm_io_OBJS) \
$(msg_OBJS) \
$(dev_mngr_OBJS) \
$($(APP)_OBJS) \
$($(APP)_cfg_OBJS) \
$(common_app_OBJS) \
$(revision_OBJS)
# Sources
......@@ -269,7 +272,7 @@ revision_SRCS = $(patsubst %.o,%.c,$(revision_OBJS))
all: cfg $(OUT)
# Output Rule
$(OUT): $$($$@_OBJS) $(revision_OBJS)
$(OUT): $$($$@_OBJS) $(common_app_OBJS) $(revision_OBJS)
$(CC) $(LDFLAGS) $(LFLAGS) $(CFLAGS) $(INCLUDE_DIRS) -o $@ $^ $($@_STATIC_LIBS) $(LIBS) $($@_LIBS) $(PROJECT_LIBS)
# Special rule for the revision object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment