-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
73 lines (58 loc) · 2.14 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
# Install musl, libressl and s6 packages {{{1
#
# See also:
# https://www.gnu.org/software/make/manual/
# https://www.gnu.org/software/bash/manual/
include config.mak # {{{1
$(info - LOCAL_MACHINE $(LOCAL_MACHINE), MAKE_J $(MAKE_J))
# PACKAGES and URLs {{{1
PACKAGES := $(basename $(basename $(basename \
$(shell cd hashes; for h in *; do echo $$h; done))))
MUSL := $(filter musl-%, $(PACKAGES))
LIBRESSL := $(filter libressl-%, $(PACKAGES))
SKALIBS := $(filter skalibs-%, $(PACKAGES))
NSSS := $(filter nsss-%, $(PACKAGES))
UTMPS := $(filter utmps-%, $(PACKAGES))
PACKAGES := $(MUSL) $(LIBRESSL) $(SKALIBS) $(NSSS) $(UTMPS) \
$(filter-out utmps-%, \
$(filter-out nsss-%, \
$(filter-out skalibs-%, \
$(filter-out libressl-%, \
$(filter-out musl-%, $(PACKAGES))))))
MUSL_URL := http://musl.libc.org/releases
LIBRESSL_URL := https://ftp.openbsd.org/pub/OpenBSD/LibreSSL
S6_URL := http://www.skarnet.org/software
it: # the default goal {{{1
clean:
rm -rf $(PACKAGES) *.build sources
sources: # {{{2
mkdir -p $@
# Target-specific variable URL {{{2
sources/%: URL=$(S6_URL)/$(subst $(SPACE),-,$(strip \
$(filter-out %.gz,$(subst -, ,$(notdir $@)))))
$(patsubst hashes/%.sha1,sources/%,$(wildcard hashes/musl*)): URL=$(MUSL_URL)
$(patsubst hashes/%.sha1,sources/%,$(wildcard hashes/libressl*)): URL=$(LIBRESSL_URL)
sources/%: hashes/%.sha1 | sources # {{{2
rm -rf [email protected]; mkdir -p [email protected]
cd [email protected]; $(DL_CMD) $(notdir $@) $(URL)/$(notdir $@) && touch $(notdir $@)
[ -n '$(SKIP_SHASUM)' ] || \
{ cd [email protected]; sha1sum -c $(CURDIR)/hashes/$(notdir $@).sha1; }
mv [email protected]/$(notdir $@) $@ && rm -rf [email protected]
%.build: sources/%.tar.gz # {{{2
rm -rf [email protected]; mkdir -p [email protected]
( cd [email protected]; tar zxvf - ) < $<
rm -rf $@
touch [email protected]/$(patsubst %.build,%,$@)
mv [email protected]/$(patsubst %.build,%,$@) $@
rm -rf [email protected]
# Target-specific variable PKG_NAME, can have '-' inside {{{2
%: PKG_NAME = $(subst $(SPACE),-,$(strip \
$(filter-out %.0 %.1 %.2 %.3 %.4 %.5,$(subst -, ,$@))))
%: %.build # {{{2
$(MAKE) -f $(PKG_NAME).mak BUILD_DIR=$<
touch $@
it: | $(PACKAGES) # {{{2
@echo '- $@: order-only prerequisites: $|'
# }}}2
# No intermediate targets to remove {{{1
.SECONDARY: