# h4tch/monsterbs architecture

> Architecture diagram of the GitHub repository h4tch/monsterbs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/h4tch/monsterbs
- Repository: https://github.com/h4tch/monsterbs

## Overview

##### Main Components

a) Core System Components:
- Project Definition Layer (Project.mk)
- Build System Generator (MonsterBS.sh)
- Build Configuration Layer (Make-based system)
- Platform-Specific Build Tools
- Output Generation System

b) Supporting Tools:
- Documentation Generator (Doxygen)
- Code Analysis Tools (LinesOfCode.pl)
- Platform Launchers
- Installation Tools

##### Component Relationships and Flow

**[Project Definition] → [Build System Generator] → [Generated Project Structure]**
- ↓
**[Platform-Specific Tools] ←→ [Build Configuration] → [Build Outputs]**

##### Key Flows to Highlight

a) Project Generation Flow:
- Project.mk file input
- MonsterBS.sh processing
- Generated project structure output

b) Build Process Flow:
- Make-based compilation
- Cross-platform building
- Output organization

##### Important Elements

a) Input/Output Relationships:
- How Project.mk variables flow into generated scripts
- Where platform-specific configurations are applied
- Demonstrate the build profile selection process

b) Cross-Platform Support:
- Windows build chain
- Linux/Mac build chain
- Android build support

##### Supporting Features

- Documentation generation flow
- Installation packaging process
- Test build system
- Header dependency generation

##### Notes for Implementation

- The modularity of the build system
- The separation between project definition and build implementation
- The cross-platform nature of the system
- The extensibility of the build profiles

- Variable substitution mechanism ($$VARIABLE_NAME)
- Build profile inheritance
- Out-of-source tree build structure
- Library and header installation paths

- Clear hierarchical layouts
- Export to common formats

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Project Layer"
        PD["Project Definition"]:::core
        PD_MK["Project.mk"]:::file
        PD --> PD_MK
    end

    subgraph "Build System Core"
        BSG["Build System Generator"]:::core
        BSG_SH["MonsterBS.sh"]:::file
        BSG --> BSG_SH
    end

    subgraph "Build Configuration"
        BC["Build Configuration Layer"]:::core
        MF["Makefile"]:::file
        PMF["Project Makefile"]:::file
        BC --> MF
        BC --> PMF
    end

    subgraph "Platform-Specific Tools"
        direction TB
        PST["Platform Tools"]:::platform
        
        subgraph "Android Tools"
            ABT["Android Build Tools"]:::android
            AAPK["Build APK Script"]:::file
            APJ["Android Project Script"]:::file
            AMK["Android.mk"]:::file
            ASM["Android Standalone"]:::file
            ABT --> AAPK
            ABT --> APJ
            ABT --> AMK
            ABT --> ASM
        end

        subgraph "Platform Launchers"
            PL["Launchers"]:::platform
            LL["Linux Launcher"]:::file
            WL["Windows Launcher"]:::file
            GL["Generate Linux Launcher"]:::file
            PL --> LL
            PL --> WL
            PL --> GL
        end

        PST --> ABT
        PST --> PL
    end

    subgraph "Supporting Tools"
        direction TB
        ST["Support Tools"]:::support
        
        DG["Documentation Generator"]:::tool
        DF["Doxyfile"]:::file
        DG --> DF

        CA["Code Analysis"]:::tool
        LOC["LinesOfCode.pl"]:::file
        CA --> LOC

        IT["Installation Tools"]:::tool
        IN["Installer Script"]:::file
        IT --> IN

        WST["Windows Tools"]:::tool
        CGM["Compile Glew MinGW"]:::file
        WST --> CGM

        SDL["SDL2 Configuration"]:::tool
        SDLM["SDL2Libs.mk"]:::file
        SDL --> SDLM

        AC["Application Config"]:::tool
        ACM["Application.mk"]:::file
        AC --> ACM

        ST --> DG
        ST --> CA
        ST --> IT
        ST --> WST
        ST --> SDL
        ST --> AC
    end

    PD --> BSG
    BSG --> BC
    BC --> PST
    BC --> ST

    %% Click Events
    click PD_MK "https://github.com/H4tch/MonsterBS/blob/master/Project.mk"
    click BSG_SH "https://github.com/H4tch/MonsterBS/blob/master/MonsterBS.sh"
    click MF "https://github.com/H4tch/MonsterBS/tree/master/Makefile"
    click PMF "https://github.com/H4tch/MonsterBS/tree/master/tools/ProjectMakefile"
    click AAPK "https://github.com/H4tch/MonsterBS/blob/master/tools/AndroidBuildAPK.sh"
    click APJ "https://github.com/H4tch/MonsterBS/blob/master/tools/AndroidProject.sh"
    click AMK "https://github.com/H4tch/MonsterBS/blob/master/tools/Android.mk"
    click ASM "https://github.com/H4tch/MonsterBS/blob/master/tools/AndroidStandalone.mk"
    click LL "https://github.com/H4tch/MonsterBS/blob/master/tools/LaunchOnLinux.sh"
    click WL "https://github.com/H4tch/MonsterBS/blob/master/tools/LaunchOnWindows.bat"
    click GL "https://github.com/H4tch/MonsterBS/blob/master/tools/GenerateLinuxLauncher.sh"
    click DF "https://github.com/H4tch/MonsterBS/tree/master/tools/Doxyfile"
    click LOC "https://github.com/H4tch/MonsterBS/blob/master/tools/LinesOfCode.pl"
    click IN "https://github.com/H4tch/MonsterBS/blob/master/tools/Installer.nsh"
    click CGM "https://github.com/H4tch/MonsterBS/blob/master/tools/CompileGlewForMingW.sh"
    click SDLM "https://github.com/H4tch/MonsterBS/blob/master/tools/SDL2Libs.mk"
    click ACM "https://github.com/H4tch/MonsterBS/blob/master/tools/Application.mk"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef platform fill:#e67e22,stroke:#d35400,color:white
    classDef android fill:#e74c3c,stroke:#c0392b,color:white
    classDef tool fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef support fill:#2ecc71,stroke:#27ae60,color:white
    classDef file fill:#ecf0f1,stroke:#bdc3c7,color:black
```
