forked from espressif/esp-idf
Build system: Use ifndef X in makefiles instead of ifeq("$(X)","")
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
#
|
#
|
||||||
# CWD is the build directory of the component.
|
# CWD is the build directory of the component.
|
||||||
|
|
||||||
ifeq ("$(PROJECT_PATH)","")
|
ifndef PROJECT_PATH
|
||||||
$(error Make was invoked from $(CURDIR). However please do not run make from the sdk or a component directory; invoke make from the project directory. See the ESP-IDF README for details.)
|
$(error Make was invoked from $(CURDIR). However please do not run make from the sdk or a component directory; invoke make from the project directory. See the ESP-IDF README for details.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ include $(COMPONENT_MAKEFILE)
|
|||||||
|
|
||||||
# Object files which need to be linked into the library
|
# Object files which need to be linked into the library
|
||||||
# By default we take all .c, .cpp & .S files in COMPONENT_SRCDIRS.
|
# By default we take all .c, .cpp & .S files in COMPONENT_SRCDIRS.
|
||||||
ifeq ("$(COMPONENT_OBJS)", "")
|
ifndef COMPONENT_OBJS
|
||||||
# Find all source files in all COMPONENT_SRCDIRS
|
# Find all source files in all COMPONENT_SRCDIRS
|
||||||
COMPONENT_OBJS := $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.c,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.c)))
|
COMPONENT_OBJS := $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.c,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.c)))
|
||||||
COMPONENT_OBJS += $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.cpp,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.cpp)))
|
COMPONENT_OBJS += $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.cpp,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.cpp)))
|
||||||
@@ -120,7 +120,7 @@ component_project_vars.mk::
|
|||||||
|
|
||||||
# If COMPONENT_OWNBUILDTARGET is not set, define a phony build target and
|
# If COMPONENT_OWNBUILDTARGET is not set, define a phony build target and
|
||||||
# a COMPONENT_LIBRARY link target.
|
# a COMPONENT_LIBRARY link target.
|
||||||
ifeq ("$(COMPONENT_OWNBUILDTARGET)", "")
|
ifndef COMPONENT_OWNBUILDTARGET
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(COMPONENT_LIBRARY)
|
build: $(COMPONENT_LIBRARY)
|
||||||
@mkdir -p $(COMPONENT_SRCDIRS)
|
@mkdir -p $(COMPONENT_SRCDIRS)
|
||||||
@@ -134,7 +134,7 @@ $(COMPONENT_LIBRARY): $(COMPONENT_OBJS)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# If COMPONENT_OWNCLEANTARGET is not set, define a phony clean target
|
# If COMPONENT_OWNCLEANTARGET is not set, define a phony clean target
|
||||||
ifeq ("$(COMPONENT_OWNCLEANTARGET)", "")
|
ifndef COMPONENT_OWNCLEANTARGET
|
||||||
CLEAN_FILES = $(COMPONENT_LIBRARY) $(COMPONENT_OBJS) $(COMPONENT_OBJS:.o=.d) $(COMPONENT_EXTRA_CLEAN) component_project_vars.mk
|
CLEAN_FILES = $(COMPONENT_LIBRARY) $(COMPONENT_OBJS) $(COMPONENT_OBJS:.o=.d) $(COMPONENT_EXTRA_CLEAN) component_project_vars.mk
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@@ -40,10 +40,9 @@ help:
|
|||||||
MAKEFLAGS_OLD := $(MAKEFLAGS)
|
MAKEFLAGS_OLD := $(MAKEFLAGS)
|
||||||
MAKEFLAGS +=-rR
|
MAKEFLAGS +=-rR
|
||||||
|
|
||||||
# Figure out PROJECT_PATH if not set
|
# Default path to the project: we assume the Makefile including this file
|
||||||
ifeq ("$(PROJECT_PATH)","")
|
# is in the project directory
|
||||||
#The path to the project: we assume the Makefile including this file resides
|
ifndef PROJECT_PATH
|
||||||
#in the root of that directory.
|
|
||||||
PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
|
PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
|
||||||
export PROJECT_PATH
|
export PROJECT_PATH
|
||||||
endif
|
endif
|
||||||
@@ -67,7 +66,7 @@ SRCDIRS ?= main
|
|||||||
|
|
||||||
# The project Makefile can define a list of components, but if it does not do this we just take
|
# The project Makefile can define a list of components, but if it does not do this we just take
|
||||||
# all available components in the component dirs.
|
# all available components in the component dirs.
|
||||||
ifeq ("$(COMPONENTS)","")
|
ifndef COMPONENTS
|
||||||
# Find all component names. The component names are the same as the
|
# Find all component names. The component names are the same as the
|
||||||
# directories they're in, so /bla/components/mycomponent/ -> mycomponent. We then use
|
# directories they're in, so /bla/components/mycomponent/ -> mycomponent. We then use
|
||||||
# COMPONENT_DIRS to build COMPONENT_PATHS with the full path to each component.
|
# COMPONENT_DIRS to build COMPONENT_PATHS with the full path to each component.
|
||||||
|
Reference in New Issue
Block a user