Commit 96358a2ad649ec2520357470abe3ae86837bf68b

Guillem Jover 2008-07-09T08:47:09

Add support for 'make dist'

diff --git a/Makefile b/Makefile
index db853d8..f28a27c 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,10 @@ LIB_NAME = libbsd
 LIB_VERSION_MAJOR = 0
 LIB_VERSION_MINOR = 0
 
+TAR_NAME = $(LIB_NAME)-$(LIB_VERSION_MAJOR).$(LIB_VERSION_MINOR)
+
+LIB_DIST := Makefile Versions libbsd.pc
+
 LIB_SRCS := arc4random.c bsd_getopt.c err.c fgetln.c heapsort.c \
 	    humanize_number.c inet_net_pton.c \
 	    hash/md5.c hash/md5hl.c \
@@ -64,6 +68,12 @@ $(LIB_SHARED): $(LIB_SHARED_OBJS)
 	  -Wl,--version-script=Versions \
 	  -o $@ $^
 
+dist: clean
+	mkdir $(TAR_NAME)
+	cp -a include src man $(LIB_DIST) $(TAR_NAME)
+	tar czf $(TAR_NAME).tar.gz $(TAR_NAME)
+	rm -rf $(TAR_NAME)
+
 install: libs man
 	mkdir -p $(DESTDIR)/usr/lib/ $(DESTDIR)/lib/
 	mkdir -p $(DESTDIR)/usr/include/bsd/