#------------------------------------------------------------------------------
# Update these variables according to your requirements.
+# version
+VERSION = 0.0.1
+
# tools
CC = c99
LD = ${CC}
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 \
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:
@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
-