| 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 |
.ifdef cats |
| 29 |
.MAIN: cats |
| 30 |
.endif |
| 31 |
|
| 32 |
.include <bsd.own.mk> |
| 33 |
|
| 34 |
SRCDIR= ${.CURDIR} |
| 35 |
|
| 36 |
PROG= pax |
| 37 |
SRCS= ar.c ar_io.c ar_subs.c buf_subs.c compat.c cpio.c \ |
| 38 |
file_subs.c ftree.c gen_subs.c getoldopt.c options.c \ |
| 39 |
pat_rep.c pax.c sel_subs.c tables.c tar.c tty_subs.c |
| 40 |
SRCS+= cache.c |
| 41 |
MAN= cpio.1 pax.1 tar.1 |
| 42 |
LINKS+= ${BINDIR}/pax ${BINDIR}/cpio |
| 43 |
LINKS+= ${BINDIR}/pax ${BINDIR}/tar |
| 44 |
.if !make(test-build) |
| 45 |
|
| 46 |
CPPFLAGS+= \ |
| 47 |
-DHAVE_ATTRIBUTE_BOUNDED=1 -DHAVE_ATTRIBUTE_FORMAT=1 \ |
| 48 |
-DHAVE_ATTRIBUTE_NONNULL=1 -DHAVE_ATTRIBUTE_NORETURN=1 \ |
| 49 |
-DHAVE_ATTRIBUTE_PURE=1 -DHAVE_ATTRIBUTE_UNUSED=1 \ |
| 50 |
-DHAVE_ATTRIBUTE_USED=1 -DHAVE_SYS_TIME_H=1 -DHAVE_TIME_H=1 \ |
| 51 |
-DHAVE_BOTH_TIME_H=1 -DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_MTIO_H=1 \ |
| 52 |
-DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_SYSMACROS_H=0 \ |
| 53 |
-DHAVE_GRP_H=1 -DHAVE_PATHS_H=1 -DHAVE_STDINT_H=1 \ |
| 54 |
-DHAVE_STRINGS_H=1 -DHAVE_UTIME_H=1 -DHAVE_UTMP_H=1 \ |
| 55 |
-DHAVE_UTMPX_H=0 -DHAVE_VIS_H=1 -DHAVE_CAN_INTTYPES=1 \ |
| 56 |
-DHAVE_CAN_UCBINTS=1 -DHAVE_CAN_ULONG=1 -DHAVE_DPRINTF=0 \ |
| 57 |
-DHAVE_FCHMODAT=0 -DHAVE_FCHOWNAT=0 -DHAVE_FUTIMENS=0 \ |
| 58 |
-DHAVE_LCHMOD=1 -DHAVE_LCHOWN=1 -DHAVE_LINKAT=0 \ |
| 59 |
-DHAVE_PLEDGE=0 -DHAVE_REALLOCARRAY=1 -DHAVE_SETPGENT=1 \ |
| 60 |
-DHAVE_STRLCPY=1 -DHAVE_STRLCAT=1 -DHAVE_STRMODE=1 \ |
| 61 |
-DHAVE_STRTONUM=1 -DHAVE_UG_FROM_UGID=1 -DHAVE_UGID_FROM_UG=0 \ |
| 62 |
-DHAVE_UTIMENSAT=0 -DHAVE_UTIMES=1 -DHAVE_LUTIMES=1 \ |
| 63 |
-DHAVE_FUTIMES=1 -DHAVE_OFFT_LONG=0 -DHAVE_TIMET_LONG=0 \ |
| 64 |
-DHAVE_TIMET_LARGE=1 -DHAVE_ST_MTIMENSEC=1 |
| 65 |
CPPFLAGS+= -I. |
| 66 |
CPPFLAGS+= -D_ALL_SOURCE |
| 67 |
COPTS+= -Wall |
| 68 |
.endif |
| 69 |
COPTS+= -std=c89 -U__STRICT_ANSI__ |
| 70 |
|
| 71 |
CPPFLAGS+= -DREALPATH_CAN_ALLOCATE=2 |
| 72 |
|
| 73 |
SAFE_PATH= /bin:/usr/bin:/usr/mpkg/bin:/usr/local/bin |
| 74 |
CPPFLAGS+= -DPAX_SAFE_PATH=\"${SAFE_PATH:Q}\" |
| 75 |
|
| 76 |
TEST_BUILD_ENV:= TARGET_OS= CPP= |
| 77 |
TEST_BUILD_ENV+= HAVE_PLEDGE=0 # for now, on MirBSD |
| 78 |
|
| 79 |
test-build: .PHONY |
| 80 |
-rm -rf build-dir |
| 81 |
mkdir -p build-dir |
| 82 |
cd build-dir; env CC=${CC:Q} CFLAGS=${CFLAGS:M*:Q} \ |
| 83 |
CPPFLAGS=${CPPFLAGS:M*:Q} LDFLAGS=${LDFLAGS:M*:Q} \ |
| 84 |
LIBS=${LDADD:Q} NOWARN=-Wno-error ${TEST_BUILD_ENV} \ |
| 85 |
/bin/sh ${SRCDIR:Q}/Build.sh -Q -r |
| 86 |
|
| 87 |
cleandir: clean-extra |
| 88 |
|
| 89 |
clean-extra: .PHONY |
| 90 |
-rm -rf build-dir |
| 91 |
|
| 92 |
CLEANFILES+= ${MANALL:S/.cat/.ps/} ${MAN:S/$/.pdf/} ${MANALL:S/$/.gz/} |
| 93 |
CLEANFILES+= ${MAN:S/$/.htm/} ${MAN:S/$/.htm.gz/} |
| 94 |
CLEANFILES+= ${MAN:S/$/.txt/} ${MAN:S/$/.txt.gz/} |
| 95 |
|
| 96 |
.include <bsd.prog.mk> |
| 97 |
|
| 98 |
CLEANFILES+= cpio tar |
| 99 |
all: cpio tar |
| 100 |
|
| 101 |
cpio: |
| 102 |
ln -sf ${PROG} cpio |
| 103 |
|
| 104 |
tar: |
| 105 |
ln -sf ${PROG} tar |
| 106 |
|
| 107 |
.ifmake cats |
| 108 |
V_GROFF!= pkg_info -e 'groff-[0-9]*' |
| 109 |
V_GHOSTSCRIPT!= pkg_info -e 'ghostscript-[0-9]*' |
| 110 |
. if empty(V_GROFF) || empty(V_GHOSTSCRIPT) |
| 111 |
. error empty V_GROFF=${V_GROFF} or V_GHOSTSCRIPT=${V_GHOSTSCRIPT} |
| 112 |
. endif |
| 113 |
.endif |
| 114 |
|
| 115 |
CATS_KW= cpio, pax, tar |
| 116 |
CATS_TITLE_cpio_1=paxcpio - copy file archives in and out |
| 117 |
CATS_TITLE_pax_1=pax - read and write file archives and copy directory hierarchies |
| 118 |
CATS_TITLE_tar_1=paxtar - Unix tape archiver |
| 119 |
CATS_PAGES= cpio 1 pax 1 tar 1 |
| 120 |
catsall:= ${MANALL} |
| 121 |
.for _m _n in ${CATS_PAGES} |
| 122 |
catsall:= ${catsall:N${_m}.cat${_n}} |
| 123 |
.endfor |
| 124 |
.if "${catsall}" != "" |
| 125 |
. error Adjust here. |
| 126 |
.endif |
| 127 |
cats: ${MANALL} ${MANALL:S/.cat/.ps/} |
| 128 |
.for _m _n in ${CATS_PAGES} |
| 129 |
x=$$(ident ${SRCDIR:Q}/${_m}.${_n} | \ |
| 130 |
awk '/Mir''OS:/ { print $$4$$5; }' | \ |
| 131 |
tr -dc 0-9); (( $${ |
| 132 |
${MKSH} ${BSDSRCDIR:Q}/contrib/hosted/tg/ps2pdfmir -p pa4 -c \ |
| 133 |
-o ${_m}.${_n}.pdf '[' /Author '(MirBSD)' \ |
| 134 |
/Title '('${CATS_TITLE_${_m}_${_n}:Q}')' \ |
| 135 |
/Subject '(BSD Reference Manual)' /ModDate "(D:$$x)" \ |
| 136 |
/Creator '(GNU groff version ${V_GROFF:S/groff-//} \(MirPorts\))' \ |
| 137 |
/Producer '(Artifex Ghostscript ${V_GHOSTSCRIPT:S/ghostscript-//:S/-artifex//} \(MirPorts\))' \ |
| 138 |
/Keywords '('${CATS_KW:Q}')' /DOCINFO pdfmark \ |
| 139 |
-f ${_m}.ps${_n} |
| 140 |
.endfor |
| 141 |
set -e; . ${BSDSRCDIR:Q}/scripts/roff2htm; set_target_absolute; \ |
| 142 |
for m in ${MANALL}; do \ |
| 143 |
bn=$${m%.*}; ext=$${m |
| 144 |
[[ $$bn != $$m ]]; [[ $$ext != $$m ]]; \ |
| 145 |
gzip -n9 <"$$m" >"$$m.gz"; \ |
| 146 |
col -bx <"$$m" >"$$bn.$$ext.txt"; \ |
| 147 |
rm -f "$$bn.$$ext.txt.gz"; gzip -n9 "$$bn.$$ext.txt"; \ |
| 148 |
do_conversion_verbose "$$bn" "$$ext" "$$m" "$$bn.$$ext.htm"; \ |
| 149 |
rm -f "$$bn.$$ext.htm.gz"; gzip -n9 "$$bn.$$ext.htm"; \ |
| 150 |
done |
| 151 |
.ifdef cats |
| 152 |
. for _m _n in ${CATS_PAGES} |
| 153 |
mv -f ${_m}.cat${_n}.gz ${_m}-${cats}.cat${_n}.gz |
| 154 |
mv -f ${_m}.${_n}.htm.gz ${_m}-${cats}.htm.gz |
| 155 |
mv -f ${_m}.${_n}.pdf ${_m}-${cats}.pdf |
| 156 |
mv -f ${_m}.${_n}.txt.gz ${_m}-${cats}.txt.gz |
| 157 |
. endfor |
| 158 |
.endif |