fix install, dist and clean targets
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
diff --git a/Makefile b/Makefile
index 6027b2e..636ba3b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,10 +17,12 @@
PROG = git-auth
-DEBUG = -g -DDEBUG
-WARNINGS = yes
+BINDIR ?= /usr/local/bin
-CFLAGS += -W -Wall -Werror
+DEBUG ?= -g -DDEBUG
+WARNINGS ?= yes
+
+CDIAGFLAGS ?= -W -Wall -Werror
SRCS = git-auth.c \
rule.c rule.h \
@@ -30,15 +32,28 @@ SRCS = git-auth.c \
VER = 0.1
-dist: ${PROG}-${VER}.tar.gz
+build: ${PROG}
+
+DISTDIR = ${PROG}-${VER}
+DIST = ${DISTDIR}.tar.gz
+dist: ${DIST}
DISTFILES = ${SRCS} ${PROG}.1 Makefile
-${PROG}-${VER}.tar.gz: ${DISTFILES}
+${DIST}: ${DISTFILES}
mkdir ${PROG}-${VER}
- cp ${DISTFILES} ${PROG}-${VER}
+ cd ${.CURDIR} && cp ${DISTFILES} ${.OBJDIR}/${PROG}-${VER}
tar czf $@.tmp ${PROG}-${VER}
rm -rf ${PROG}-${VER}
mv $@.tmp $@
+cleandir: cleandist
+
+cleandist:
+ rm -rf ${DISTDIR}
+
+.PHONY: cleandist
+
+CLEANFILES += ${DIST}
+
.include <bsd.prog.mk>