Conversation
bhanucbp
commented
Dec 16, 2025
- Added LDFLAGS and CFLAGS
- Changed CC, and directory paths portable
- Added LDFLAGS and CFLAGS - Changed CC, and directory paths portable
There was a problem hiding this comment.
Pull request overview
This PR updates the Makefile to improve portability and flexibility by making build configuration more customizable. The changes allow users to override default compiler settings and library paths through environment variables, while also adding support for system-installed libraries as fallbacks.
Key changes:
- Made CC, CURL_DIR, and LIBWEBSOCKETS_DIR overridable via environment variables
- Added LDFLAGS support for custom linker flags
- Implemented fallback to system-installed libwebsockets when local build is unavailable
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
release script results: |
| # LIBWEBSOCKETS Requirements | ||
| LIBWEBSOCKETS_DIR = $(FRAMEWORK_BUILD_DIR)/libwebsockets | ||
| LIBWEBSOCKETS_DIR ?= $(FRAMEWORK_BUILD_DIR)/libwebsockets | ||
| ifneq ($(wildcard $(LIBWEBSOCKETS_DIR)),) |
There was a problem hiding this comment.
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?
| # Defaults for target linux | ||
| ifeq ($(TARGET),linux) | ||
| CC := gcc -ggdb -o0 -Wall | ||
| CC ?= gcc -ggdb -o0 -Wall |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
see above, := was correct as far as I can see.
| CURL_DIR ?= $(FRAMEWORK_BUILD_DIR)/curl | ||
| ifneq ($(wildcard $(CURL_DIR)),) | ||
| INC_DIRS += $(CURL_DIR)/include | ||
| XLDFLAGS += $(CURL_DIR)/lib/libcurl.a |
There was a problem hiding this comment.
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
endifThat gives you: env/CLI wins if non-empty; otherwise fallback.