Skip to content

Conversation

@bhanucbp
Copy link

  • Added LDFLAGS and CFLAGS
  • Changed CC, and directory paths portable

- Added LDFLAGS and CFLAGS
- Changed CC, and directory paths portable
@bhanucbp bhanucbp requested a review from kanjoe24 December 16, 2025 14:49
@bhanucbp bhanucbp self-assigned this Dec 16, 2025
@bhanucbp bhanucbp requested a review from a team as a code owner December 16, 2025 14:49
Copilot AI review requested due to automatic review settings December 16, 2025 14:49
@bhanucbp bhanucbp added the bug Something isn't working label Dec 16, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@kanjoe24
Copy link
Contributor

release script results:

./release-test-script-ut-control.sh -t feature/gh109_Makefile_Update_avoid_hardcodedpaths
==========================================================
RESULTS for ubuntu 
On the branch feature/gh109_Makefile_Update_avoid_hardcodedpaths. PASS
build/linux/curl/lib/libcurl.a exists. PASS
Openssl static lib does not exist. PASS 
CMake host binary does not exist. PASS 
==========================================================
==========================================================
RESULTS for VM-SYNC 
On the branch feature/gh109_Makefile_Update_avoid_hardcodedpaths. PASS
build/linux/curl/lib/libcurl.a exists. PASS
build/linux/openssl/lib/libssl.a exists. PASS 
host-tools/CMake-3.30.0/build/bin/cmake exists. PASS 
==========================================================
==========================================================
RESULTS for dunfell_arm 
On the branch feature/gh109_Makefile_Update_avoid_hardcodedpaths. PASS
build/arm/curl/lib/libcurl.a exists. PASS
build/arm/openssl/lib/libssl.a exists. PASS 
CMake host binary does not exist. PASS 
==========================================================
==========================================================
RESULTS for dunfell_linux 
On the branch feature/gh109_Makefile_Update_avoid_hardcodedpaths. PASS
CURL static lib does not exist. PASS
Openssl static lib does not exist. PASS 
CMake host binary exists. PASS 
==========================================================
==========================================================
RESULTS for kirkstone_arm 
On the branch feature/gh109_Makefile_Update_avoid_hardcodedpaths. PASS
build/arm/curl/lib/libcurl.a exists. PASS
build/arm/openssl/lib/libssl.a exists. PASS 
CMake host binary does not exist. PASS 
==========================================================
==========================================================
RESULTS for kirkstone_linux 
On the branch feature/gh109_Makefile_Update_avoid_hardcodedpaths. PASS
build/linux/curl/lib/libcurl.a exists. PASS
Openssl static lib does not exist. PASS 
CMake host binary does not exist. PASS 
==========================================================

@kanjoe24 kanjoe24 requested a review from Ulrond December 22, 2025 15:37
Copy link
Contributor

@kanjoe24 kanjoe24 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Ulrond Ulrond left a comment

Choose a reason for hiding this comment

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

need to check this

# 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?

# 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.

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.

@Ulrond Ulrond moved this to Changes Requested in HAL Interface & Test Suit - Upgrades Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Changes Requested

Development

Successfully merging this pull request may close these issues.

Bug: Makefile: Improve portability for libwebsockets and CC assignment

4 participants