libmagic(3): Separate hostprog.
authorzrj <rimvydas.jasinskas@gmail.com>
Wed, 25 Apr 2018 16:19:40 +0000 (19:19 +0300)
committerzrj <zrj@dragonflybsd.org>
Wed, 25 Apr 2018 18:19:09 +0000 (21:19 +0300)
Set WARNS=1 for mkmagic.nx so as not to use -w.

lib/libmagic/Makefile
lib/libmagic/Makefile.inc [new file with mode: 0644]
lib/libmagic/libmagic/Makefile [copied from lib/libmagic/Makefile with 84% similarity]
lib/libmagic/libmagic/config.h [moved from lib/libmagic/config.h with 100% similarity]
lib/libmagic/mkmagic/Makefile [new file with mode: 0644]
usr.bin/file/Makefile

index ab097b4..cad12d3 100644 (file)
@@ -1,80 +1,3 @@
-CONTRIBDIR=    ${.CURDIR}/../../contrib/file/src
-MAGICDIR= ${CONTRIBDIR}/../magic
-.PATH: ${CONTRIBDIR}
-
-VER!=  grep -w VERSION ${.CURDIR}/config.h | awk -F\" '{print $$2}'
-MAGICSHAREDIR=${SHAREDIR}/misc
-MAGIC= ${MAGICSHAREDIR}/magic
-
-LIB=   magic
-SHLIB_MAJOR=   2
-
-DPADD= ${LIBZ}
-LDADD= -lz
-
-SRCS=  apprentice.c ascmagic.c cdf.c cdf_time.c \
-       compress.c der.c encoding.c fsmagic.c funcs.c \
-       is_tar.c magic.c print.c readcdf.c readelf.c softmagic.c
-INCS=  magic.h
-
-# only when __EMX__ (prog env for DOS and OS/2)
-#SRCS+=        apptype.c
-
-CFLAGS+= -DHAVE_CONFIG_H -DMAGIC=\"${MAGIC}\"
-CFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${CONTRIBDIR}
-
-MAN=   libmagic.3
-
-MLINKS+=       libmagic.3 magic_open.3
-MLINKS+=       libmagic.3 magic_close.3
-MLINKS+=       libmagic.3 magic_error.3
-MLINKS+=       libmagic.3 magic_errno.3
-MLINKS+=       libmagic.3 magic_descriptor.3
-MLINKS+=       libmagic.3 magic_file.3
-MLINKS+=       libmagic.3 magic_buffer.3
-MLINKS+=       libmagic.3 magic_getflags.3
-MLINKS+=       libmagic.3 magic_setflags.3
-MLINKS+=       libmagic.3 magic_check.3
-MLINKS+=       libmagic.3 magic_compile.3
-MLINKS+=       libmagic.3 magic_list.3
-MLINKS+=       libmagic.3 magic_load.3
-MLINKS+=       libmagic.3 magic_load_buffers.3
-MLINKS+=       libmagic.3 magic_setparam.3
-MLINKS+=       libmagic.3 magic_getparam.3
-MLINKS+=       libmagic.3 magic_version.3
-
-CLEANFILES+=   magic magic.mgc libmagic.3
-
-.if !defined(NO_SHARE)
-FILES=         magic magic.mgc
-FILESDIR=      ${MAGICSHAREDIR}
-.endif
-
-MAGFILES=      ${MAGICDIR}/Header ${MAGICDIR}/Localstuff \
-               ${MAGICDIR}/Magdir/[a-z]*
-
-libmagic.3: ${CONTRIBDIR}/../doc/libmagic.man
-           sed -e s@__CSECTION__@1@g \
-               -e s@__FSECTION__@5@g \
-               -e s@__MAGIC__@${MAGIC}@g ${.ALLSRC} > ${.TARGET}
-
-magic: ${MAGFILES}
-       cat ${.ALLSRC} > ${.TARGET}
-
-magic.mgc: mkmagic.nx magic
-       ./mkmagic.nx magic
-
-CLEANFILES+=   mkmagic.nx
-build-tools: mkmagic.nx
-
-NXCFLAGS+=     -w -DCOMPILE_ONLY
-mkmagic.nx: apprentice.c encoding.c cdf_time.c funcs.c magic.c print.c ${INCS}
-       ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.ALLSRC:N*.h} ${NXLDLIBS} -o ${.TARGET}
-
-CLEANFILES+=   ${INCS}
-.for inc in ${INCS}
-${inc}: ${inc}.in
-       sed -e 's,X.YY,${VER:S,",,g:S,.,,g},g' ${.ALLSRC} > ${.TARGET}
-.endfor
-
-.include <bsd.lib.mk>
+SUBDIR=                mkmagic
+SUBDIR+=       libmagic
+.include <bsd.subdir.mk>
diff --git a/lib/libmagic/Makefile.inc b/lib/libmagic/Makefile.inc
new file mode 100644 (file)
index 0000000..01b5f23
--- /dev/null
@@ -0,0 +1 @@
+.include "../Makefile.inc"
similarity index 84%
copy from lib/libmagic/Makefile
copy to lib/libmagic/libmagic/Makefile
index ab097b4..27c3a02 100644 (file)
@@ -1,4 +1,4 @@
-CONTRIBDIR=    ${.CURDIR}/../../contrib/file/src
+CONTRIBDIR=    ${.CURDIR}/../../../contrib/file/src
 MAGICDIR= ${CONTRIBDIR}/../magic
 .PATH: ${CONTRIBDIR}
 
