OpenBSD-4.6/usr.bin/less/Makefile.bsd-wrapper

#	$OpenBSD: Makefile.bsd-wrapper,v 1.23 2007/11/03 15:15:40 espie Exp $

#
# less config
#
PREFIX=		/usr
BINDIR=		${PREFIX}/bin
DATADIR=	${PREFIX}/share/misc
LIBS=		-lcurses
LESS_HLP=	more.help
LINKS=		${BINDIR}/less ${BINDIR}/more ${BINDIR}/less ${BINDIR}/page
MAN=		less.1 lesskey.1
MLINKS=		less.1 more.1 less.1 page.1
CLEANFILES=	config.cache config.log

#
# Wrapped flags
#
XCFLAGS= CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDFLAGS} ${LDSTATIC}"

all: config.status gnu_build

.FORCE: .IGNORE

.include <bsd.own.mk>

.ifdef GLOBAL_AUTOCONF_CACHE
CF=     --cache-file=${GLOBAL_AUTOCONF_CACHE}
.else
CF=	--cache-file=config.cache
.endif

HOST_ARCH!=arch -s
.if    (${MACHINE_ARCH} != ${HOST_ARCH})
CF+=   --target=openbsd-${MACHINE_ARCH} --host=${HOST_ARCH}
.endif

config: .FORCE
.ifndef GLOBAL_AUTOCONF_CACHE
	-rm -f config.cache
.endif
	${XCFLAGS} PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
		TERMLIBS=-lcurses /bin/sh ${.CURDIR}/configure \
		--prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc ${CF}

config.status:
	${XCFLAGS} PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
		TERMLIBS=-lcurses /bin/sh ${.CURDIR}/configure \
		--prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc ${CF}

gnu_build: config.status
	${MAKE} ${XCFLAGS} LIBS=${LIBS} datadir=${DATADIR} LESS_HLP=${LESS_HLP}

.ifdef NOMAN
maninstall:
	@echo NOMAN is set
.endif

install: gnu_install maninstall afterinstall _SUBDIRUSE
.if defined(LINKS) && !empty(LINKS)
	@set ${LINKS}; \
	while test $$# -ge 2; do \
		l=${DESTDIR}$$1; \
		shift; \
		t=${DESTDIR}$$1; \
		shift; \
		echo $$t -\> $$l; \
		rm -f $$t; \
		ln $$l $$t; \
	done; true
.endif

gnu_install:
	${MAKE} ${XCFLAGS} LIBS=${LIBS} \
		LESS_HLP=${LESS_HLP} bindir=${DESTDIR}${BINDIR} \
		datadir=${DESTDIR}${PREFIX}/share/misc \
		INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}" \
		INSTALL_DATA="${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444" \
		INSTALL_MAN= INSTALLDIRS= install

clean cleandir:
	rm -f ${CLEANFILES}
	-@if [ -e Makefile ]; then ${MAKE} distclean; fi

afterinstall:
	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
		${.CURDIR}/less.hlp ${DESTDIR}${DATADIR}/${LESS_HLP}

depend:
	# Nothing here so far...

lint:
	# Nothing here so far...

tags:
	# Nothing here so far...

.include <bsd.obj.mk>
.include <bsd.subdir.mk>
.if !defined(NOMAN)
.include <bsd.man.mk>
.endif