-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathportability.mk
66 lines (62 loc) · 1.2 KB
/
portability.mk
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
ifndef PORTABILITY_MK
PORTABILITY_MK=true
PORTABILITY_CONF?= ${HOME}/.mk.conf /etc/mk.conf
-include ${PORTABILITY_CONF}
MV?= mv
CP?= cp -R
LN?= ln -sf
MKDIR?= mkdir -p
MKTMPDIR?=mktemp -d
CHOWN?= chown -R
CHMOD?= chmod -R
CAT?= cat
OPEN?= xdg-open
ifeq (${MAKE},gmake)
SED?= gsed
SEDex?= gsed -E
else
SED?= sed
SEDex?= sed -E
endif
ifeq (${MAKE},gmake)
GREP= ggrep
GREPex= ggrep -E
else
GREP= grep
GREPex= grep -E
endif
WC?= wc
WCw?= wc -w
CURL?= curl
SFTP?= sftp
SCP?= scp -r
SSH?= ssh
UNCOMPRESS_SUFFIXES+= .gz .z
GUNZIP?= gunzip
UNCOMPRESS.gz?= ${GUNZIP} $<
UNCOMPRESS.z?= ${UNCOMPRESS.gz}
COMPRESS_SUFFIXES+= .gz
GZIP?= gzip
COMPRESS.gz?= ${GZIP} $<
ARCHIVE.a?= ar r $@ $%
TAR?= tar -u
PAX?= pax -wzLx ustar
ARCHIVE.tar?= ${TAR} -f $@ $%
ZIP?= zip
ARCHIVE.zip?= ${ZIP} -u $@ $%
UNTAR?= tar -xm
UNPAX?= pax -rzp m
EXTRACT.tar?= ${UNTAR} -f $< $@
ifeq ($(shell uname),Darwin)
UNZIP?= unzip
else
UNZIP?= unzip -DD
endif
EXTRACT.zip?= ${UNZIP} $< $@
(%):
${ARCHIVE$(suffix $@)}
define extract
$(1): $(2)
$${EXTRACT$(suffix $(2))}
endef
endif