FreeBSD Handbook : Installing Applications: The Ports collection : Making a port yourself : A Sample Makefile
Previous: Do's and Dont's
Next: Package Names

4.7.9. A Sample Makefile

Here is a sample Makefile that you can use to create a new port. Make sure you remove all the extra comments (ones between brackets)!

It is recommended that you follow this format (ordering of variables, empty lines between sections, etc.). This format is designed so that the most important information is easy to locate. We recommend that you use portlint to check the Makefile.

 [the header...just to make it easier for us to identify the ports.]
 # New ports collection makefile for:	xdvi
 [the version required header should updated when upgrading a port.]
 # Version required:	pl18 [things like "1.5alpha" are fine here too]
 [this is the date when the first version of this Makefile was created. 
  Never change this when doing an update of the port.]
 # Date created:		26 May 1995
 [this is the person who did the original port to FreeBSD, in particular, the
  person who wrote the first version of this Makefile.  Remember, this should
  not be changed when upgrading the port later.]
 # Whom:			Satoshi Asami <asami@FreeBSD.ORG>
 #
 # $Id$
 [ ^^^^ This will be automatically replaced with RCS ID string by CVS 
  when it is committed to our repository.]
 #
 
 [section to describe the port itself and the master site - DISTNAME
  is always first, followed by PKGNAME (if necessary), CATEGORIES,
  and then MASTER_SITES, which can be followed by MASTER_SITE_SUBDIR.
  After those, one of EXTRACT_SUFX or DISTFILES can be specified too.]
 DISTNAME=	xdvi
 PKGNAME=	xdvi-pl18
 CATEGORIES=	print
 [do not forget the trailing slash ("/")! 
  if you aren't using MASTER_SITE_* macros]
 MASTER_SITES=	${MASTER_SITE_XCONTRIB}
 MASTER_SITE_SUBDIR= applications
 [set this if the source is not in the standard ".tar.gz" form]
 EXTRACT_SUFX=	.tar.Z
 
 [section for distributed patches -- can be empty]
 PATCH_SITES=	ftp://ftp.sra.co.jp/pub/X11/japanese/
 PATCHFILES=	xdvi-18.patch1.gz xdvi-18.patch2.gz
 
 [maintainer; *mandatory*!  This is the person (preferably with commit
  privileges) who a user can contact for questions and bug reports - this
  person should be the porter or someone who can forward questions to the
  original porter reasonably promptly.  If you really do not want to have
  your address here, set it to "ports@FreeBSD.ORG".]
 MAINTAINER=	asami@FreeBSD.ORG
 
 [dependencies -- can be empty]
 RUN_DEPENDS=	gs:${PORTSDIR}/print/ghostscript
 LIB_DEPENDS=	Xpm.5:${PORTSDIR}/graphics/xpm
 
 [this section is for other standard bsd.port.mk variables that do not
  belong to any of the above]
 [If it asks questions during configure, build, install...]
 IS_INTERACTIVE=	yes
 [If it extracts to a directory other than ${DISTNAME}...]
 WRKSRC=		${WRKDIR}/xdvi-new
 [If the distributed patches were not made relative to ${WRKSRC}, you
  may need to tweak this]
 PATCH_DIST_STRIP=	-p1
 [If it requires a "configure" script generated by GNU autoconf to be run]
 GNU_CONFIGURE= yes
 [If it requires GNU make, not /usr/bin/make, to build...]
 USE_GMAKE=	yes
 [If it is an X application and requires "xmkmf -a" to be run...]
 USE_IMAKE=	yes
 [et cetera.]
 
 [non-standard variables to be used in the rules below]
 MY_FAVORITE_RESPONSE=	"yeah, right"
 
 [then the special rules, in the order they are called]
 pre-fetch:
	 i go fetch something, yeah
 
 post-patch:
	 i need to do something after patch, great
 
 pre-install:
	 and then some more stuff before installing, wow
 
 [and then the epilogue]
 .include <bsd.port.mk>


FreeBSD Handbook : Installing Applications: The Ports collection : Making a port yourself : A Sample Makefile
Previous: Do's and Dont's
Next: Package Names