# Project configuration EXECUTABLE_NAME = joomer-ftxui-file-browser PLATFORM = $(shell uname) BUILD_TYPE ?= release# Default to release build if not specified #STB_PATH = $(HOME)/workdir/stb LINUX_LIB_EXT = so # Version configuration (can be overridden) #DPP_VERSION ?= $(shell find ../DPP/build/library -name "libdpp.so.*.*.*" -type f | head -1 | sed 's/.*libdpp\.so\.//') FTXUI_PATH = ../learndir/FTXUI #BELLA_BUILD_DIR = $(BELLA_PATH)/build/library LIB_PATHS = -L$(FTXUI_PATH)/build INC_DIRS = -Iinclude -I$(FTXUI_PATH)/include #endif #DPP_VERSION := $(or $(DPP_VERSION),10.1.4)# Fallback version if auto-detection fails #DPP_LINUX_LIB_VERSION_FILE = libdpp.$(LINUX_LIB_EXT).$(DPP_VERSION) #BELLA_LIB_NAME = libdpp.$(LINUX_LIB_EXT) # Common paths OBJ_DIR = obj/$(PLATFORM)/$(BUILD_TYPE) BIN_DIR = bin/$(PLATFORM)/$(BUILD_TYPE) OUTPUT_FILE = $(BIN_DIR)/$(EXECUTABLE_NAME) CXX = g++ CXX_FLAGS = $(COMMON_FLAGS) -std=c++17 -Wall -g $(INC_DIRS) # Build type specific flags ifeq ($(BUILD_TYPE), debug) CPP_DEFINES = -D_DEBUG -DDL_USE_SHARED COMMON_FLAGS = $(ARCH_FLAGS) $(INCLUDE_PATHS) COMP_FLAGS = -g -O0 -std=c++17 -Wall #LINK_FLAGS = -fvisibility=hidden else CPP_DEFINES = -DNDEBUG=1 -DDL_USE_SHARED COMMON_FLAGS = $(ARCH_FLAGS) $(INCLUDE_PATHS) COMP_FLAGS = -O3 -std=c++17 -Wall #LINK_FLAGS = -fvisibility=hidden endif # Language-specific flags #C_FLAGS = $(COMMON_FLAGS) -std=c17 #CXX_FLAGS = $(COMMON_FLAGS) -std=c++17 -Wall -g $(INC_DIRS) CXX = g++ CXX_FLAGS = $(COMMON_FLAGS) $(INC_DIRS) LINK_FLAGS = $(LIB_PATHS) #-fvisibility=hidden FTXUI_LIB_FLAGS = -lftxui-component -lftxui-dom -lftxui-screen #BELLA_LIB_FLAGS = -L$(LIB_PATHS) -Wl,-rpath,$(LIB_PATHS) -lbella_engine_sdk # Linker directive flags (L for library search path, l for library) # Need to link against the D++ library and pthread (common for C++ applications with threading) LDFLAGS = $(FTXUI_LIB_FLAGS) #$(BELLA_LIB_FLAGS) #-L$(LIB_PATHS) -ldpp -lpthread -Wl,-rpath='$$ORIGIN' # search for lib in the same place as the executable file # List of object files for your executable # We've changed this back to use joomer-ftxui-file-browser.o as the source of the executable OBJECTS = $(OBJ_DIR)/joomer-ftxui-file-browser.o $(OBJ_DIR)/%.o: %.cpp @echo "Compiling $< -> $@" @mkdir -p $(@D) # Ensure the output binary directory exists (e.g., bin/Linux/release/) $(CXX) -c $(CPP_DEFINES) $(COMP_FLAGS) $(INC_DIRS) $< -o $@ # --- Main Target --- # 'all' is the default target that builds your executable all: $(OUTPUT_FILE) @echo "FTXUI_PATH: $(FTXUI_PATH)" @echo "Build complete." # Rule to link the executable: # It depends on the object files and uses CXX to link them with specified libraries. $(OUTPUT_FILE): $(OBJECTS) @echo "Linking $(OUTPUT_FILE)..." @mkdir -p $(@D) $(CXX) -o $@ $(OBJECTS) $(LINK_FLAGS) $(LDFLAGS) @echo "FTXUI_PATH: "$(FTXUI_PATH) @echo "Build complete." # --- Clean Target --- # Removes all generated build files and directories clean: @echo "Cleaning build directory..." $(RM) -r $(BIN_DIR) $(RM) -r $(OBJ_DIR) # .PHONY specifies targets that are not actual files to prevent conflicts with file names .PHONY: all clean