-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
138 lines (117 loc) · 3.32 KB
/
Makefile
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
137
138
.POSIX:
.SILENT: cattle cattle-ascii-art default emus-ascii-art .git/info/exclude pet \
pet-ascii-art
GIT_INFO_EXCLUDE = .git/info/exclude
GIT_EXCLUDE_PATTERNS = \
core/*-*[0-9] \
core/*-patches \
core/*-src \
core/*.tar.* \
core/makefile \
core/common \
core/GNUmakefile \
core/gnupghome \
core/libevent* \
core/utilities/bin \
desktop-environment/*-src \
desktop-environment/bin \
desktop-environment/screen-locker/screen-locker \
platform/bin/* \
PLATFORM = $$(uname -s -m | tr "A-Z " "a-z-" | sed "s/x86_64/amd64/g")
PRECOMPILED_BINARIES = https://www.codevat.com/downloads/emus-core-$(PLATFORM)
default: ascii-art-mural
-tput bold 2>/dev/null
echo "Run \"make pet\" or \"make cattle\" to begin installation." >&2
-tput sgr0 2>/dev/null
exit 1
cattle: cattle-ascii-art
$(MAKE) install-precompiled-binaries
$(MAKE) user-configuration
pet: pet-ascii-art
case "$${uname:=$$(uname)}" in \
Darwin|FreeBSD|Linux) \
sudo $(MAKE) host-configuration; \
if [ "$$uname" != "Darwin" ]; then \
sudo $(MAKE) core-make-deps; \
fi; \
if command -v Xorg >/dev/null 2>&1; then \
sudo $(MAKE) desktop-environment-make-deps; \
$(MAKE) build-desktop-environment; \
$(MAKE) install-desktop-environment; \
fi; \
if [ "$$uname" = "Darwin" ]; then \
$(MAKE) core-make-deps; \
fi; \
;; \
OpenBSD) \
doas $(MAKE) host-configuration; \
doas $(MAKE) core-make-deps; \
;; \
esac
$(MAKE) $(GIT_INFO_EXCLUDE)
$(MAKE) build-core
$(MAKE) install-core
$(MAKE) platform-binaries
$(MAKE) user-configuration
install-precompiled-binaries:
trap 'cd / && rm -rf "$$tempdir"' EXIT; \
tempdir="$$(mktemp -d)"; \
mkdir "$$tempdir/.gpg"; \
export GNUPGHOME="$$tempdir/.gpg"; \
gpg --import "configuration/public-keys/eric-pruitt.asc"; \
cd "$$tempdir"; \
wget --max-redirect=0 $(PRECOMPILED_BINARIES); \
gpg --use-embedded-filename *; \
test ! -e *.xz || unxz *.xz; \
tar -x -f *.tar; \
cd */; \
$(MAKE)
git: $(GIT_INFO_EXCLUDE)
$(GIT_INFO_EXCLUDE): ALWAYS_RUN
(set -f && \
for pattern in $(GIT_EXCLUDE_PATTERNS); do \
for entry in $$(cat $@ 2>/dev/null); do \
test "$$entry" = "$$pattern" && continue 2; \
done; \
echo "$$pattern" >> $@; \
done)
touch $@
user-configuration:
(umask 0077 && cd configuration && $(MAKE) prepare && $(MAKE) user)
host-configuration:
(cd configuration && $(MAKE) host)
core-make-deps:
(cd core && $(MAKE) deps)
desktop-environment-make-deps:
(cd desktop-environment && $(MAKE) deps)
build-core:
(cd core && ./configure && $(MAKE))
install-core:
(cd core && $(MAKE) install)
platform-binaries:
(cd platform && $(MAKE))
build-desktop-environment:
(cd desktop-environment && $(MAKE))
install-desktop-environment:
(cd desktop-environment && $(MAKE) install)
ascii-art-mural: mural.txt
cat $?
# Delete the cat from the mural.
cattle-ascii-art: mural.txt
sed < $? \
-e '3s/|\\.*\\/ /' \
-e '4s/|o.* )/ /' \
-e '5s/_\..* \// /' \
-e '6s/((.*< \\/__ /' \
-e '7s/`.*(\// /'
# Delete the cow from the mural.
pet-ascii-art: mural.txt
sed < $? \
-e '3s/\^.*[?]/ /' \
-e '4s/([^ ]*_/ /' \
-e '5s/(_.*\\/ /' \
-e '6s/|.*|/ /' \
-e '7s/|| .*|/ /'
# Dummy target used to ensure a recipe is always executed even if it is
# otherwise up to date.
ALWAYS_RUN: