summaryrefslogtreecommitdiffstats
path: root/dist/freebsd/devel/kBuild/Makefile
blob: 9ebae0b53c45172b4281462e0f90ff1e840ae249 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# New ports collection makefile for:	kbuild
# Date created:		Mon Jul 28 14:34:33 BST 2008
# Whom:			Bruce Simpson
#
# $FreeBSD: ports/devel/kBuild/Makefile,v 1.4 2008/12/02 23:14:19 gahr Exp $
#

PORTNAME=	kBuild
PORTVERSION=	0.1.5
CATEGORIES=	devel
MASTER_SITES=	ftp://ftp.netlabs.org/pub/kbuild/
DISTNAME=	${PORTNAME}-${PORTVERSION}-src

MAINTAINER=	que_deseja@hotmail.com
COMMENT=	Makefile framework

USE_AUTOTOOLS=	automake:19 autoconf:261
USE_GMAKE=	yes

WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}

KBUILD_ARCH=	${MACHINE_ARCH:S/i386/x86/}
KBUILD_ENV=	ACLOCAL=${ACLOCAL} \
		AUTOMAKE=${AUTOMAKE} \
		AUTORECONF=${AUTORECONF}
KBUILD_STAGE=   ${WRKSRC}/out/freebsd.${KBUILD_ARCH}/release${PREFIX}

# KBUILD_BINS, KBUILD_DATA_FILES and KBUILD_DOC_FILES (generated).
.include "kBuild-files.mk"

# Override autotools
run-autotools:
do-configure:

do-build:
	cd ${WRKSRC} && ${SETENV} ${KBUILD_ENV} ./kBuild/env.sh --full \
		${GMAKE} NIX_INSTALL_DIR=${PREFIX} -f bootstrap.gmk
	${WRKSRC}/kBuild/env.sh --full-with-bin \
		kmk -C ${WRKSRC} NIX_INSTALL_DIR=${PREFIX}

do-install:
.for file in ${KBUILD_BIN_FILES}
	${INSTALL_PROGRAM} ${KBUILD_STAGE}/bin/${file} ${PREFIX}/bin/${file}
.endfor
	${MKDIR} ${DATADIR}
.for file in ${KBUILD_DATA_FILES}
	${MKDIR} `dirname ${DATADIR}/${file}`
	${INSTALL_DATA} ${KBUILD_STAGE}/share/kBuild/${file} ${DATADIR}/${file}
.endfor
	${MKDIR} ${DOCSDIR}
.for file in ${KBUILD_DOC_FILES}
	${MKDIR} `dirname ${DOCSDIR}/${file}`
	${INSTALL_DATA} ${KBUILD_STAGE}/share/doc/kBuild-${PORTVERSION}/${file} ${DOCSDIR}/${file}
.endfor


.include <bsd.port.mk>

#
# Helper rule to generate kBuild-files.mk and pkg-plist when updating the port.
#
kbuild-generate-files:
	echo '# Autogenerated by kbuild-generate-files in Makefile' > kBuild-files.mk
	echo '' >> kBuild-files.mk
	echo 'KBUILD_BIN_FILES = \' >> kBuild-files.mk
	${WRKSRC}/kBuild/env.sh --full-with-bin --quiet \
		kmk --no-print-directory -sC ${WRKSRC} NIX_INSTALL_DIR=${PREFIX} \
		MY_INST_BIN=_keep_/ MY_INST_DATA=_drop_/ MY_INST_DOC=_drop_/ \
		kbuild-show-install-files \
		| sed -e '/^_drop_/d' -e 's/^_keep_\//	/' -e 's/$$/ \\/' \
		>> kBuild-files.mk
	echo '' >> kBuild-files.mk
	echo 'KBUILD_DATA_FILES = \' >> kBuild-files.mk
	${WRKSRC}/kBuild/env.sh --full-with-bin --quiet \
		kmk --no-print-directory -sC ${WRKSRC} NIX_INSTALL_DIR=${PREFIX} \
		MY_INST_BIN=_drop_/ MY_INST_DATA=_keep_/ MY_INST_DOC=_drop_/ \
		kbuild-show-install-files \
		| sed -e '/^_drop_/d' -e 's/^_keep_\//	/' -e 's/$$/ \\/' \
		>> kBuild-files.mk
	echo '' >> kBuild-files.mk
	echo 'KBUILD_DOC_FILES = \' >> kBuild-files.mk
	${WRKSRC}/kBuild/env.sh --full-with-bin --quiet \
		kmk --no-print-directory -sC ${WRKSRC} NIX_INSTALL_DIR=${PREFIX} \
		MY_INST_BIN=_drop_/ MY_INST_DATA=_drop_/ MY_INST_DOC=_keep_/ \
		kbuild-show-install-files \
		| sed -e '/^_drop_/d' -e 's/^_keep_\//	/' -e 's/$$/ \\/' \
		>> kBuild-files.mk
	echo '' >> kBuild-files.mk

	${WRKSRC}/kBuild/env.sh --full-with-bin --quiet \
		kmk --no-print-directory -sC ${WRKSRC} NIX_INSTALL_DIR=${PREFIX} \
		'MY_INST_BIN=bin/' 'MY_INST_DATA=%%DATADIR%%/' \
		'MY_INST_DOC=%%DOCSDIR%%/' kbuild-show-install-files \
		> pkg-plist
	echo '@dirrm %%DATADIR%%/msgstyles' >> pkg-plist
	echo '@dirrm %%DATADIR%%/sdks' >> pkg-plist
	echo '@dirrm %%DATADIR%%/templates' >> pkg-plist
	echo '@dirrm %%DATADIR%%/tools' >> pkg-plist
	echo '@dirrm %%DATADIR%%/units' >> pkg-plist
	echo '@dirrm %%DATADIR%%' >> pkg-plist
	echo '@dirrm %%DOCSDIR%%' >> pkg-plist