Commits

Marcus von Appen  committed ce37cf6

- minor improvements to the GNU/BSD build tools

  • Participants
  • Parent commits 5e86682

Comments (0)

Files changed (3)

+VERSION=	1.0.0
+NAME=		dmb
+DISTNAME=	${NAME}-${VERSION}
+
 # Directories
 SRCDIR=		${.CURDIR}
 ALLDIRS!=	find ${SRCDIR} -type d -not -path "./.hg*"
 DOCDIR=		${SRCDIR}/doc
 # Packages
 ROOTPKG=	${SRCDIR:S/${GOPATH}\/src\///}
-DEPLOYDIR=	${SRCDIR}/deploy
+DEPLOYDIR?=	${SRCDIR}/deploy
 # Some cleanups
 CLEANUP=	*.cache *.core *~ *.orig
 
-NAME=	dmb
+ZIP?= zip -qr9
+TAR?= tar -cJf
 GO?=	go
 
-.PHONY:	doc
-
-all: clean build
-
-clean:
-	@echo "Cleaning up..."
-	@for dir in ${ALLDIRS}; do \
-		cd $$dir && rm -f ${CLEANUP} && cd ${SRCDIR}; \
-	done
-	@rm -rf ${DEPLOYDIR}
-	@rm -rf ${DOCDIR}/_build
-
-build:
-	@mkdir -p ${DEPLOYDIR};
-	@echo "Building application ${NAME}...";
-	@${GO} build -o ${DEPLOYDIR}/${NAME} ${ROOTPKG};
-	@cp -rf ${SRCDIR}/data/* ${DEPLOYDIR};
-
-doc:
-	cd ${DOCDIR} && make html;
-
-run: build
-	cd ${DEPLOYDIR} && ./${NAME};
+.include "${SRCDIR}/build.mk"
+VERSION=	1.0.0
+NAME=		dmb
+DISTNAME=	${NAME}-${VERSION}
+
 # Directories
 SRCDIR=		${CURDIR}
 ALLDIRS!=	find ${SRCDIR} -type d -not -path "./.hg*"
 DOCDIR=		${SRCDIR}/doc
 # Packages
 ROOTPKG=	$(subst ${GOPATH}/src/,,${SRCDIR})
-DEPLOYDIR=	${SRCDIR}/deploy
+DEPLOYDIR?=	${SRCDIR}/deploy
 # Some cleanups
 CLEANUP=	*.cache *.core *~ *.orig
 
-NAME=	dmb
+ZIP?= zip -qr9
+TAR?= tar -cJf
 GO?=	go
 
-.PHONY:	doc
-
-all: clean build
-
-clean:
-	@echo "Cleaning up..."
-	@for dir in ${ALLDIRS}; do \
-		cd $$dir && rm -f ${CLEANUP} && cd ${SRCDIR}; \
-	done
-	@rm -rf ${DEPLOYDIR}
-	@rm -rf ${DOCDIR}/_build
-
-build:
-	@mkdir -p ${DEPLOYDIR};
-	@echo "Building application ${NAME}...";
-	@${GO} build -o ${DEPLOYDIR}/${NAME} ${ROOTPKG};
-	@cp -rf ${SRCDIR}/data/* ${DEPLOYDIR};
-
-doc:
-	@cd ${DOCDIR} && make html;
-	
-run: build
-	cd ${DEPLOYDIR} && ./${NAME};
-
+include ${SRCDIR}/build.mk
+.PHONY:	doc
+
+all: clean build
+
+clean:
+	@echo "Cleaning up..."
+	@for dir in ${ALLDIRS}; do \
+		cd $$dir && rm -f ${CLEANUP} && cd ${SRCDIR}; \
+	done
+	@rm -rf ${DEPLOYDIR}
+	@rm -rf ${DOCDIR}/_build
+
+build:
+	@mkdir -p ${DEPLOYDIR};
+	@echo "Building application ${NAME}...";
+	@${GO} build -o ${DEPLOYDIR}/${NAME} ${ROOTPKG};
+	@cp -rf ${SRCDIR}/data/* ${DEPLOYDIR};
+
+doc:
+	@cd ${DOCDIR} && make html;
+
+run: build
+	cd ${DEPLOYDIR} && ./${NAME};
+
+dist: clean
+	@DEPLOYDIR=${DEPLOYDIR}/${DISTNAME} make build
+	@cd ${DEPLOYDIR}; \
+		echo "Creating ZIP package"; \
+		${ZIP} ${DISTNAME}-${GOOS}_${GOARCH}.zip ${DISTNAME}; \
+		echo "Creating TAR package"; \
+		${TAR} ${DISTNAME}-${GOOS}_${GOARCH}.tar.xz ${DISTNAME};