@@ -61,15 +61,8 @@ libmagic.3: ${CONTRIBDIR}/../doc/libmagic.man
 magic: ${MAGFILES}
        cat ${.ALLSRC} > ${.TARGET}
 
-magic.mgc: mkmagic.nx magic
-       ./mkmagic.nx magic
-
-CLEANFILES+=   mkmagic.nx
-build-tools: mkmagic.nx
-
-NXCFLAGS+=     -w -DCOMPILE_ONLY
-mkmagic.nx: apprentice.c encoding.c cdf_time.c funcs.c magic.c print.c ${INCS}
-       ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} ${.ALLSRC:N*.h} ${NXLDLIBS} -o ${.TARGET}
+magic.mgc: magic encoding.c magic.c
+       ${.OBJDIR}/../mkmagic/mkmagic.nx ${.OBJDIR}/magic
 
 CLEANFILES+=   ${INCS}
 .for inc in ${INCS}
diff --git a/lib/libmagic/mkmagic/Makefile b/lib/libmagic/mkmagic/Makefile
new file mode 100644 (file)
index 0000000..7dad905
--- /dev/null
@@ -0,0 +1,19 @@
+CONTRIBDIR=    ${.CURDIR}/../../../contrib/file/src
+.PATH: ${CONTRIBDIR}
+
+PROG=  mkmagic
+SRCS=  apprentice.c encoding.c cdf_time.c funcs.c magic.c print.c
+
+MAGICSHAREDIR=${SHAREDIR}/misc
+MAGIC= ${MAGICSHAREDIR}/magic
+
+CFLAGS+=       -DHAVE_CONFIG_H -DCOMPILE_ONLY -DMAGIC=\"${MAGIC}\"
+CFLAGS+=       -I${.CURDIR}/../libmagic
+
+# XXX -Wunused-function in apprentice.c
+WARNS= 1
+
+# this mkmagic is used in place, it is not installed anywhere
+install:
+
+.include <bsd.hostprog.mk>
index ab6c6ac..02f0189 100644 (file)
@@ -1,9 +1,7 @@
-# $DragonFly: src/usr.bin/file/Makefile,v 1.9 2007/08/27 16:50:53 pavalos Exp $
-
 CONTRIBDIR=    ${.CURDIR}/../../contrib/file
 .PATH: ${CONTRIBDIR}/src
 
-LIBMAGICDIR=   ${.CURDIR}/../../lib/libmagic
+LIBMAGICDIR=   ${.CURDIR}/../../lib/libmagic/libmagic
 CS=    1
 FS=    5
 VER!=  grep -w VERSION ${LIBMAGICDIR}/config.h | awk -F\" '{print $$2}'