-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (68 loc) · 1.51 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
#
# Makefile for Unibuild
#
ifdef RELEASE
UNIBUILD_OPTS += --release
endif
UNIBUILD=./unibuild/unibuild/libexec/unibuild $(UNIBUILD_OPTS)
ifdef START
UNIBUILD_BUILD_OPTS += --start $(START)
endif
ifdef STOP
UNIBUILD_BUILD_OPTS += --stop $(STOP)
endif
BUILD_LOG=unibuild-log
TO_CLEAN += $(BUILD_LOG)
REPO=unibuild-repo
TO_CLEAN += $(REPO)
default: $(REPO)
# Figure out what needs to be run to get root.
ifeq ($(shell id -u),0)
RUN_AS_ROOT :=
else
RUN_AS_ROOT := sudo
endif
# Figure out what this system has for installing packages.
ifneq ($(wildcard /etc/redhat-release),)
ifneq ($(shell command -v dnf),)
PACKAGE_INSTALLER := dnf
else ifneq ($(shell command -v yum),)
PACKAGE_INSTALLER := yum
endif
else ifneq ($(wildcard /etc/debian_version),)
PACKAGE_INSTALLER := apt-get
else
$(error "No support on this distribution.")
endif
build:
ifeq ($(PACKAGE_INSTALLER),apt-get)
$(RUN_AS_ROOT) $(PACKAGE_INSTALLER) update
endif
ifneq ($(PACKAGE_INSTALLER),apt-get)
$(RUN_AS_ROOT) $(PACKAGE_INSTALLER) install -y createrepo
endif
$(RUN_AS_ROOT) $(PACKAGE_INSTALLER) install -y m4
(((( \
$(UNIBUILD) build $(UNIBUILD_BUILD_OPTS) ; \
echo $$? >&3 \
) \
| tee $(BUILD_LOG) >&4) 3>&1) \
| (read XS; exit $$XS) \
) 4>&1
$(UNIBUILD)
release:
RELEASE=1 $(MAKE)
$(REPO): build
(((( \
mkdir -p $@ ; \
$(UNIBUILD) gather $$(readlink -e '$@') ;\
echo $$? >&3 \
) \
| tee -a $(BUILD_LOG) >&4) 3>&1) \
| (read XS; exit $$XS) \
) 4>&1
clean:
$(UNIBUILD) $@
rm -rf $(TO_CLEAN)
todo:
fgrep -r TODO .