-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
63 lines (52 loc) · 940 Bytes
/
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
/ := ./
include base.mk
BINS := date
BINS += expr
BINS += pwd
BINS += md5
BINS += kill
BINS += hostname
BINS += df
BINS += chio
BINS += ps
BINS += rm
BINS += echo
BINS += mkdir
BINS += rmdir
BINS += ed
BINS += ls
BINS += dd
BINS += domainname
BINS += cp
BINS += cat
BINS += ln
BINS += mv
BINS += chmod
BINS += sh
BINS += sleep
BINS += cksum
BINARIES := $(foreach b, $(BINS), src/$b/$b)
BINS-COPY := $(foreach b, $(BINS), bin/$b)
define make-rule
@ $(MAKE) -C $(1) $(2) --no-print-directory /=../../
endef
prop = $(foreach b, $(BINARIES), $(call make-rule, $(dir $b), $(1)))
.PHONY: all
all: $(BINS-COPY)
$(BINS-COPY): $(BINARIES)
@ mkdir -p $(dir $@)
$Q cp src/$(notdir $@)/$(notdir $@) $@
$(BINARIES):
$(call make-rule, $(dir $@), $(notdir $@))
.PHONY: clean
clean:
$(call prop, clean)
@ $(LOG_TIME) $@
.PHONY: fclean
fclean:
$(call prop, fclean)
$(RM) -r bin
@ $(LOG_TIME) $@
.PHONY: re
.NOTPARALLEL: re
re: fclean all