-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (96 loc) · 3.85 KB
/
Makefile
File metadata and controls
120 lines (96 loc) · 3.85 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
EXECUTABLES = bin/minios-kernel-manager bin/minios-kernel
LIBRARIES = lib/*.py
APPLICATIONS = share/applications/minios-kernel-manager.desktop
POLICIES = share/polkit/dev.minios.kernel-manager.policy
STYLES = share/styles/style.css
COMPLETIONS = completion/minios-kernel
BINDIR = usr/bin
LIBDIR = usr/lib/minios-kernel-manager
APPLICATIONSDIR = usr/share/applications
POLKITACTIONSDIR = usr/share/polkit-1/actions
LOCALEDIR = usr/share/locale
SHAREDIR = usr/share/minios-kernel-manager
COMPLETIONDIR = usr/share/bash-completion/completions
PO_FILES = $(shell find po -maxdepth 1 -name "*.po")
MO_FILES = $(patsubst %.po,%.mo,$(PO_FILES))
build: mo
mo: $(MO_FILES)
update-po:
@echo "Updating translation files..."
./update-po.sh
%.mo: %.po
@echo "Generating mo file for $<"
msgfmt -o $@ $<
chmod 644 $@
clean:
rm -rf $(MO_FILES)
install: build
install -d $(DESTDIR)/$(BINDIR) \
$(DESTDIR)/$(LIBDIR) \
$(DESTDIR)/$(APPLICATIONSDIR) \
$(DESTDIR)/$(POLKITACTIONSDIR) \
$(DESTDIR)/$(LOCALEDIR) \
$(DESTDIR)/$(SHAREDIR) \
$(DESTDIR)/$(COMPLETIONDIR)
cp $(EXECUTABLES) $(DESTDIR)/$(BINDIR)/
cp $(LIBRARIES) $(DESTDIR)/$(LIBDIR)/
chmod +x $(DESTDIR)/$(LIBDIR)/minios_kernel_manager.py
chmod +x $(DESTDIR)/$(LIBDIR)/minios_kernel.py
cp $(APPLICATIONS) $(DESTDIR)/$(APPLICATIONSDIR)
cp $(POLICIES) $(DESTDIR)/$(POLKITACTIONSDIR)
cp $(STYLES) $(DESTDIR)/$(SHAREDIR)
cp $(COMPLETIONS) $(DESTDIR)/$(COMPLETIONDIR)/
@for MO_FILE in $(MO_FILES); do \
LOCALE=$$(basename $$MO_FILE .mo); \
echo "Copying mo file $$MO_FILE to $(DESTDIR)/usr/share/locale/$$LOCALE/LC_MESSAGES/minios-kernel-manager.mo"; \
install -Dm644 "$$MO_FILE" "$(DESTDIR)/usr/share/locale/$$LOCALE/LC_MESSAGES/minios-kernel-manager.mo"; \
done
uninstall:
@echo "Uninstalling MiniOS Kernel Manager..."
# Remove executables
rm -f $(DESTDIR)/$(BINDIR)/minios-kernel-manager
rm -f $(DESTDIR)/$(BINDIR)/minios-kernel
# Remove library directory
rm -rf $(DESTDIR)/$(LIBDIR)
# Remove desktop file
rm -f $(DESTDIR)/$(APPLICATIONSDIR)/minios-kernel-manager.desktop
# Remove PolicyKit policy
rm -f $(DESTDIR)/$(POLKITACTIONSDIR)/dev.minios.kernel-manager.policy
# Remove shared directory
rm -rf $(DESTDIR)/$(SHAREDIR)
# Remove translations
@for MO_FILE in $(MO_FILES); do \
LOCALE=$$(basename $$MO_FILE .mo); \
echo "Removing translation file for locale $$LOCALE"; \
rm -f "$(DESTDIR)/usr/share/locale/$$LOCALE/LC_MESSAGES/minios-kernel-manager.mo"; \
rmdir "$(DESTDIR)/usr/share/locale/$$LOCALE/LC_MESSAGES" 2>/dev/null || true; \
rmdir "$(DESTDIR)/usr/share/locale/$$LOCALE" 2>/dev/null || true; \
done
# Remove man page (if installed by debhelper)
rm -f $(DESTDIR)/usr/share/man/man1/minios-kernel-manager.1*
# Remove lintian overrides (if installed by debhelper)
rm -f $(DESTDIR)/usr/share/lintian/overrides/minios-kernel-manager
# Remove bash completion
rm -f $(DESTDIR)/$(COMPLETIONDIR)/minios-kernel
@echo "MiniOS Kernel Manager uninstalled successfully"
reinstall: uninstall install
@echo "MiniOS Kernel Manager reinstalled successfully"
help:
@echo "MiniOS Kernel Manager - Available targets:"
@echo ""
@echo " build - Build translation files (.mo)"
@echo " clean - Remove built files (.mo)"
@echo " install - Install to DESTDIR (default: /)"
@echo " uninstall - Remove installed files from DESTDIR"
@echo " reinstall - Uninstall and install again"
@echo " update-po - Update translation template and files"
@echo " help - Show this help message"
@echo ""
@echo "Variables:"
@echo " DESTDIR - Installation prefix (default: /)"
@echo ""
@echo "Examples:"
@echo " make install DESTDIR=/tmp/test # Install to test directory"
@echo " make uninstall # Remove from system"
@echo " sudo make reinstall # Reinstall as root"
.PHONY: build mo update-po clean install uninstall reinstall help