-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathMakefile.guided
More file actions
71 lines (60 loc) · 2.38 KB
/
Makefile.guided
File metadata and controls
71 lines (60 loc) · 2.38 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
# Guided Menu Makefile
# Targets used by scripts/menu/menu2-guided.sh and scripts/menu/main-menu.sh
EDITOR := $(shell which nano vim vi ed 2>/dev/null | head -1)
# Helper function for editing files
define edit_file
$(info -------------------------------- $(1))
@if [ -z "$(EDITOR)" ]; then \
echo "No suitable editor found!"; \
exit 1; \
else \
$(EDITOR) $(2); \
fi
endef
# Device selection (currently non-functional placeholder)
# This target should be implemented to provide interactive device selection
select-device:
$(info -------------------------------- $@)
@echo "Device selection not implemented"
@echo "Please set BOARD variable manually or use main-menu.sh"
# Interactive edit menu
edit:
@bash -c 'while true; do \
CHOICE=$$(dialog --keep-tite --colors --title "Edit Menu" --menu "Choose an option to edit:" 16 60 10 \
"1" "Camera Config (edit-defconfig)" \
"2" "System Config (edit-config)" \
"3" "Camera U-Boot Environment (edit-uenv)" \
"" "━━━━━━━━━ LOCAL OVERRIDES ━━━━━━━━━" \
"4" "Local Fragment (edit-localfragment)" \
"5" "Local Makefile (edit-localmk)" \
"6" "Local U-Boot Evironment (edit-localuenv)" 2>&1 >/dev/tty) || exit 0; \
\
[ -z "$$CHOICE" ] && continue; \
\
case "$$CHOICE" in \
"1") FILE="$(CAMERA_CONFIG_REAL)" ;; \
"2") FILE="$(BR2_EXTERNAL)/$(CAMERA_SUBDIR)/$(CAMERA)/$(CAMERA).config" ;; \
"3") FILE="$(BR2_EXTERNAL)/$(CAMERA_SUBDIR)/$(CAMERA)/$(CAMERA).uenv.txt" ;; \
"4") FILE="$(THINGINO_USER_DIR)/local.fragment" ;; \
"5") FILE="$(BR2_EXTERNAL)/local.mk" ;; \
"6") FILE="$(THINGINO_USER_DIR)/local.uenv.txt" ;; \
*) echo "Invalid option"; continue ;; \
esac; \
\
[ -z "$(EDITOR)" ] && { echo "No suitable editor found!"; exit 1; } || { $(EDITOR) "$$FILE"; break; }; \
done'
# Individual edit targets
edit-defconfig:
$(call edit_file,$@,$(CAMERA_CONFIG_REAL))
edit-config:
$(call edit_file,$@,$(BR2_EXTERNAL)/$(CAMERA_SUBDIR)/$(CAMERA)/$(CAMERA).config)
edit-uenv:
$(call edit_file,$@,$(BR2_EXTERNAL)/$(CAMERA_SUBDIR)/$(CAMERA)/$(CAMERA).uenv.txt)
edit-localmk:
$(call edit_file,$@,$(BR2_EXTERNAL)/local.mk)
edit-localfragment:
$(call edit_file,$@,$(THINGINO_USER_DIR)/local.fragment)
edit-localuenv:
$(call edit_file,$@,$(THINGINO_USER_DIR)/local.uenv.txt)
.PHONY: edit edit-defconfig edit-module edit-config edit-uenv \
edit-localmk edit-localfragment edit-localuenv