11# Variables
22SCHEMA_SRC_DIR := src
33OUTPUT_DIR := output
4- DOCS_DIR := docs
4+ DOCS_OUTPUT_DIR := $(OUTPUT_DIR ) /docs
5+ SCHEMAS_OUTPUT_DIR := $(OUTPUT_DIR ) /schemas
56SCRIPTS_DIR := scripts
67YAML_TO_JSON_SCRIPT := $(SCRIPTS_DIR ) /yaml_to_json.py
78GENERATE_DOCS_SCRIPT := $(SCRIPTS_DIR ) /generate_docs.py
9+ GENERATE_DOCS_ALL_SCRIPT := $(SCRIPTS_DIR ) /generate_docs_all.py
10+ GENERATE_DOCS_YAML_SCRIPT := $(SCRIPTS_DIR ) /generate_docs_yaml.py
11+ GENERATE_DOCS_MD_SCRIPT := $(SCRIPTS_DIR ) /generate_docs_markdown.py
812YAML_SCHEMAS := $(shell find $(SCHEMA_SRC_DIR ) -name "* .schema.yaml" -type f)
913JSON_OUTPUTS := $(patsubst $(SCHEMA_SRC_DIR ) /% .schema.yaml,$(OUTPUT_DIR ) /% .schema.json,$(YAML_SCHEMAS ) )
1014
1115# Default target
12- .PHONY : all clean build build-schemas convert-schemas config check-deps build-docs
16+ .PHONY : all clean build build-schemas convert-schemas config check-deps build-docs build-docs-yaml build-docs-md build-docs-legacy
1317
1418all : build
1519
@@ -32,56 +36,87 @@ check-deps:
3236 @python3 -c " import yaml" 2> /dev/null || \
3337 (echo " PyYAML not found. Run 'make config' to install dependencies." && exit 1)
3438
35- # Convert all YAML schemas to JSON
39+ # Convert all YAML schemas to JSON (standalone - puts JSON files in schemas subdirectory)
3640convert-schemas : check-deps $(OUTPUT_DIR )
3741 @echo " Converting YAML schemas to JSON..."
42+ @mkdir -p " $( SCHEMAS_OUTPUT_DIR) "
3843 @for yaml_file in $(YAML_SCHEMAS ) ; do \
3944 relative_path=$$ {yaml_file#$(SCHEMA_SRC_DIR ) /}; \
40- output_file=" $( OUTPUT_DIR ) /$$ {relative_path%.schema.yaml}.schema.json" ; \
45+ output_file=" $( SCHEMAS_OUTPUT_DIR ) /$$ {relative_path%.schema.yaml}.schema.json" ; \
4146 output_dir=$$(dirname "$$output_file" ) ; \
4247 mkdir -p " $$ output_dir" ; \
4348 echo " Converting $$ yaml_file to $$ output_file" ; \
4449 python3 $(YAML_TO_JSON_SCRIPT ) " $$ yaml_file" " $$ output_file" ; \
4550 done
4651
47- # Build all schemas
52+ # Build all schemas (standalone - just JSON conversion)
4853build-schemas : convert-schemas
4954 @echo " Building schemas complete!"
5055 @echo " Found $( words $( YAML_SCHEMAS) ) YAML schema(s):"
5156 @for schema in $(YAML_SCHEMAS ) ; do echo " - $$ schema" ; done
52- @echo " Generated JSON schemas in $( OUTPUT_DIR ) /"
57+ @echo " Generated JSON schemas in $( SCHEMAS_OUTPUT_DIR ) /"
5358
5459# Build everything (schemas and docs)
55- build : build-schemas build- docs
56- @echo " Build complete! Generated JSON schemas and documentation. "
60+ build : build-docs
61+ @echo " Build complete! Generated JSON schemas and documentation in $( OUTPUT_DIR ) / "
5762
58- # Generate documentation from schemas
63+ # Generate documentation from schemas (new two-stage approach)
64+ # This now includes JSON schema conversion as part of the documentation package
5965build-docs : check-deps
60- @echo " Generating documentation from YAML schemas..."
61- @python3 $(GENERATE_DOCS_SCRIPT ) $(SCHEMA_SRC_DIR ) $(DOCS_DIR )
62- @echo " Documentation generated in $( DOCS_DIR) /"
66+ @echo " Generating complete documentation package from YAML schemas..."
67+ @python3 $(GENERATE_DOCS_ALL_SCRIPT ) $(SCHEMA_SRC_DIR ) $(OUTPUT_DIR )
68+ @echo " Documentation package generated in $( OUTPUT_DIR) /"
69+ @echo " - JSON Schemas: $( SCHEMAS_OUTPUT_DIR) /"
70+ @echo " - YAML docs: $( DOCS_OUTPUT_DIR) /yaml/"
71+ @echo " - Markdown docs: $( DOCS_OUTPUT_DIR) /md/"
72+
73+ # Generate only YAML documentation (for tool consumption)
74+ build-docs-yaml : check-deps
75+ @echo " Generating YAML documentation from schemas..."
76+ @python3 $(GENERATE_DOCS_YAML_SCRIPT ) $(SCHEMA_SRC_DIR ) $(DOCS_OUTPUT_DIR ) /yaml
77+ @echo " YAML documentation generated in $( DOCS_OUTPUT_DIR) /yaml/"
78+
79+ # Generate only Markdown documentation (from existing YAML docs)
80+ build-docs-md : check-deps
81+ @echo " Generating Markdown documentation from YAML docs..."
82+ @test -d " $( DOCS_OUTPUT_DIR) /yaml" || (echo " Error: YAML docs not found. Run 'make build-docs-yaml' first." && exit 1)
83+ @python3 $(GENERATE_DOCS_MD_SCRIPT ) $(DOCS_OUTPUT_DIR ) /yaml $(DOCS_OUTPUT_DIR ) /md
84+ @echo " Markdown documentation generated in $( DOCS_OUTPUT_DIR) /md/"
85+
86+ # Generate documentation using legacy single-stage approach
87+ build-docs-legacy : check-deps
88+ @echo " Generating documentation using legacy approach..."
89+ @python3 $(GENERATE_DOCS_SCRIPT ) $(SCHEMA_SRC_DIR ) docs_legacy
90+ @echo " Legacy documentation generated in docs_legacy/"
6391
6492# Clean output directory
6593clean :
66- @echo " Cleaning output and docs directories..."
67- @rm -rf $(OUTPUT_DIR ) $( DOCS_DIR )
94+ @echo " Cleaning output directories..."
95+ @rm -rf $(OUTPUT_DIR ) docs_legacy
6896 @echo " Clean complete!"
6997
7098# Show help
7199help :
72100 @echo " Available targets:"
73- @echo " all - Build everything (schemas + docs) (default)"
74- @echo " build - Build everything (schemas + docs)"
75- @echo " build-schemas - Convert YAML schemas from src/ to JSON in output/ (preserving folder structure)"
76- @echo " build-docs - Generate Markdown documentation from YAML schemas"
77- @echo " config - Setup dependencies (Python, PyYAML)"
78- @echo " list - List all YAML schema files that would be processed"
79- @echo " clean - Remove output and docs directories"
80- @echo " help - Show this help message"
101+ @echo " all - Build everything (complete documentation package) (default)"
102+ @echo " build - Build everything (complete documentation package)"
103+ @echo " build-schemas - Convert YAML schemas to JSON only (in output/schemas/)"
104+ @echo " build-docs - Generate complete documentation package (JSON + YAML + Markdown docs)"
105+ @echo " build-docs-yaml - Generate only YAML documentation (for tool consumption)"
106+ @echo " build-docs-md - Generate only Markdown documentation (requires YAML docs)"
107+ @echo " build-docs-legacy - Generate documentation using legacy single-stage approach"
108+ @echo " config - Setup dependencies (Python, PyYAML)"
109+ @echo " list - List all YAML schema files that would be processed"
110+ @echo " clean - Remove output directories"
111+ @echo " help - Show this help message"
81112 @echo " "
82113 @echo " Source schemas are looked for in: $( SCHEMA_SRC_DIR) /"
83- @echo " Output JSON files are generated in: $( OUTPUT_DIR) / (with preserved folder structure)"
84- @echo " Documentation files are generated in: $( DOCS_DIR) / (with preserved folder structure)"
114+ @echo " Output structure:"
115+ @echo " $( OUTPUT_DIR) /"
116+ @echo " ├── docs/"
117+ @echo " │ ├── yaml/ # YAML documentation files"
118+ @echo " │ └── md/ # Markdown documentation files"
119+ @echo " └── schemas/ # JSON schema files (converted from YAML)"
85120
86121# List all YAML schema files
87122list :
0 commit comments