-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
55 lines (42 loc) · 1.23 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
PREFIX?=/usr/local
LOCALBASE?=/usr/local
GUEST_ROOT?=${LOCALBASE}/share/dockerbox
BINDIR=${DESTDIR}${PREFIX}/sbin
ETCDIR=${DESTDIR}${PREFIX}/etc
RCDIR=${ETCDIR}/rc.d
SHAREDIR=${DESTDIR}${PREFIX}/share
MANDIR=${DESTDIR}${PREFIX}/man
MKDIR=/bin/mkdir
SED=/usr/bin/sed
AWK=/usr/bin/awk
INSTALL=/usr/bin/install
ROUTE=/sbin/route
GREP=/usr/bin/grep
GIT=${LOCALBASE}/bin/git
.if !defined(VERSION)
VERSION!= ${GIT} describe --tags --always
.endif
SUB_LIST= PREFIX=${PREFIX} \
LOCALBASE=${LOCALBASE} \
VERSION=${VERSION} \
GUEST_ROOT=${GUEST_ROOT}
# Use route to get the IPv4 default interface
GATE!= ${ROUTE} -n get -inet default | ${GREP} 'interface:' | ${AWK} '{ print $$2 }'
.if empty(GATE)
GATE=ue0
.endif
SUB_LIST+= EXT_IF=${GATE}
_SUB_LIST_EXP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}
install:
${MKDIR} -p ${BINDIR}
${INSTALL} -m 0755 sbin/dockerbox ${BINDIR}/dockerbox
${MKDIR} -p ${ETCDIR}/dockerbox
${INSTALL} -m 0755 etc/dockerbox.conf ${ETCDIR}/dockerbox/dockerbox.conf
${SED} ${_SUB_LIST_EXP} etc/dockerbox.conf > ${ETCDIR}/dockerbox/dockerbox.conf
${MKDIR} -p ${RCDIR}
${INSTALL} -m 0755 rc.d/dockerbox ${RCDIR}/dockerbox
fetch-disk:
${BINDIR}/dockerbox fetch
.MAIN: clean
.PHONY: clean
clean: ;