forked from xblax/flashforge_ad5m_klipper_mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
136 lines (112 loc) · 4 KB
/
Makefile
File metadata and controls
136 lines (112 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Top Level Makefile for Flashfore AD5M Klipper Mod
SHELL := /bin/bash
BUILD := build_scripts/build.sh
VARIANTS = lite klipperscreen guppyscreen
CONFIGS_DIR := build_scripts/buildroot/configs
AVAILABLE_PLUGINS := $(patsubst $(CONFIGS_DIR)/plugin-%,%,$(wildcard $(CONFIGS_DIR)/plugin-*))
PLUGINS = $(strip $(WITH_PLUGINS))
INVALID_PLUGINS = $(filter-out $(AVAILABLE_PLUGINS), $(PLUGINS))
ifneq ($(INVALID_PLUGINS),)
$(error Unknown plugins: $(INVALID_PLUGINS))
endif
all: packages checksums
packages: sdk $(VARIANTS) uninstall
# SDK targets
sdk: sdk_package
sdk_prepare:
$(BUILD) prepare_sdk
sdk_build: sdk_prepare
$(BUILD) build_sdk
sdk_rebuild: sdk_prepare
$(BUILD) rebuild_sdk
sdk_package: sdk_build
$(BUILD) package_sdk
sdk_clean:
$(BUILD) clean_sdk
# Variant targets
define VARIANT_RULES
$(1): $(1)_package
$(1)_prepare:
$(BUILD) prepare_variant $(1)
$(1)_build: sdk_build $(1)_prepare
$(BUILD) build_variant $(1)
$(1)_rebuild: sdk_build $(1)_prepare
$(BUILD) rebuild_variant $(1)
$(1)_package: $(1)_build
$(BUILD) package_variant $(1)
$(1)_clean:
$(BUILD) clean_variant $(1)
endef
$(foreach variant,$(VARIANTS),$(eval $(call VARIANT_RULES,$(variant))))
# Misc targets
uninstall: uninstall_package
uninstall_package:
$(BUILD) package_uninstall
checksums: packages
$(BUILD) checksums
# Helper targets
.PHONY: help
help:
@echo "Flashforge AD5M Klipper Mod Build System"
@echo "========================================"
@echo ""
@echo "DESCRIPTION:"
@echo " This build system creates KlipperMod packages for Flashforge AD5M printers."
@echo " It supports multiple variants and optional plugins that can be embedded"
@echo " into the build through configuration fragments."
@echo ""
@echo "AVAILABLE VARIANTS:"
@echo " $(VARIANTS)"
@echo ""
@echo "AVAILABLE PLUGINS:"
@echo " $(AVAILABLE_PLUGINS)"
@echo ""
@echo "MAIN TARGETS:"
@echo " all - Build all variants and create packages with checksums"
@echo " packages - Build SDK, all variants, and uninstall package"
@echo " checksums - Generate MD5 checksums for all packages"
@echo " sdk - Build SDK package only"
@echo " <variant> - Build specific variant ($(VARIANTS))"
@echo " uninstall - Create uninstall package"
@echo ""
@echo "PLUGIN USAGE:"
@echo " Plugins are embedded into variants using the WITH_PLUGINS parameter."
@echo " Multiple plugins can be specified as a space-separated list."
@echo ""
@echo "EXAMPLES:"
@echo " # Build all variants without plugins"
@echo " make"
@echo ""
@echo " # Build all variants with specific plugins"
@echo " make WITH_PLUGINS=\"shaketune moonraker_tg\""
@echo ""
@echo " # Build specific variant without plugins"
@echo " make klipperscreen"
@echo ""
@echo " # Build specific variant with plugins"
@echo " make klipperscreen WITH_PLUGINS=\"shaketune\""
@echo ""
@echo " # Build without any plugins (empty string)"
@echo " make WITH_PLUGINS=\"\""
@echo ""
@echo " # Build multiple variants with different plugins"
@echo " make klipperscreen WITH_PLUGINS=\"shaketune moonraker_tg\""
@echo " make guppyscreen WITH_PLUGINS=\"shaketune\""
@echo ""
@echo "CLEAN TARGETS:"
@echo " sdk_clean - Clean SDK build directory"
@echo " <variant>_clean - Clean specific variant build directory"
@echo ""
@echo "REBUILD TARGETS:"
@echo " sdk_rebuild - Force rebuild SDK"
@echo " <variant>_rebuild - Force rebuild specific variant"
@echo ""
@echo "UTILITY TARGETS:"
@echo " help - Show this help message"
@echo ""
@echo "NOTES:"
@echo " - Plugins are automatically detected from build_scripts/buildroot/configs/plugin-*"
@echo " - Each plugin+variant combination creates a separate build directory"
@echo " - Package names include plugin information for easy identification"
@echo " - Build directories: variant-<name>[-<plugin1>-<plugin2>...]"
@echo " - Package names: Adventurer5M-KlipperMod-<version>-<variant>[-<plugin1>-<plugin2>...].tgz"