From 1861e3e91144b9610a9ed0b04764793982604b51 Mon Sep 17 00:00:00 2001 From: AntonioCS Date: Wed, 10 Dec 2025 14:46:22 +0000 Subject: [PATCH] Restructure bind-hub folder for clarity (v2.1.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify file naming and improve organization of the bind-hub folder: - Rename user-editable files (remove mb_ prefix): - mb_config.mk → config.mk - mb_project.mk → project.mk - mb_config.local.mk → config.local.mk - mb_project.local.mk → project.local.mk - Move auto-generated modules file to internal/ subfolder: - mb_modules.mk → internal/modules.mk - Add deprecation detection that fails with migration instructions for projects using the old structure - Update internal variable names for consistency: - mb_project_bindhub_modules_file → mb_project_bindhub_internal_modules_file Files: - core/deprecation.mk: New file with deprecation checks - templates/README.bind-hub.md: New README template for bind-hub folders - templates/config.tpl.mk, project.tpl.mk: Renamed from mb_* versions - mb_config.mk: Updated variable definitions - main.mk: Added deprecation check, updated variable refs - core/init_project.mk: Creates internal/ folder, copies README - core/modules_manager.mk: Updated to use new variable names - core/targets.mk: Fixed malformed variable reference - CHANGELOG.md, CLAUDE.md, README.md: Updated documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 23 ++++++++ CLAUDE.md | 26 ++++----- README.md | 8 +-- core/deprecation.mk | 58 +++++++++++++++++++ core/init_project.mk | 26 +++++---- core/modules_manager.mk | 13 +++-- core/targets.mk | 2 +- main.mk | 22 ++++--- mb_config.mk | 12 ++-- templates/README.bind-hub.md | 52 +++++++++++++++++ templates/{mb_config.tpl.mk => config.tpl.mk} | 0 .../{mb_project.tpl.mk => project.tpl.mk} | 0 .../bind-hub/{mb_config.mk => config.mk} | 0 .../mock_project/bind-hub/internal/modules.mk | 11 ++++ .../bind-hub/{mb_project.mk => project.mk} | 0 15 files changed, 205 insertions(+), 48 deletions(-) create mode 100644 core/deprecation.mk create mode 100644 templates/README.bind-hub.md rename templates/{mb_config.tpl.mk => config.tpl.mk} (100%) rename templates/{mb_project.tpl.mk => project.tpl.mk} (100%) rename tests/mock_project/bind-hub/{mb_config.mk => config.mk} (100%) create mode 100644 tests/mock_project/bind-hub/internal/modules.mk rename tests/mock_project/bind-hub/{mb_project.mk => project.mk} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74b9732..1a3b532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +## [2.1.1] - 2025-12-10 + +### Changed +- **bind-hub folder restructure**: Simplified file naming and improved organization + - Renamed user-editable files to remove `mb_` prefix: + - `mb_config.mk` → `config.mk` + - `mb_project.mk` → `project.mk` + - `mb_config.local.mk` → `config.local.mk` + - `mb_project.local.mk` → `project.local.mk` + - Moved auto-generated modules file to `internal/` subfolder: + - `mb_modules.mk` → `internal/modules.mk` + - Updated internal variable names for consistency: + - `mb_project_bindhub_modules_file` → `mb_project_bindhub_internal_modules_file` + - Template files renamed to match new convention (`config.tpl.mk`, `project.tpl.mk`) + +### Added +- **Deprecation detection**: Projects using old bind-hub structure (pre-2.1.1) will now fail with migration instructions +- `core/deprecation.mk`: New file containing deprecation checks and error messages +- `templates/README.bind-hub.md`: README template for new bind-hub folders explaining structure + +### Fixed +- Improved clarity of bind-hub folder organization (user files vs auto-generated files) + ## [2.1.0] - 2025-12-10 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index cdebffd..abe43ef 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -59,7 +59,7 @@ make mb/help- ``` ### Debugging -Set debug flags in your environment or mb_config.mk: +Set debug flags in your environment or config.mk: - `mb_debug=1` - Enable general debugging - `mb_debug_modules=1` - Debug module loading - `mb_debug_targets=1` - Debug target listing @@ -106,7 +106,7 @@ Set debug flags in your environment or mb_config.mk: **Module Loading Process**: 1. Build module database from all mod_info.mk files -2. Read `bind-hub/mb_modules.mk` for enabled modules +2. Read `bind-hub/internal/modules.mk` for enabled modules 3. For each enabled module: - Load module's `mod_config.mk` (if exists) - Load project override: `bind-hub/configs/_config.mk` (if exists) @@ -124,15 +124,15 @@ Set debug flags in your environment or mb_config.mk: ### Project Configuration **Configuration Hierarchy** (bind-hub folder): -1. `mb_config.mk` - Project configuration (committed) -2. `mb_config.local.mk` - Local overrides (gitignored) -3. `mb_project.mk` - Project-specific targets (committed) -4. `mb_project.local.mk` - Local target overrides (gitignored) -5. `mb_modules.mk` - Auto-generated list of enabled modules (DO NOT EDIT) -6. `configs/` - Module configuration overrides -7. `modules/` - Project-specific custom modules - -**Important Variables** (in mb_config.mk): +1. `config.mk` - Project configuration (committed) +2. `config.local.mk` - Local overrides (gitignored) +3. `project.mk` - Project-specific targets (committed) +4. `project.local.mk` - Local target overrides (gitignored) +5. `internal/modules.mk` - Auto-generated list of enabled modules (DO NOT EDIT) +6. `configs/` - Module configuration overrides (created on-demand) +7. `modules/` - Project-specific custom modules (created on-demand) + +**Important Variables** (in config.mk): - `mb_project_path` - Absolute path to project root (REQUIRED) - `mb_makebind_path` - Path to MakeBind installation - `mb_default_target` - Default target (default: mb/targets-list) @@ -143,11 +143,11 @@ Set debug flags in your environment or mb_config.mk: Understanding the load order is critical: 1. `Makefile` includes `main.mk` -2. `main.mk` loads `mb_config.mk` and `mb_config.local.mk` +2. `main.mk` loads `config.mk` and `config.local.mk` 3. Core utilities loaded (util.mk, functions.mk) 4. Module database built (`mb_modules_build_db`) 5. Modules loaded (`mb_load_modules`) -6. Project targets loaded (`mb_project.mk`, `mb_project.local.mk`) +6. Project targets loaded (`project.mk`, `project.local.mk`) This order ensures: - Module targets can be overridden by project targets diff --git a/README.md b/README.md index dbb94f0..cca8021 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ powershell -Command "Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/A - This command downloads the Makefile template and creates a Makefile in your current directory. - `make` will then automatically execute and check for the existence of the `MakeBind` folder in the path specified by `mb_mb_default_path` (default is `../MakeBind`, meaning it will search in the parent directory). - If the `MakeBind` folder does not exist, the latest release will be downloaded. -- The folder `bind-hub` will be created in the current directory, which contains important configuration files, which are the `mb_config.mk` and `mb_project.mk` and a few other files and folders. +- The folder `bind-hub` will be created in the current directory, which contains important configuration files, including `config.mk` and `project.mk`, plus an `internal/` subfolder for auto-generated files. - You will then see a list of available targets, and you can start using MakeBind. NOTE: if you want better control of where MakeBind is installed, you can either manually clone the repo or download from Github. @@ -72,9 +72,9 @@ MakeBind is designed to be simple to use and easy to configure. Here are some co Run a specific target. ## Configuration -As mentioned, when you run MakeBind for the first time, it will create the `mb_config.mk` and `mb_project.mk` files in the folder `bind-hub`. These files are used to configure MakeBind for your project. -- In `mb_config.mk`, you can set all configuration variables that are used by MakeBind modules or your own modules. You can create a local version named `mb_config.local.mk` to override the default values (do not commit this file to your repository). -- In `mb_project.mk`, you can add all targets that are specific to your project. You can create a local version named `mb_project.local.mk` to override the default values (do not commit this file to your repository). +As mentioned, when you run MakeBind for the first time, it will create the `config.mk` and `project.mk` files in the folder `bind-hub`. These files are used to configure MakeBind for your project. +- In `config.mk`, you can set all configuration variables that are used by MakeBind modules or your own modules. You can create a local version named `config.local.mk` to override the default values (do not commit this file to your repository). +- In `project.mk`, you can add all targets that are specific to your project. You can create a local version named `project.local.mk` to override the default values (do not commit this file to your repository). - In the `bind-hub` folder, you can add all your custom modules in `bind-hub/modules`. ## Upgrading Make diff --git a/core/deprecation.mk b/core/deprecation.mk new file mode 100644 index 0000000..6a8dfc6 --- /dev/null +++ b/core/deprecation.mk @@ -0,0 +1,58 @@ +##################################################################################### +# Project: MakeBind +# File: core/deprecation.mk +# Description: Deprecation checks for MakeBind +# Author: AntonioCS +# License: MIT License +##################################################################################### +ifndef __MB_CORE_DEPRECATION_MK__ +__MB_CORE_DEPRECATION_MK__ := 1 + +## Check for deprecated bind-hub structure (pre-2.1.1) +## Returns $(mb_true) if old structure detected, $(mb_false) otherwise +define mb_check_deprecated_bindhub +$(strip + $(if $(wildcard $(mb_project_bindhub_path)/mb_config.mk),$(mb_true), + $(if $(wildcard $(mb_project_bindhub_path)/mb_project.mk),$(mb_true), + $(if $(wildcard $(mb_project_bindhub_path)/mb_modules.mk),$(mb_true), + $(mb_false)))) +) +endef + +## Error message for deprecated bind-hub structure +define mb_deprecated_bindhub_error_msg + +================================================================================ +ERROR: Deprecated bind-hub structure detected (MakeBind 2.1.1+) +================================================================================ + +Your project uses the old bind-hub file naming convention. +Please migrate to the new structure: + + 1. Rename files: + mv bind-hub/mb_config.mk bind-hub/config.mk + mv bind-hub/mb_project.mk bind-hub/project.mk + + 2. If you have local overrides, rename them too: + mv bind-hub/mb_config.local.mk bind-hub/config.local.mk + mv bind-hub/mb_project.local.mk bind-hub/project.local.mk + + 3. Move modules file to internal folder: + mkdir -p bind-hub/internal + mv bind-hub/mb_modules.mk bind-hub/internal/modules.mk + +After migration, your bind-hub/ folder should look like: + bind-hub/ + ├── config.mk + ├── config.local.mk (optional) + ├── project.mk + ├── project.local.mk (optional) + └── internal/ + └── modules.mk + +Note: configs/ and modules/ folders are created automatically when needed. +================================================================================ + +endef + +endif # __MB_CORE_DEPRECATION_MK__ diff --git a/core/init_project.mk b/core/init_project.mk index 531414f..806ebd6 100644 --- a/core/init_project.mk +++ b/core/init_project.mk @@ -13,29 +13,35 @@ mb_debug_init ?= $(mb_debug) ##NOTE: there are still error when calling mb_printf in some situations ### $(call mb_printf_info,Creating missing files) ifeq ($(OS),Windows_NT) +## TODO: Remove Windows support - tracked in Trello ticket "Remove Windows support from MakeBind" ## NOTE: Windows paths need to be escaped even when SHELL is set to pwsh mb_init_create_folder_cmd := $(call mb_powershell,mkdir $(subst /,\\,$(mb_project_bindhub_path))) -mb_init_cp_config_mk_cmd := $(call mb_powershell,copy $(subst /,\\,$(mb_makebind_templates_path)\\mb_config.tpl.mk) $(subst /,\\,$(mb_project_mb_config_file))) -mb_init_cp_project_mk_cmd := $(call mb_powershell,copy $(subst /,\\,$(mb_makebind_templates_path)\\mb_project.tpl.mk) $(subst /,\\,$(mb_project_mb_project_mk_file))) +mb_init_cp_config_mk_cmd := $(call mb_powershell,copy $(subst /,\\,$(mb_makebind_templates_path)\\config.tpl.mk) $(subst /,\\,$(mb_project_config_file))) +mb_init_cp_project_mk_cmd := $(call mb_powershell,copy $(subst /,\\,$(mb_makebind_templates_path)\\project.tpl.mk) $(subst /,\\,$(mb_project_file))) else mb_init_create_folder_cmd := mkdir -p $(mb_project_bindhub_path) -mb_init_create_configs_folder_cmd := mkdir -p $(mb_project_bindhub_configs); -mb_init_cp_config_mk_cmd := cp $(mb_makebind_templates_path)/mb_config.tpl.mk $(mb_project_mb_config_file); -mb_init_cp_project_mk_cmd := cp $(mb_makebind_templates_path)/mb_project.tpl.mk $(mb_project_mb_project_mk_file); +mb_init_create_internal_folder_cmd := mkdir -p $(mb_project_bindhub_internal_path); +mb_init_cp_config_mk_cmd := cp $(mb_makebind_templates_path)/config.tpl.mk $(mb_project_config_file); +mb_init_cp_project_mk_cmd := cp $(mb_makebind_templates_path)/project.tpl.mk $(mb_project_file); +mb_init_cp_readme_cmd := cp $(mb_makebind_templates_path)/README.bind-hub.md $(mb_project_bindhub_path)/README.md; endif $(if $(call mb_not_exists,$(mb_project_bindhub_path)),\ $(call mb_debug_print,Creating bindhub path: $(mb_project_bindhub_path),$(mb_debug_init))\ -$(shell $(mb_init_create_folder_cmd) && $(mb_init_create_configs_folder_cmd))\ +$(shell $(mb_init_create_folder_cmd) && $(mb_init_create_internal_folder_cmd))\ ) -$(if $(call mb_not_exists,$(mb_project_mb_project_mk_file)),\ -$(call mb_debug_print, Copying mb_project.tpl.mk to $(mb_project_mb_project_mk_file),$(mb_debug_init))\ +$(if $(call mb_not_exists,$(mb_project_file)),\ +$(call mb_debug_print, Copying project.tpl.mk to $(mb_project_file),$(mb_debug_init))\ $(shell $(mb_init_cp_project_mk_cmd))\ ) -$(if $(call mb_not_exists,$(mb_project_mb_config_file)),\ -$(call mb_debug_print, Copying mb_config.tpl.mk to $(mb_project_mb_config_file),$(mb_debug_init))\ +$(if $(call mb_not_exists,$(mb_project_config_file)),\ +$(call mb_debug_print, Copying config.tpl.mk to $(mb_project_config_file),$(mb_debug_init))\ $(shell $(mb_init_cp_config_mk_cmd))\ ) +$(if $(call mb_not_exists,$(mb_project_bindhub_path)/README.md),\ +$(call mb_debug_print, Copying README.bind-hub.md to $(mb_project_bindhub_path)/README.md,$(mb_debug_init))\ +$(shell $(mb_init_cp_readme_cmd))\ +) endif # __MB_CORE_INIT_PROJECT_MK__ diff --git a/core/modules_manager.mk b/core/modules_manager.mk index 54030e3..5c204b5 100644 --- a/core/modules_manager.mk +++ b/core/modules_manager.mk @@ -13,12 +13,12 @@ mb_modules_db_all_modules :=# Empty mb_modules_mod_info_file_name := mod_info.mk mb_modules_mod_config_file_name := mod_config.mk -### NOTE: Use mb_project_bindhub_modules_file for project modules file +### NOTE: Use mb_project_bindhub_internal_modules_file for project modules file define mb_modules_header ##################################################################################### # Project: MakeBind -# File: mb_modules.mk +# File: internal/modules.mk # Description: Module structure for MakeBind # Author: AntonioCS # License: MIT License @@ -60,8 +60,9 @@ endef ## NOTE: This must be called after the creation of the bind-hub folder ## This was causing problems on fresh projects that had no bind folder define mb_modules_build_mod_file -$(file > $(mb_project_bindhub_modules_file),$(mb_modules_header)) -$(file >> $(mb_project_bindhub_modules_file),mb_project_modules_loaded :=$(if $(value mb_project_modules_loaded), $(mb_project_modules_loaded),## No modules added)) +$(if $(wildcard $(mb_project_bindhub_internal_path)),,$(error Internal folder missing: $(mb_project_bindhub_internal_path). Run project initialization first.)) +$(file > $(mb_project_bindhub_internal_modules_file),$(mb_modules_header)) +$(file >> $(mb_project_bindhub_internal_modules_file),mb_project_modules_loaded :=$(if $(value mb_project_modules_loaded), $(mb_project_modules_loaded),## No modules added)) endef @@ -79,7 +80,7 @@ endef ## Build the database of modules define mb_modules_build_db $(strip - $(if $(wildcard $(mb_project_bindhub_modules_file)),, + $(if $(wildcard $(mb_project_bindhub_internal_modules_file)),, $(call mb_modules_build_mod_file) ) $(eval $0_all_modules_info_path := $(call mb_modules_find_info,$(mb_modules_path)/)) @@ -127,7 +128,7 @@ define mb_load_modules $(strip $(if $(value mb_project_modules), $(call mb_printf_warn, mb_project_modules is now deprecated$(mb_comma) please remove it and use mb/modules/add to add your modules)) $(call mb_debug_print, Starting modules loading,$(mb_debug_modules)) - $(eval -include $(mb_project_bindhub_modules_file)) + $(eval -include $(mb_project_bindhub_internal_modules_file)) $(foreach $0_mod,$(mb_project_modules_loaded), $(call mb_debug_print, Loading module: $($0_mod),$(mb_debug_modules)) $(if $(call mb_module_is_valid_mod,$($0_mod)), diff --git a/core/targets.mk b/core/targets.mk index 06210ad..9e7673a 100644 --- a/core/targets.mk +++ b/core/targets.mk @@ -76,7 +76,7 @@ endif # Windows_NT ## 0_other_files_in_bind_hub_folder is important in case the user wants to include additional files define mb_targets_list_get_files $(strip - $(eval $0_files_project := $(filter $(mb_project_mb_project_mk_file) $(mb_project_mb_project_mk_local_file),$(MAKEFILE_LIST))) + $(eval $0_files_project := $(filter $(mb_project_file) $(mb_project_local_file),$(MAKEFILE_LIST))) $(eval $0_files_mb_modules := $(filter-out %/mod_info.mk %/mod_config.mk,$(filter $(mb_modules_path)/%,$(MAKEFILE_LIST)))) $(eval $0_files_in_bindhub_modules_folder := $(filter $(mb_project_bindhub_modules_path)/%,$(MAKEFILE_LIST))) $(eval $0_files_project_modules := $(filter-out %/mod_info.mk %/mod_config.mk,$($0_files_in_bindhub_modules_folder))) diff --git a/main.mk b/main.mk index e857bbd..96cdb59 100644 --- a/main.mk +++ b/main.mk @@ -47,6 +47,10 @@ include $(mb_core_path)/util.mk include $(mb_core_path)/functions.mk include $(mb_core_path)/modules_manager.mk include $(mb_core_path)/targets.mk +include $(mb_core_path)/deprecation.mk + +## Check for deprecated bind-hub structure (pre-2.1.1) +$(if $(call mb_check_deprecated_bindhub),$(error $(mb_deprecated_bindhub_error_msg))) #https://www.gnu.org/software/make/manual/html_node/Options-Summary.html @@ -88,14 +92,14 @@ $(call mb_debug_print, mb_modules_path: $(mb_modules_path)) $(call mb_debug_print, mb_project_makefile: $(mb_project_makefile)) $(call mb_debug_print, mb_project_bindhub_path: $(mb_project_bindhub_path)) $(call mb_debug_print, mb_project_bindhub_modules_path: $(mb_project_bindhub_modules_path)) -$(call mb_debug_print, mb_project_mb_config_file: $(mb_project_mb_config_file)) -$(call mb_debug_print, mb_project_mb_config_local_file: $(mb_project_mb_config_local_file)) -$(call mb_debug_print, mb_project_mb_project_mk_file: $(mb_project_mb_project_mk_file)) -$(call mb_debug_print, mb_project_mb_project_mk_local_file: $(mb_project_mb_project_mk_local_file)) +$(call mb_debug_print, mb_project_config_file: $(mb_project_config_file)) +$(call mb_debug_print, mb_project_config_local_file: $(mb_project_config_local_file)) +$(call mb_debug_print, mb_project_file: $(mb_project_file)) +$(call mb_debug_print, mb_project_local_file: $(mb_project_local_file)) $(call mb_debug_print, mb_default_shell_not_windows: $(mb_default_shell_not_windows)) -ifeq ($(and $(mb_check_missing_project_files),$(or $(call mb_not_exists,$(mb_project_mb_config_file)),$(call mb_not_exists,$(mb_project_mb_project_mk_file)))),$(mb_true)) +ifeq ($(and $(mb_check_missing_project_files),$(or $(call mb_not_exists,$(mb_project_config_file)),$(call mb_not_exists,$(mb_project_file)))),$(mb_true)) ifeq ($(mb_auto_include_init_project_if_config_missing),$(mb_on)) $(call mb_debug_print, Including init_project since files are missing) include $(mb_core_path)/init_project.mk @@ -106,8 +110,8 @@ endif ## Include the project specific configuration and target files $(call mb_debug_print, Including project config files) -include $(mb_project_mb_config_file) --include $(mb_project_mb_config_local_file) +include $(mb_project_config_file) +-include $(mb_project_config_local_file) $(call mb_modules_build_db) $(call mb_load_modules) @@ -119,6 +123,6 @@ $(call mb_load_modules) ## Then the target that the user has created in either mb_project.mk or the modules $(call mb_debug_print, Including project target files) -include $(mb_project_mb_project_mk_file) --include $(mb_project_mb_project_mk_local_file) +include $(mb_project_file) +-include $(mb_project_local_file) diff --git a/mb_config.mk b/mb_config.mk index 9570aaf..3985989 100644 --- a/mb_config.mk +++ b/mb_config.mk @@ -7,15 +7,17 @@ mb_core_util_bin_path := $(mb_core_util_path)/bin mb_modules_path := $(abspath $(mb_makebind_path)/modules) mb_project_makefile := $(mb_project_path)/Makefile mb_project_bindhub_path := $(mb_project_path)/bind-hub +## Internal folder for auto-generated files +mb_project_bindhub_internal_path := $(mb_project_bindhub_path)/internal ## Specific modules folder for the project mb_project_bindhub_modules_path := $(mb_project_bindhub_path)/modules ## Configs for modules mb_project_bindhub_configs := $(mb_project_bindhub_path)/configs -mb_project_mb_config_file := $(mb_project_bindhub_path)/mb_config.mk -mb_project_mb_config_local_file := $(mb_project_bindhub_path)/mb_config.local.mk -mb_project_mb_project_mk_file := $(mb_project_bindhub_path)/mb_project.mk -mb_project_mb_project_mk_local_file := $(mb_project_bindhub_path)/mb_project.local.mk -mb_project_bindhub_modules_file := $(mb_project_bindhub_path)/mb_modules.mk +mb_project_config_file := $(mb_project_bindhub_path)/config.mk +mb_project_config_local_file := $(mb_project_bindhub_path)/config.local.mk +mb_project_file := $(mb_project_bindhub_path)/project.mk +mb_project_local_file := $(mb_project_bindhub_path)/project.local.mk +mb_project_bindhub_internal_modules_file := $(mb_project_bindhub_internal_path)/modules.mk mb_debug ?= $(mb_off) # Some functions will not function properly in other shells mb_default_shell_not_windows ?= /bin/bash diff --git a/templates/README.bind-hub.md b/templates/README.bind-hub.md new file mode 100644 index 0000000..4d81525 --- /dev/null +++ b/templates/README.bind-hub.md @@ -0,0 +1,52 @@ +# bind-hub + +This folder contains your project's MakeBind configuration and customizations. + +## Files + +### User-Editable Files + +| File | Purpose | +|------|---------| +| `config.mk` | Project configuration variables (name, prefix, settings) | +| `config.local.mk` | Local overrides for config.mk (gitignored, optional) | +| `project.mk` | Custom project targets and rules | +| `project.local.mk` | Local target overrides (gitignored, optional) | + +### Auto-Generated (Do Not Edit) + +| Folder/File | Purpose | +|-------------|---------| +| `internal/modules.mk` | List of enabled modules - managed via `mb/modules/add` and `mb/modules/remove` | + +## Folders + +| Folder | Purpose | Created | +|--------|---------|---------| +| `configs/` | Module configuration overrides (e.g., `docker_config.mk`) | When first module with config is added | +| `modules/` | Project-specific custom modules | When you run `mb/modules/create/` | +| `internal/` | MakeBind internal files | Automatically on project init | + +## Managing Modules + +```bash +# List available modules +make mb/modules/list + +# Add a module +make mb/modules/add/ + +# Remove a module +make mb/modules/remove/ + +# Create a custom module +make mb/modules/create/ +``` + +## Configuration Override Pattern + +To override a module's default configuration: +1. Add the module: `make mb/modules/add/` +2. Edit `configs/_config.mk` with your values + +The override file is automatically created when you add a module that has configurable options. diff --git a/templates/mb_config.tpl.mk b/templates/config.tpl.mk similarity index 100% rename from templates/mb_config.tpl.mk rename to templates/config.tpl.mk diff --git a/templates/mb_project.tpl.mk b/templates/project.tpl.mk similarity index 100% rename from templates/mb_project.tpl.mk rename to templates/project.tpl.mk diff --git a/tests/mock_project/bind-hub/mb_config.mk b/tests/mock_project/bind-hub/config.mk similarity index 100% rename from tests/mock_project/bind-hub/mb_config.mk rename to tests/mock_project/bind-hub/config.mk diff --git a/tests/mock_project/bind-hub/internal/modules.mk b/tests/mock_project/bind-hub/internal/modules.mk new file mode 100644 index 0000000..d2c38b1 --- /dev/null +++ b/tests/mock_project/bind-hub/internal/modules.mk @@ -0,0 +1,11 @@ +##################################################################################### +# Project: MakeBind +# File: mb_modules.mk +# Description: Module structure for MakeBind +# Author: AntonioCS +# License: MIT License +##################################################################################### +### NOTE: This file is autogenerated, do not edit it directly as it will be overwritten +### NOTE 2: Use mb/modules/list, mb/modules/add/[/], mb/modules/remove/[/] to manage your modules +### NOTE 3: If a module depends on another module, that module will automatically be added +mb_project_modules_loaded := docker docker_compose project_builder localstack diff --git a/tests/mock_project/bind-hub/mb_project.mk b/tests/mock_project/bind-hub/project.mk similarity index 100% rename from tests/mock_project/bind-hub/mb_project.mk rename to tests/mock_project/bind-hub/project.mk