From: Mike Lowis Date: Wed, 30 Dec 2015 12:55:36 +0000 (+0000) Subject: Added distribution tarball tasks X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=d633e7e7e47726e0748c4e6c037b2fc5f9fa88d3;p=archive%2Fcarl.git Added distribution tarball tasks --- diff --git a/Makefile b/Makefile index 686eb19..1e516d9 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ #------------------------------------------------------------------------------ # Update these variables according to your requirements. +# version +VERSION = 0.0.1 + # tools CC = c99 LD = ${CC} @@ -22,44 +25,45 @@ ARCHIVE = @echo AR $@; ${AR} ${ARFLAGS} $@ $^ CLEAN = @rm -f #------------------------------------------------------------------------------ -# Build Targets and Rules +# Build-Specific Macros #------------------------------------------------------------------------------ +# Library macros and rules LIBNAME = carl -LIB = lib${LIBNAME}.a - -DEPS = ${OBJS:.o=.d} -OBJS = source/data/bstree.o \ - source/data/hash.o \ - source/data/list.o \ - source/data/slist.o \ - source/data/vec.o \ - source/main.o \ - source/refcount.o \ - source/utf/chartorune.o \ - source/utf/fullrune.o \ - source/utf/runecmp.o \ - source/utf/runeinrange.o \ - source/utf/runelen.o \ - source/utf/runenlen.o \ - source/utf/runetochar.o \ - source/utf/runetype/alphas.o \ - source/utf/runetype/controls.o \ - source/utf/runetype/digits.o \ - source/utf/runetype/lowers.o \ - source/utf/runetype/marks.o \ - source/utf/runetype/numbers.o \ - source/utf/runetype/other.o \ - source/utf/runetype/otherletters.o \ - source/utf/runetype/punctuation.o \ - source/utf/runetype/spaces.o \ - source/utf/runetype/symbols.o \ - source/utf/runetype/titles.o \ - source/utf/runetype/tolower.o \ - source/utf/runetype/totitle.o \ - source/utf/runetype/toupper.o \ - source/utf/runetype/uppers.o \ - source/utf/runetype.o - +LIB = lib${LIBNAME}.a +DEPS = ${OBJS:.o=.d} +OBJS = source/data/bstree.o \ + source/data/hash.o \ + source/data/list.o \ + source/data/slist.o \ + source/data/vec.o \ + source/main.o \ + source/refcount.o \ + source/utf/chartorune.o \ + source/utf/fullrune.o \ + source/utf/runecmp.o \ + source/utf/runeinrange.o \ + source/utf/runelen.o \ + source/utf/runenlen.o \ + source/utf/runetochar.o \ + source/utf/runetype/alphas.o \ + source/utf/runetype/controls.o \ + source/utf/runetype/digits.o \ + source/utf/runetype/lowers.o \ + source/utf/runetype/marks.o \ + source/utf/runetype/numbers.o \ + source/utf/runetype/other.o \ + source/utf/runetype/otherletters.o \ + source/utf/runetype/punctuation.o \ + source/utf/runetype/spaces.o \ + source/utf/runetype/symbols.o \ + source/utf/runetype/titles.o \ + source/utf/runetype/tolower.o \ + source/utf/runetype/totitle.o \ + source/utf/runetype/toupper.o \ + source/utf/runetype/uppers.o \ + source/utf/runetype.o + +# Test binary macros TEST_BIN = test${LIBNAME} TEST_DEPS = ${TEST_OBJS:.o=.d} TEST_OBJS = tests/data/bstree.o \ @@ -71,9 +75,20 @@ TEST_OBJS = tests/data/bstree.o \ tests/utf/test_runes.o \ tests/utf/test_unicodedata.o +# Distribution dir and tarball settings +DISTDIR = ${LIBNAME}-${VERSION} +DISTTAR = ${DISTDIR}.tar +DISTGZ = ${DISTTAR}.gz +DISTFILES = config.mk LICENSE.md Makefile README.md source tests + # load user-specific settings -include config.mk +#------------------------------------------------------------------------------ +# Phony Targets +#------------------------------------------------------------------------------ +.PHONY: all options tests + all: options ${LIB} tests options: @@ -86,26 +101,36 @@ options: @echo " ARFLAGS = ${ARFLAGS}" tests: ${TEST_BIN} + @./${TEST_BIN} -${LIB}: ${OBJS} - ${ARCHIVE} - -${TEST_BIN}: ${TEST_OBJS} ${LIB} - ${LINK} - @./$@ - -.c.o: - ${COMPILE} +dist: clean + @echo DIST ${DISTGZ} + @mkdir -p ${DISTDIR} + @cp -R ${DISTFILES} ${DISTDIR} + @tar -cf ${DISTTAR} ${DISTDIR} + @gzip ${DISTTAR} + @rm -rf ${DISTDIR} clean: ${CLEAN} ${LIB} ${TEST_BIN} ${OBJS} ${TEST_OBJS} ${CLEAN} ${OBJS:.o=.gcno} ${OBJS:.o=.gcda} ${CLEAN} ${TEST_OBJS:.o=.gcno} ${TEST_OBJS:.o=.gcda} ${CLEAN} ${DEPS} ${TEST_DEPS} + ${CLEAN} ${DISTTAR} ${DISTGZ} + +#------------------------------------------------------------------------------ +# Target-Specific Rules +#------------------------------------------------------------------------------ +.c.o: + ${COMPILE} + +${LIB}: ${OBJS} + ${ARCHIVE} + +${TEST_BIN}: ${TEST_OBJS} ${LIB} + ${LINK} # load dependency files -include ${DEPS} -include ${TEST_DEPS} -.PHONY: all options tests -