Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,22 @@ SRC_DIRS += $(ASPRINTF_DIR)
INC_DIRS = $(LIBFYAML_DIR)/include
INC_DIRS += $(ASPRINTF_DIR)

XLDFLAGS += $(LDFLAGS)

# LIBFYAML Requirements
XLDFLAGS += -pthread

# LIBWEBSOCKETS Requirements
LIBWEBSOCKETS_DIR = $(FRAMEWORK_BUILD_DIR)/libwebsockets
LIBWEBSOCKETS_DIR ?= $(FRAMEWORK_BUILD_DIR)/libwebsockets
ifneq ($(wildcard $(LIBWEBSOCKETS_DIR)),)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you comment what is the expectation here... I don't think this will work for the requirements for the ticket..

Your still setting LIBWEBSOCKETS_DIR ?= will be set it if it doesn't exist, you'd need something like a EXTERNAL_WEBSOCKETS = TRUE flag of something surely?

INC_DIRS += $(LIBWEBSOCKETS_DIR)/include
XLDFLAGS += $(LIBWEBSOCKETS_DIR)/lib/libwebsockets.a
else
XLDFLAGS += -lwebsockets
endif

# CURL Requirements
CURL_DIR = $(FRAMEWORK_BUILD_DIR)/curl
CURL_DIR ?= $(FRAMEWORK_BUILD_DIR)/curl
ifneq ($(wildcard $(CURL_DIR)),)
INC_DIRS += $(CURL_DIR)/include
XLDFLAGS += $(CURL_DIR)/lib/libcurl.a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah don't think these changes are correct, := is more correct.

One subtle edge case (empty value)

If the caller does make CURL_DIR= (explicitly empty), ?= will not set the default (because it’s still “defined”). If you want “empty means use default”, do this instead:

CURL_DIR := $(or $(CURL_DIR),$(FRAMEWORK_BUILD_DIR)/curl)

ifneq ($(wildcard $(CURL_DIR)),)
  INC_DIRS  += $(CURL_DIR)/include
  XLDFLAGS  += $(CURL_DIR)/lib/libcurl.a
endif

That gives you: env/CLI wins if non-empty; otherwise fallback.

Expand Down Expand Up @@ -107,7 +113,7 @@ endif

# Defaults for target linux
ifeq ($(TARGET),linux)
CC := gcc -ggdb -o0 -Wall
CC ?= gcc -ggdb -o0 -Wall
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linux is a hardcoded target ,you can still override any of these variables by passing it to the makefile

make TARGET=linux CC=ABC

will still work with CC:= gcc -ggdb -o0 -Wall

I don't see the need for this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above, := was correct as far as I can see.

endif

SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
Expand Down