2014-07-20 08:27:47 +00:00
|
|
|
# Config options
|
2015-11-26 22:10:18 +00:00
|
|
|
PROFILE ?= debug
|
2015-12-25 05:45:23 +00:00
|
|
|
MULTICALL ?= n
|
2016-08-08 01:46:43 +00:00
|
|
|
INSTALL ?= install
|
2015-12-24 04:14:55 +00:00
|
|
|
ifneq (,$(filter install, $(MAKECMDGOALS)))
|
|
|
|
override PROFILE:=release
|
|
|
|
endif
|
|
|
|
|
2015-11-22 20:45:04 +00:00
|
|
|
PROFILE_CMD :=
|
2015-12-24 04:14:55 +00:00
|
|
|
ifeq ($(PROFILE),release)
|
2015-11-22 20:45:04 +00:00
|
|
|
PROFILE_CMD = --release
|
|
|
|
endif
|
2014-07-20 08:27:47 +00:00
|
|
|
|
2016-08-04 13:27:32 +00:00
|
|
|
RM := rm -rf
|
|
|
|
|
2014-07-19 21:25:28 +00:00
|
|
|
# Binaries
|
2015-11-26 22:10:18 +00:00
|
|
|
CARGO ?= cargo
|
2015-12-18 22:03:57 +00:00
|
|
|
CARGOFLAGS ?=
|
2013-10-23 15:09:40 +00:00
|
|
|
|
2014-11-29 21:32:33 +00:00
|
|
|
# Install directories
|
2015-12-25 05:58:37 +00:00
|
|
|
PREFIX ?= /usr/local
|
2016-05-07 06:57:47 +00:00
|
|
|
DESTDIR ?=
|
2015-11-26 22:10:18 +00:00
|
|
|
BINDIR ?= /bin
|
2017-12-07 01:53:36 +00:00
|
|
|
MANDIR ?= /man/man1
|
2014-11-29 21:32:33 +00:00
|
|
|
|
2015-12-25 05:58:37 +00:00
|
|
|
INSTALLDIR_BIN=$(DESTDIR)$(PREFIX)$(BINDIR)
|
2017-12-07 01:53:36 +00:00
|
|
|
INSTALLDIR_MAN=$(DESTDIR)$(PREFIX)/share/$(MANDIR)
|
|
|
|
$(shell test -d $(INSTALLDIR_MAN))
|
|
|
|
ifneq ($(.SHELLSTATUS),0)
|
|
|
|
override INSTALLDIR_MAN=$(DESTDIR)$(PREFIX)$(MANDIR)
|
|
|
|
endif
|
2015-12-24 04:14:55 +00:00
|
|
|
|
|
|
|
#prefix to apply to uutils binary and all tool binaries
|
|
|
|
PROG_PREFIX ?=
|
2015-11-22 20:45:04 +00:00
|
|
|
|
2014-11-29 21:32:33 +00:00
|
|
|
# This won't support any directory with spaces in its name, but you can just
|
|
|
|
# make a symlink without spaces that points to the directory.
|
2015-11-26 22:10:18 +00:00
|
|
|
BASEDIR ?= $(shell pwd)
|
2016-08-09 01:51:24 +00:00
|
|
|
BUILDDIR := $(BASEDIR)/target/${PROFILE}
|
|
|
|
PKG_BUILDDIR := $(BUILDDIR)/deps
|
2017-12-07 01:53:36 +00:00
|
|
|
DOCSDIR := $(BASEDIR)/docs
|
2014-07-19 21:25:28 +00:00
|
|
|
|
2016-08-09 01:51:24 +00:00
|
|
|
BUSYBOX_ROOT := $(BASEDIR)/tmp
|
|
|
|
BUSYBOX_VER := 1.24.1
|
|
|
|
BUSYBOX_SRC := $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER)
|
2015-12-21 00:48:26 +00:00
|
|
|
|
2013-12-27 07:48:38 +00:00
|
|
|
# Possible programs
|
|
|
|
PROGS := \
|
2016-08-06 03:45:03 +00:00
|
|
|
base32 \
|
2013-12-20 19:34:45 +00:00
|
|
|
base64 \
|
2014-01-07 00:54:02 +00:00
|
|
|
basename \
|
2013-12-02 11:50:24 +00:00
|
|
|
cat \
|
2014-05-16 21:01:20 +00:00
|
|
|
cksum \
|
2014-05-16 17:43:17 +00:00
|
|
|
comm \
|
2014-05-17 17:01:17 +00:00
|
|
|
cp \
|
2014-06-12 21:04:01 +00:00
|
|
|
cut \
|
2016-05-10 15:29:29 +00:00
|
|
|
dircolors \
|
2013-12-03 09:29:32 +00:00
|
|
|
dirname \
|
2013-12-02 11:50:24 +00:00
|
|
|
echo \
|
|
|
|
env \
|
2014-07-25 22:34:45 +00:00
|
|
|
expand \
|
Implement expr.
Implemented as follows:
Usage: expr EXPRESSION
or: expr OPTION
--help display this help and exit
--version output version information and exit
Print the value of EXPRESSION to standard output. A blank line below
separates increasing precedence groups. EXPRESSION may be:
ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2
ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0
ARG1 < ARG2 ARG1 is less than ARG2
ARG1 <= ARG2 ARG1 is less than or equal to ARG2
ARG1 = ARG2 ARG1 is equal to ARG2
ARG1 != ARG2 ARG1 is unequal to ARG2
ARG1 >= ARG2 ARG1 is greater than or equal to ARG2
ARG1 > ARG2 ARG1 is greater than ARG2
ARG1 + ARG2 arithmetic sum of ARG1 and ARG2
ARG1 - ARG2 arithmetic difference of ARG1 and ARG2
ARG1 * ARG2 arithmetic product of ARG1 and ARG2
ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2
ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2
STRING : REGEXP [NOT IMPLEMENTED] anchored pattern match of REGEXP in STRING
match STRING REGEXP [NOT IMPLEMENTED] same as STRING : REGEXP
substr STRING POS LENGTH [NOT IMPLEMENTED] substring of STRING, POS counted from 1
index STRING CHARS [NOT IMPLEMENTED] index in STRING where any CHARS is found, or 0
length STRING [NOT IMPLEMENTED] length of STRING
+ TOKEN interpret TOKEN as a string, even if it is a
keyword like 'match' or an operator like '/'
( EXPRESSION ) value of EXPRESSION
Beware that many operators need to be escaped or quoted for shells.
Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
Pattern matches return the string matched between \( and \) or null; if
\( and \) are not used, they return the number of characters matched or 0.
Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null
or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred.
Environment variables:
* EXPR_DEBUG_TOKENS=1 dump expression's tokens
* EXPR_DEBUG_RPN=1 dump expression represented in reverse polish notation
* EXPR_DEBUG_SYA_STEP=1 dump each parser step
* EXPR_DEBUG_AST=1 dump expression represented abstract syntax tree
2015-10-09 09:31:25 +00:00
|
|
|
expr \
|
2014-05-30 00:39:33 +00:00
|
|
|
factor \
|
2013-12-02 11:50:24 +00:00
|
|
|
false \
|
2014-06-19 00:56:53 +00:00
|
|
|
fmt \
|
2014-03-27 01:34:58 +00:00
|
|
|
fold \
|
2014-06-22 20:27:43 +00:00
|
|
|
hashsum \
|
2015-12-26 00:58:35 +00:00
|
|
|
head \
|
2017-12-13 21:02:42 +00:00
|
|
|
join \
|
2015-12-26 00:58:35 +00:00
|
|
|
link \
|
2015-07-05 18:52:31 +00:00
|
|
|
ln \
|
2016-03-25 21:00:27 +00:00
|
|
|
ls \
|
2014-01-01 23:32:21 +00:00
|
|
|
mkdir \
|
2016-01-03 10:10:47 +00:00
|
|
|
mktemp \
|
2016-08-17 19:41:34 +00:00
|
|
|
more \
|
2016-11-18 13:53:45 +00:00
|
|
|
mv \
|
2014-06-14 14:43:39 +00:00
|
|
|
nl \
|
2017-10-22 07:57:49 +00:00
|
|
|
numfmt \
|
2014-10-18 21:17:33 +00:00
|
|
|
nproc \
|
2014-07-10 20:49:20 +00:00
|
|
|
od \
|
2014-02-28 17:19:32 +00:00
|
|
|
paste \
|
2013-12-02 11:50:24 +00:00
|
|
|
printenv \
|
2015-12-24 06:11:00 +00:00
|
|
|
printf \
|
2015-01-27 15:37:07 +00:00
|
|
|
ptx \
|
2013-12-05 11:36:08 +00:00
|
|
|
pwd \
|
2014-12-23 11:27:21 +00:00
|
|
|
readlink \
|
2014-06-29 19:57:54 +00:00
|
|
|
realpath \
|
2014-06-29 19:59:25 +00:00
|
|
|
relpath \
|
2013-12-18 06:09:32 +00:00
|
|
|
rm \
|
2013-12-18 18:39:23 +00:00
|
|
|
rmdir \
|
2014-02-05 19:46:28 +00:00
|
|
|
seq \
|
2015-12-29 07:18:19 +00:00
|
|
|
shred \
|
2014-07-10 01:19:59 +00:00
|
|
|
shuf \
|
2015-12-26 00:58:35 +00:00
|
|
|
sleep \
|
2014-07-07 14:55:47 +00:00
|
|
|
sort \
|
2015-12-26 00:58:35 +00:00
|
|
|
split \
|
2014-05-28 00:57:33 +00:00
|
|
|
sum \
|
2014-06-26 06:05:31 +00:00
|
|
|
sync \
|
2014-02-27 18:59:51 +00:00
|
|
|
tac \
|
2015-12-26 00:58:35 +00:00
|
|
|
tail \
|
2013-12-23 17:12:26 +00:00
|
|
|
tee \
|
2015-11-27 06:54:18 +00:00
|
|
|
test \
|
2014-05-18 15:17:04 +00:00
|
|
|
tr \
|
2013-12-02 11:50:24 +00:00
|
|
|
true \
|
2014-02-01 05:18:57 +00:00
|
|
|
truncate \
|
2014-07-20 03:19:38 +00:00
|
|
|
tsort \
|
2014-07-28 00:11:49 +00:00
|
|
|
unexpand \
|
2014-07-06 00:27:22 +00:00
|
|
|
uniq \
|
2013-12-02 11:50:24 +00:00
|
|
|
wc \
|
2015-12-26 00:58:35 +00:00
|
|
|
whoami \
|
|
|
|
yes
|
2013-12-02 11:50:24 +00:00
|
|
|
|
2014-02-08 03:35:03 +00:00
|
|
|
UNIX_PROGS := \
|
2016-07-09 19:18:10 +00:00
|
|
|
arch \
|
2016-08-21 09:04:02 +00:00
|
|
|
chgrp \
|
2015-12-01 06:27:36 +00:00
|
|
|
chmod \
|
2016-06-22 13:36:50 +00:00
|
|
|
chown \
|
2014-06-16 15:37:03 +00:00
|
|
|
chroot \
|
2015-07-20 00:25:48 +00:00
|
|
|
du \
|
2014-06-15 14:25:00 +00:00
|
|
|
groups \
|
2014-04-03 20:56:36 +00:00
|
|
|
hostid \
|
2014-06-04 05:28:22 +00:00
|
|
|
hostname \
|
2014-06-15 14:25:00 +00:00
|
|
|
id \
|
2016-07-13 18:47:04 +00:00
|
|
|
install \
|
2014-04-03 13:59:58 +00:00
|
|
|
kill \
|
2014-02-24 21:24:01 +00:00
|
|
|
logname \
|
2014-06-22 12:39:46 +00:00
|
|
|
mkfifo \
|
2016-05-07 06:57:47 +00:00
|
|
|
mknod \
|
2014-12-16 04:03:21 +00:00
|
|
|
nice \
|
2014-06-24 12:51:57 +00:00
|
|
|
nohup \
|
2016-05-22 11:59:57 +00:00
|
|
|
pathchk \
|
2016-07-12 10:40:48 +00:00
|
|
|
pinky \
|
2016-06-01 12:20:32 +00:00
|
|
|
stat \
|
2014-12-30 19:11:36 +00:00
|
|
|
stdbuf \
|
2014-07-22 01:50:53 +00:00
|
|
|
timeout \
|
2015-07-20 00:25:48 +00:00
|
|
|
touch \
|
2014-02-19 05:59:48 +00:00
|
|
|
tty \
|
2014-06-15 14:25:00 +00:00
|
|
|
uname \
|
2015-07-20 00:25:48 +00:00
|
|
|
unlink \
|
2014-04-02 00:13:07 +00:00
|
|
|
uptime \
|
2016-08-10 16:19:26 +00:00
|
|
|
users \
|
|
|
|
who
|
2014-02-08 03:35:03 +00:00
|
|
|
|
|
|
|
ifneq ($(OS),Windows_NT)
|
|
|
|
PROGS := $(PROGS) $(UNIX_PROGS)
|
|
|
|
endif
|
|
|
|
|
2016-01-12 19:17:28 +00:00
|
|
|
UTILS ?= $(PROGS)
|
2013-12-27 07:48:38 +00:00
|
|
|
|
2015-11-25 06:50:57 +00:00
|
|
|
# Programs with usable tests
|
|
|
|
TEST_PROGS := \
|
2016-08-06 03:45:03 +00:00
|
|
|
base32 \
|
2015-11-25 06:50:57 +00:00
|
|
|
base64 \
|
|
|
|
basename \
|
|
|
|
cat \
|
2016-08-21 09:04:02 +00:00
|
|
|
chgrp \
|
2016-01-04 15:58:49 +00:00
|
|
|
chmod \
|
2016-06-22 13:36:50 +00:00
|
|
|
chown \
|
2015-11-25 06:50:57 +00:00
|
|
|
cksum \
|
2015-11-28 19:36:29 +00:00
|
|
|
comm \
|
2015-11-25 06:50:57 +00:00
|
|
|
cp \
|
|
|
|
cut \
|
2016-05-10 15:29:29 +00:00
|
|
|
dircolors \
|
2015-11-25 06:50:57 +00:00
|
|
|
dirname \
|
|
|
|
echo \
|
2015-11-25 08:36:28 +00:00
|
|
|
env \
|
2015-12-22 13:10:43 +00:00
|
|
|
expr \
|
2015-11-25 06:50:57 +00:00
|
|
|
factor \
|
|
|
|
false \
|
|
|
|
fold \
|
|
|
|
hashsum \
|
|
|
|
head \
|
2016-07-12 18:56:21 +00:00
|
|
|
install \
|
2015-11-25 06:50:57 +00:00
|
|
|
link \
|
|
|
|
ln \
|
2016-03-25 22:30:25 +00:00
|
|
|
ls \
|
2015-11-25 06:50:57 +00:00
|
|
|
mkdir \
|
2016-01-03 10:10:47 +00:00
|
|
|
mktemp \
|
2015-11-25 06:50:57 +00:00
|
|
|
mv \
|
|
|
|
nl \
|
2017-10-22 07:57:49 +00:00
|
|
|
numfmt \
|
2016-04-26 03:06:38 +00:00
|
|
|
od \
|
2015-11-25 06:50:57 +00:00
|
|
|
paste \
|
2016-05-22 11:59:57 +00:00
|
|
|
pathchk \
|
2016-07-12 10:40:48 +00:00
|
|
|
pinky \
|
2015-12-24 06:11:00 +00:00
|
|
|
printf \
|
2015-11-25 06:50:57 +00:00
|
|
|
ptx \
|
|
|
|
pwd \
|
|
|
|
readlink \
|
|
|
|
realpath \
|
|
|
|
rm \
|
|
|
|
rmdir \
|
|
|
|
seq \
|
|
|
|
sort \
|
|
|
|
split \
|
2016-06-01 12:20:32 +00:00
|
|
|
stat \
|
2015-11-25 06:50:57 +00:00
|
|
|
stdbuf \
|
|
|
|
sum \
|
|
|
|
tac \
|
2015-12-12 21:24:48 +00:00
|
|
|
tail \
|
2015-11-25 06:50:57 +00:00
|
|
|
test \
|
|
|
|
touch \
|
|
|
|
tr \
|
|
|
|
true \
|
|
|
|
truncate \
|
|
|
|
tsort \
|
|
|
|
unexpand \
|
2016-02-29 05:37:16 +00:00
|
|
|
uniq \
|
2015-11-25 08:36:28 +00:00
|
|
|
unlink \
|
2016-08-11 07:37:39 +00:00
|
|
|
wc \
|
|
|
|
who
|
2015-11-25 06:50:57 +00:00
|
|
|
|
2015-11-22 20:45:04 +00:00
|
|
|
TESTS := \
|
2016-01-12 19:17:28 +00:00
|
|
|
$(sort $(filter $(UTILS),$(filter-out $(SKIP_UTILS),$(TEST_PROGS))))
|
2015-12-21 00:48:26 +00:00
|
|
|
|
2016-02-15 23:08:37 +00:00
|
|
|
TEST_NO_FAIL_FAST :=
|
2016-05-07 06:57:47 +00:00
|
|
|
TEST_SPEC_FEATURE :=
|
2016-02-15 23:08:37 +00:00
|
|
|
ifneq ($(SPEC),)
|
|
|
|
TEST_NO_FAIL_FAST :=--no-fail-fast
|
|
|
|
TEST_SPEC_FEATURE := test_unimplemented
|
|
|
|
endif
|
|
|
|
|
2015-12-21 00:48:26 +00:00
|
|
|
define TEST_BUSYBOX
|
2015-12-25 05:45:23 +00:00
|
|
|
test_busybox_$(1):
|
2015-12-21 00:48:26 +00:00
|
|
|
(cd $(BUSYBOX_SRC)/testsuite && bindir=$(BUILDDIR) ./runtest $(RUNTEST_ARGS) $(1) )
|
|
|
|
endef
|
|
|
|
|
2013-12-27 07:48:38 +00:00
|
|
|
# Output names
|
|
|
|
EXES := \
|
2016-01-12 19:17:28 +00:00
|
|
|
$(sort $(filter $(UTILS),$(filter-out $(SKIP_UTILS),$(PROGS))))
|
2015-12-24 04:14:55 +00:00
|
|
|
|
2016-09-25 12:41:53 +00:00
|
|
|
INSTALLEES := ${EXES}
|
|
|
|
ifeq (${MULTICALL}, y)
|
|
|
|
INSTALLEES := ${INSTALLEES} uutils
|
|
|
|
endif
|
2014-06-13 02:14:56 +00:00
|
|
|
|
2014-12-30 19:11:36 +00:00
|
|
|
# Shared library extension
|
|
|
|
SYSTEM := $(shell uname)
|
Implement expr.
Implemented as follows:
Usage: expr EXPRESSION
or: expr OPTION
--help display this help and exit
--version output version information and exit
Print the value of EXPRESSION to standard output. A blank line below
separates increasing precedence groups. EXPRESSION may be:
ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2
ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0
ARG1 < ARG2 ARG1 is less than ARG2
ARG1 <= ARG2 ARG1 is less than or equal to ARG2
ARG1 = ARG2 ARG1 is equal to ARG2
ARG1 != ARG2 ARG1 is unequal to ARG2
ARG1 >= ARG2 ARG1 is greater than or equal to ARG2
ARG1 > ARG2 ARG1 is greater than ARG2
ARG1 + ARG2 arithmetic sum of ARG1 and ARG2
ARG1 - ARG2 arithmetic difference of ARG1 and ARG2
ARG1 * ARG2 arithmetic product of ARG1 and ARG2
ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2
ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2
STRING : REGEXP [NOT IMPLEMENTED] anchored pattern match of REGEXP in STRING
match STRING REGEXP [NOT IMPLEMENTED] same as STRING : REGEXP
substr STRING POS LENGTH [NOT IMPLEMENTED] substring of STRING, POS counted from 1
index STRING CHARS [NOT IMPLEMENTED] index in STRING where any CHARS is found, or 0
length STRING [NOT IMPLEMENTED] length of STRING
+ TOKEN interpret TOKEN as a string, even if it is a
keyword like 'match' or an operator like '/'
( EXPRESSION ) value of EXPRESSION
Beware that many operators need to be escaped or quoted for shells.
Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
Pattern matches return the string matched between \( and \) or null; if
\( and \) are not used, they return the number of characters matched or 0.
Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null
or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred.
Environment variables:
* EXPR_DEBUG_TOKENS=1 dump expression's tokens
* EXPR_DEBUG_RPN=1 dump expression represented in reverse polish notation
* EXPR_DEBUG_SYA_STEP=1 dump each parser step
* EXPR_DEBUG_AST=1 dump expression represented abstract syntax tree
2015-10-09 09:31:25 +00:00
|
|
|
DYLIB_EXT :=
|
2014-12-30 19:11:36 +00:00
|
|
|
ifeq ($(SYSTEM),Linux)
|
2015-01-25 12:40:18 +00:00
|
|
|
DYLIB_EXT := so
|
2015-07-09 00:34:48 +00:00
|
|
|
DYLIB_FLAGS := -shared
|
2014-12-30 19:11:36 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(SYSTEM),Darwin)
|
2015-01-25 12:40:18 +00:00
|
|
|
DYLIB_EXT := dylib
|
2015-07-09 22:39:46 +00:00
|
|
|
DYLIB_FLAGS := -dynamiclib -undefined dynamic_lookup
|
2014-12-30 19:11:36 +00:00
|
|
|
endif
|
|
|
|
|
2015-11-22 20:45:04 +00:00
|
|
|
all: build
|
2015-08-26 16:50:07 +00:00
|
|
|
|
2016-08-08 01:46:43 +00:00
|
|
|
do_install = $(INSTALL) ${1}
|
2015-11-22 20:45:04 +00:00
|
|
|
use_default := 1
|
2014-07-11 06:38:18 +00:00
|
|
|
|
2017-12-07 01:53:36 +00:00
|
|
|
build-pkgs:
|
|
|
|
ifneq (${MULTICALL}, y)
|
|
|
|
${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} $(foreach pkg,$(EXES),-p $(pkg))
|
|
|
|
endif
|
2015-12-25 05:45:23 +00:00
|
|
|
|
2016-05-07 06:57:47 +00:00
|
|
|
build-uutils:
|
2015-12-18 22:03:57 +00:00
|
|
|
${CARGO} build ${CARGOFLAGS} --features "${EXES}" ${PROFILE_CMD} --no-default-features
|
2015-11-25 22:32:02 +00:00
|
|
|
|
2017-12-07 01:53:36 +00:00
|
|
|
build-manpages:
|
|
|
|
cd $(DOCSDIR) && make man
|
|
|
|
|
|
|
|
build: build-uutils build-pkgs build-manpages
|
2013-10-23 15:09:40 +00:00
|
|
|
|
2016-01-12 19:17:28 +00:00
|
|
|
$(foreach test,$(filter-out $(SKIP_UTILS),$(PROGS)),$(eval $(call TEST_BUSYBOX,$(test))))
|
2015-11-25 22:32:02 +00:00
|
|
|
|
2016-07-31 17:02:41 +00:00
|
|
|
test:
|
|
|
|
${CARGO} test ${CARGOFLAGS} --features "$(TESTS) $(TEST_SPEC_FEATURE)" --no-default-features $(TEST_NO_FAIL_FAST)
|
2015-11-25 22:32:02 +00:00
|
|
|
|
2015-12-21 00:48:26 +00:00
|
|
|
busybox-src:
|
|
|
|
if [ ! -e $(BUSYBOX_SRC) ]; then \
|
|
|
|
mkdir -p $(BUSYBOX_ROOT); \
|
2015-12-21 20:37:57 +00:00
|
|
|
wget https://busybox.net/downloads/busybox-$(BUSYBOX_VER).tar.bz2 -P $(BUSYBOX_ROOT); \
|
2015-12-21 00:48:26 +00:00
|
|
|
tar -C $(BUSYBOX_ROOT) -xf $(BUSYBOX_ROOT)/busybox-$(BUSYBOX_VER).tar.bz2; \
|
|
|
|
fi; \
|
|
|
|
|
2015-12-25 05:45:23 +00:00
|
|
|
# This is a busybox-specific config file their test suite wants to parse.
|
2016-05-07 06:57:47 +00:00
|
|
|
$(BUILDDIR)/.config: $(BASEDIR)/.busybox-config
|
2015-12-25 05:45:23 +00:00
|
|
|
cp $< $@
|
2015-12-21 00:48:26 +00:00
|
|
|
|
|
|
|
# Test under the busybox testsuite
|
2016-05-07 06:57:47 +00:00
|
|
|
$(BUILDDIR)/busybox: busybox-src build-uutils $(BUILDDIR)/.config
|
2015-12-25 05:45:23 +00:00
|
|
|
cp $(BUILDDIR)/uutils $(BUILDDIR)/busybox; \
|
2015-12-21 00:48:26 +00:00
|
|
|
chmod +x $@;
|
|
|
|
|
2015-12-25 05:45:23 +00:00
|
|
|
ifeq ($(EXES),)
|
2015-12-21 00:48:26 +00:00
|
|
|
busytest:
|
|
|
|
else
|
2016-01-12 19:17:28 +00:00
|
|
|
busytest: $(BUILDDIR)/busybox $(addprefix test_busybox_,$(filter-out $(SKIP_UTILS),$(EXES)))
|
2015-12-21 00:48:26 +00:00
|
|
|
endif
|
|
|
|
|
2014-06-20 21:31:55 +00:00
|
|
|
clean:
|
2016-08-04 13:27:32 +00:00
|
|
|
$(RM) $(BUILDDIR)
|
2017-12-07 01:53:36 +00:00
|
|
|
cd $(DOCSDIR) && make clean
|
2015-04-25 22:22:56 +00:00
|
|
|
|
|
|
|
distclean: clean
|
2015-12-18 22:03:57 +00:00
|
|
|
$(CARGO) clean $(CARGOFLAGS) && $(CARGO) update $(CARGOFLAGS)
|
2013-10-22 13:31:51 +00:00
|
|
|
|
2016-05-07 06:57:47 +00:00
|
|
|
install: build
|
2015-12-24 04:14:55 +00:00
|
|
|
mkdir -p $(INSTALLDIR_BIN)
|
2017-12-07 01:53:36 +00:00
|
|
|
mkdir -p $(INSTALLDIR_MAN)
|
2015-11-22 20:45:04 +00:00
|
|
|
ifeq (${MULTICALL}, y)
|
2016-08-08 01:46:43 +00:00
|
|
|
$(INSTALL) $(BUILDDIR)/uutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)uutils
|
2017-12-07 01:53:36 +00:00
|
|
|
cd $(INSTALLDIR_BIN) && $(foreach prog, $(filter-out uutils, $(INSTALLEES)), \
|
|
|
|
ln -fs $(PROG_PREFIX)uutils $(PROG_PREFIX)$(prog) &&) :
|
|
|
|
cat $(DOCSDIR)/_build/man/uutils.1 | gzip > $(INSTALLDIR_MAN)/$(PROG_PREFIX)uutils.1.gz
|
2014-06-01 18:26:58 +00:00
|
|
|
else
|
2015-12-24 04:14:55 +00:00
|
|
|
$(foreach prog, $(INSTALLEES), \
|
2017-10-09 22:09:24 +00:00
|
|
|
$(INSTALL) $(BUILDDIR)/$(prog) $(INSTALLDIR_BIN)/$(PROG_PREFIX)$(prog);)
|
2014-06-01 18:26:58 +00:00
|
|
|
endif
|
2017-12-07 01:53:36 +00:00
|
|
|
$(foreach man, $(filter $(INSTALLEES), $(basename $(notdir $(wildcard $(DOCSDIR)/_build/man/*)))), \
|
|
|
|
cat $(DOCSDIR)/_build/man/$(man).1 | gzip > $(INSTALLDIR_MAN)/$(PROG_PREFIX)$(man).1.gz &&) :
|
2014-06-01 18:26:58 +00:00
|
|
|
|
2015-11-22 20:45:04 +00:00
|
|
|
uninstall:
|
2015-12-24 04:14:55 +00:00
|
|
|
ifeq (${MULTICALL}, y)
|
|
|
|
rm -f $(addprefix $(INSTALLDIR_BIN)/,$(PROG_PREFIX)uutils)
|
|
|
|
endif
|
2017-12-07 01:53:36 +00:00
|
|
|
rm -f $(addprefix $(INSTALLDIR_MAN)/,$(PROG_PREFIX)uutils.1.gz)
|
2015-12-24 04:14:55 +00:00
|
|
|
rm -f $(addprefix $(INSTALLDIR_BIN)/$(PROG_PREFIX),$(PROGS))
|
2017-12-07 01:53:36 +00:00
|
|
|
rm -f $(addprefix $(INSTALLDIR_MAN)/$(PROG_PREFIX),$(addsuffix .1.gz,$(PROGS)))
|
2015-05-07 20:59:34 +00:00
|
|
|
|
2017-12-07 01:53:36 +00:00
|
|
|
.PHONY: all build build-uutils build-pkgs build-docs test distclean clean busytest install uninstall
|