]> granicus.if.org Git - esp-idf/commitdiff
Build system: Use ifndef X in makefiles instead of ifeq("$(X)","")
authorAngus Gratton <angus@espressif.com>
Thu, 10 Nov 2016 05:19:59 +0000 (16:19 +1100)
committerAngus Gratton <angus@espressif.com>
Thu, 10 Nov 2016 07:34:43 +0000 (18:34 +1100)
make/component_wrapper.mk
make/project.mk

index 68efe0d2112b4fc480b09b1311e136c0c3d40f57..fe081e32fdea1ea5ef7cc7bcb2add2fc3e5ed081 100644 (file)
@@ -8,7 +8,7 @@
 #
 # 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.)
 endif
 
@@ -60,7 +60,7 @@ include $(COMPONENT_MAKEFILE)
 
 # Object files which need to be linked into the library
 # 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
 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)))
@@ -120,7 +120,7 @@ component_project_vars.mk::
 
 # If COMPONENT_OWNBUILDTARGET is not set, define a phony build target and
 # a COMPONENT_LIBRARY link target.
-ifeq ("$(COMPONENT_OWNBUILDTARGET)", "")
+ifndef COMPONENT_OWNBUILDTARGET
 .PHONY: build
 build: $(COMPONENT_LIBRARY)
        @mkdir -p $(COMPONENT_SRCDIRS)
@@ -134,7 +134,7 @@ $(COMPONENT_LIBRARY): $(COMPONENT_OBJS)
 endif
 
 # 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
 .PHONY: clean
 clean:
index f9cf20a3295454e24ecf856902d5addc9057e321..4554d1d329c2f904f3847fa901d2fa527e23b625 100644 (file)
@@ -40,10 +40,9 @@ help:
 MAKEFLAGS_OLD := $(MAKEFLAGS)
 MAKEFLAGS +=-rR
 
-# Figure out PROJECT_PATH if not set
-ifeq ("$(PROJECT_PATH)","")
-#The path to the project: we assume the Makefile including this file resides
-#in the root of that directory.
+# Default path to the project: we assume the Makefile including this file
+# is in the project directory
+ifndef PROJECT_PATH
 PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
 export PROJECT_PATH
 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
 # all available components in the component dirs.
-ifeq ("$(COMPONENTS)","")
+ifndef COMPONENTS
 # Find all component names. The component names are the same as the
 # 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.