Skip to content

V3.0.3 makefiles cleanup#5158

Merged
renecannao merged 1 commit intov3.0from
v3.0.3-makefiles_cleanup
Oct 17, 2025
Merged

V3.0.3 makefiles cleanup#5158
renecannao merged 1 commit intov3.0from
v3.0.3-makefiles_cleanup

Conversation

@mirostauder
Copy link
Contributor

no functional changes
control and path variables are defined over and over in makefiles
avoid duplication, help readability and maintainability

extracting control and path variables into separate include files

@mirostauder mirostauder added this to the Release 3.0.3 milestone Oct 13, 2025
@mirostauder mirostauder self-assigned this Oct 13, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @mirostauder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the project's build system by centralizing Makefile variable definitions and updating several key third-party dependencies. The primary goal is to enhance the maintainability and readability of the Makefiles, while also ensuring the project benefits from the latest features and bug fixes in its external libraries. A new JSON parsing library has also been integrated, streamlining JSON handling throughout the codebase.

Highlights

  • Makefile Refactoring: Centralized common Makefile variables and dependency paths into new include files (include/makefiles_vars.mk and include/makefiles_paths.mk) to reduce duplication and improve maintainability across the project's Makefiles.
  • Dependency Updates: Updated several third-party libraries including clickhouse-cpp (from 2.3.0 to 2.6.0), curl (from 8.4.0 to 8.16.0), libmicrohttpd (from 0.9.77 to 1.0.2), and sqlite3 (from 3430200 to 3500400).
  • New JSON Library Integration: Introduced the nlohmann/json library (version 3.12.0) as a new dependency, updating include paths across the codebase to reflect this change and removing previous JSON-related forward declaration files.
  • Removal of Obsolete Patches: Eliminated several dependency-specific patches (wire_format.patch, connection.c-snprintf-overflow.patch, sqlite3.c-multiplication-overflow.patch) that are no longer needed due to the updated library versions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request does a great job of refactoring the Makefiles to centralize control and path variables, which significantly improves readability and maintainability. The introduction of makefiles_vars.mk and makefiles_paths.mk is a good approach. I've found a few issues related to the completeness of the refactoring and some duplication that crept in. Addressing these will make the new structure more robust and consistent. Overall, this is a valuable cleanup.


SYS_LOC_IDIR := /usr/local/include

PROXYSQL_PATH := $(shell while [ ! -f ./src/proxysql_global.cpp ]; do cd ..; done; pwd)

Choose a reason for hiding this comment

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

critical

This PROXYSQL_PATH definition is duplicated in all Makefiles that include this file. This goes against the goal of this PR, which is to reduce duplication. The last definition of a variable is what make uses, so this definition will override the one in the including Makefile. This can lead to subtle bugs if the logic ever diverges.

Please remove this definition from this file. The individual Makefiles (lib/Makefile, src/Makefile, etc.) already define it before including this file, which is the correct approach to ensure the path is resolved from the correct starting directory.

Comment on lines 3 to +5

GIT_VERSION ?= $(shell git describe --long --abbrev=7)
ifndef GIT_VERSION
$(error GIT_VERSION is not set)
endif

UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)

DISTRO := $(shell grep '^ID=' /etc/os-release | cut -d= -f2 | tr -d '"')

CENTOSVER := Unknown
ifneq (,$(wildcard /etc/system-release))
CENTOSVER := $(shell rpm --eval %rhel)
endif
include $(PROXYSQL_PATH)/include/makefiles_vars.mk

Choose a reason for hiding this comment

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

high

This Makefile should also include makefiles_paths.mk to make use of the centralized path variables. Currently, it seems the refactoring is incomplete for this file, as some rules still use hardcoded relative paths instead of the new variables.

For example, the libscram rule uses POSTGRESQL_DIR=\"$(shell pwd)/postgresql/postgresql/\". After including makefiles_paths.mk, this and other rules should be updated to use variables like $(POSTGRESQL_PATH).

include $(PROXYSQL_PATH)/include/makefiles_vars.mk
include $(PROXYSQL_PATH)/include/makefiles_paths.mk

deps/Makefile Outdated
json/json/include/nlohmann/json.hpp:
cd json && rm -rf json-*/ || true
cd json && tar -zxf json-*.tar.gz
cd json/json && cmake .

Choose a reason for hiding this comment

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

medium

The nlohmann/json library is header-only. The required header files are extracted by the tar command in the previous line. This cmake . command only generates local build files and doesn't produce any artifacts needed for the build. It's unnecessary and could be a point of failure if cmake isn't available. It's best to remove this line.

@mirostauder mirostauder force-pushed the v3.0.3-makefiles_cleanup branch 2 times, most recently from e675de0 to 31d716a Compare October 16, 2025 09:31
@mirostauder mirostauder force-pushed the v3.0.3-makefiles_cleanup branch 2 times, most recently from ea9c83f to 0a74d98 Compare October 17, 2025 08:05
@mirostauder mirostauder force-pushed the v3.0.3-makefiles_cleanup branch from 0a74d98 to d020f57 Compare October 17, 2025 08:21
@sonarqubecloud
Copy link

@renecannao renecannao merged commit 436bccc into v3.0 Oct 17, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants