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
|
OBJS = ebtree.o eb32tree.o eb64tree.o ebmbtree.o ebsttree.o ebimtree.o ebistree.o
CFLAGS = -O3
EXAMPLES = $(basename $(wildcard examples/*.c))
all: libebtree.a
examples: ${EXAMPLES}
libebtree.a: $(OBJS)
$(AR) rv $@ $^
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $^
examples/%: examples/%.c libebtree.a
$(CC) $(CFLAGS) -I. -o $@ $< -L. -lebtree
test: test32 test64 testst
test%: test%.c libebtree.a
$(CC) $(CFLAGS) -o $@ $< -L. -lebtree
clean:
-rm -fv libebtree.a $(OBJS) *~ *.rej core test32 test64 testst ${EXAMPLES}
ifeq ($(wildcard .git),.git)
VERSION := $(shell [ -d .git/. ] && ref=`(git describe --tags --match 'v*') 2>/dev/null` && ref=$${ref%-g*} && echo "$${ref\#v}")
SUBVERS := $(shell comms=`git log --no-merges v$(VERSION).. 2>/dev/null |grep -c ^commit `; [ $$comms -gt 0 ] && echo "-$$comms" )
endif
git-tar: .git
git archive --format=tar --prefix="ebtree-$(VERSION)/" HEAD | gzip -9 > ebtree-$(VERSION)$(SUBVERS).tar.gz
.PHONY: examples tests
|