summaryrefslogtreecommitdiffstats
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
authorasami <asami@FreeBSD.org>2000-04-04 07:05:36 +0000
committerasami <asami@FreeBSD.org>2000-04-04 07:05:36 +0000
commite0fd5931dd56e0e45f3c06ba85f81cd694a59269 (patch)
tree83e232b03dd89f4c60a063234db36cc88576cc48 /Mk/bsd.port.mk
parentf925ae34429d893ac64f187b800e053440e49a26 (diff)
downloadFreeBSD-ports-e0fd5931dd56e0e45f3c06ba85f81cd694a59269.zip
FreeBSD-ports-e0fd5931dd56e0e45f3c06ba85f81cd694a59269.tar.gz
(1) Change the way the port name and version is specified.
New variables: PORTNAME - Base name of port PORTVERSION - Version of port Modified variables: PKGNAME - Always ${PORTNAME}-${PORTVERSION}; error to override this DISTNAME - Defaults to ${PKGNAME} Right now old style is still accepted (unless REQUIRE_PORTNAME is defined) but all port Makefiles will be converted this weekend and bsd.port.mk will be changed again to have the new style be mandatory. Reviewed by: the ports list, mharo in particular (2) Change "clean" to be more generic -- it now has pre-clean/post-clean helpers (it only had pre-clean before) and the actual work is in do-clean so porters can redefine it if necessary. Requested by: "Matthew N. Dodd" <winter@jurai.net> Reviewed by: dirk
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r--Mk/bsd.port.mk59
1 files changed, 42 insertions, 17 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 7eb732a..2433773 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -41,10 +41,13 @@ FreeBSD_MAINTAINER= asami@FreeBSD.org
#
# These variables are used to identify your port.
#
-# DISTNAME - Name of port or distribution.
-# PKGNAME - Name of the package file to create if the DISTNAME
-# isn't really relevant for the port/package
-# (default: ${DISTNAME}).
+# PORTNAME - Name of software.
+# PORTVERSION - Version of software.
+# PKGNAME - Always defined as ${PORTNAME}-${PORTVERSION}. Do not
+# define this in your Makefile.
+# DISTNAME - Name of port or distribution used in generating
+# WRKSRC and DISTFILES below (default:
+# ${PORTNAME}-${PORTVERSION}).
# CATEGORIES - A list of descriptive categories into which this port falls.
#
# These variable describe how to fetch files required for building the port.
@@ -1098,10 +1101,26 @@ FETCH_BEFORE_ARGS+= -l
.endif
.endif
-# Derived names so that they're easily overridable.
-DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
+.if defined(REQUIRE_PORTNAME) && !defined(PORTNAME)
+.BEGIN:
+ @${ECHO} "${PKGNAME}: You need to define PORTNAME and PORTVERSION instead of PKGNAME."
+ @${ECHO} "(This port is too old for your bsd.port.mk.)"
+ @${FALSE}
+.endif
+.if defined(PORTNAME)
+.if defined(PKGNAME) || !defined(PORTVERSION)
+.BEGIN:
+ @${ECHO} "${PKGNAME}: You need to define PORTNAME and PORTVERSION instead of PKGNAME."
+ @${FALSE}
+.endif
+PKGNAME= ${PORTNAME}-${PORTVERSION}
+DISTNAME?= ${PKGNAME}
+.else
+# old style
PKGNAME?= ${DISTNAME}
+.endif
+DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
ALLFILES?= ${DISTFILES} ${PATCHFILES}
.if defined(IGNOREFILES)
@@ -2068,17 +2087,8 @@ deinstall:
# Cleaning up
-.if !target(pre-clean)
-pre-clean:
- @${DO_NADA}
-.endif
-
-.if !target(clean)
-clean: pre-clean
-.if !defined(NOCLEANDEPENDS)
- @${MAKE} ${__softMAKEFLAGS} clean-depends
-.endif
- @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
+.if !target(do-clean)
+do-clean:
@if [ -d ${WRKDIR} ]; then \
if [ -w ${WRKDIR} ]; then \
${RM} -rf ${WRKDIR}; \
@@ -2088,6 +2098,21 @@ clean: pre-clean
fi
.endif
+.if !target(clean)
+clean:
+.if !defined(NOCLEANDEPENDS)
+ @${MAKE} ${__softMAKEFLAGS} clean-depends
+.endif
+ @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
+.if target(pre-clean)
+ @${MAKE} ${__softMAKEFLAGS} pre-clean
+.endif
+ @${MAKE} ${__softMAKEFLAGS} do-clean
+.if target(post-clean)
+ @${MAKE} ${__softMAKEFLAGS} post-clean
+.endif
+.endif
+
.if !target(pre-distclean)
pre-distclean:
@${DO_NADA}
OpenPOWER on IntegriCloud