forked from truenas/middleware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (110 loc) · 3.85 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
.if exists(build/hooks/Makefile)
.include "build/hooks/Makefile"
.endif
NANO_LABEL?=FreeNAS
VERSION?=9.2.2-ALPHA
BUILD_TIMESTAMP!=date '+%Y%m%d'
COMPANY?="iXsystems"
.ifdef SCRIPT
RELEASE_LOGFILE?=${SCRIPT}
.else
RELEASE_LOGFILE?=release.build.log
.endif
GIT_REPO_SETTING=.git-repo-setting
.if exists(${GIT_REPO_SETTING})
GIT_LOCATION!=cat ${GIT_REPO_SETTING}
.endif
ENV_SETUP=env NANO_LABEL=${NANO_LABEL} VERSION=${VERSION} GIT_LOCATION=${GIT_LOCATION} BUILD_TIMESTAMP=${BUILD_TIMESTAMP}
all: build
.BEGIN:
${ENV_SETUP} build/check_build_host.sh
.if !make(checkout) && !make(update) && !make(clean) && !make(distclean) && !make(git-internal) && !make(git-external)
${ENV_SETUP} build/check_sandbox.sh
.endif
build: git-verify
@[ `id -u` -eq 0 ] || (echo "Sorry, you must be running as root to build this."; exit 1)
@${ENV_SETUP} ${MAKE} portsjail
@${ENV_SETUP} ${MAKE} ports
${ENV_SETUP} build/do_build.sh
checkout: git-verify
${ENV_SETUP} build/do_checkout.sh
update: checkout
clean:
${ENV_SETUP} build/build_cleanup.py
rm -rf ${NANO_LABEL}-${VERSION}-* release.build.log
.if defined(USE_NEW_LAYOUT)
rm -rf ../obj
.else
rm -rf FreeBSD nas_source
.endif
clean-packages:
.if defined(USE_NEW_LAYOUT)
find ../obj/os-base -name "*.tbz" -delete
.else
find os-base -name "*.tbz" -delete
.endif
distclean: clean
.if defined(USE_NEW_LAYOUT)
rm -fr ../extra-src
.endif
save-build-env:
${ENV_SETUP} build/save_build.sh
freenas: release
release: git-verify
@echo "Doing executing target $@ on host: `hostname`"
@echo "Build directory: `pwd`"
${ENV_SETUP} script -a ${RELEASE_LOGFILE} ${MAKE} build
${ENV_SETUP} script -a ${RELEASE_LOGFILE} build/create_release_distribution.sh
rebuild:
@${ENV_SETUP} ${MAKE} checkout
@${ENV_SETUP} ${MAKE} all
@${ENV_SETUP) sh build/create_release_distribution.sh
cdrom:
${ENV_SETUP} sh -x build/create_iso.sh
truenas: git-verify
@[ "${GIT_LOCATION}" = "INTERNAL" ] || (echo "You can only run this target from an internal repository."; exit 1)
env NANO_LABEL=TrueNAS script -a ${RELEASE_LOGFILE} ${MAKE} build
mkdir -p TrueNAS-${VERSION}-${BUILD_TIMESTAMP}
.if defined(USE_NEW_LAYOUT)
mv ../obj/os-base/amd64/TrueNAS-${VERSION}-* TrueNAS-${VERSION}-${BUILD_TIMESTAMP}
.else
mv os-base/amd64/TrueNAS-${VERSION}-* TrueNAS-${VERSION}-${BUILD_TIMESTAMP}
.endif
# Build truenas using all sources
truenas-all-direct:
${ENV_SETUP} TESTING_TRUENAS=1 NAS_PORTS_DIRECT=1 $(MAKE) all
# intentionally split up to prevent abuse/spam
BUILD_BUG_DOMAIN?=ixsystems.com
BUILD_BUG_USER?=build-bugs
BUILD_BUG_EMAIL?=${BUILD_BUG_USER}@${BUILD_BUG_DOMAIN}
build-bug-report:
mail -s "build fail for $${SUDO_USER:-$$USER}" ${BUILD_BUG_EMAIL} < \
${RELEASE_LOGFILE}
git-verify:
@if [ ! -f ${GIT_REPO_SETTING} ]; then \
echo "No git repo choice is set. Please use \"make git-external\" to build as an"; \
echo "external developer or \"make git-internal\" to build as an ${COMPANY}"; \
echo "internal developer. You only need to do this once."; \
exit 1; \
fi
@echo "NOTICE: You are building from the ${GIT_LOCATION} git repo."
git-internal:
@echo "INTERNAL" > ${GIT_REPO_SETTING}
@echo "You are set up for internal (${COMPANY}) development. You can use"
@echo "the standard make targets (e.g. build or release) now."
git-external:
@echo "EXTERNAL" > ${GIT_REPO_SETTING}
@echo "You are set up for external (github) development. You can use"
@echo "the standard make targets (e.g. build or release) now."
tag:
${ENV_SETUP} build/apply_tag.sh
ports:
@[ `id -u` -eq 0 ] || (echo "Sorry, you must be running as root to build this."; exit 1)
${ENV_SETUP} build/ports/create-poudriere-conf.sh
${ENV_SETUP} build/ports/create-poudriere-make.conf.sh
${ENV_SETUP} build/ports/prepare-jail.sh
${ENV_SETUP} build/ports/fetch-ports-srcs.sh
${ENV_SETUP} build/ports/create-ports-list.sh
${ENV_SETUP} build/ports/build-ports.sh
portsjail:
${ENV_SETUP} build/build_jail.sh