rbtree

annotate Makefile.in @ 15:1b77b72688fe

- fixed bug in rb_init making it ignore comparison functions other than the builtin - fixed rb_find and rb_findi return type, which should be struct rbnode*, not void*
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Nov 2014 11:00:27 +0200
parents 56a08d00bb41
children
rev   line source
nuclear@0 1 src = $(wildcard src/*.c)
nuclear@0 2 obj = $(src:.c=.o)
nuclear@0 3 dep = $(obj:.o=.d)
nuclear@0 4
nuclear@0 5 name = rbtree
nuclear@0 6
nuclear@0 7 AR = ar
nuclear@0 8 CC = gcc
nuclear@0 9 CFLAGS = -pedantic -Wall $(dbg) $(opt) -fPIC
nuclear@0 10
nuclear@0 11 ifeq ($(shell uname -s), Darwin)
nuclear@8 12 lib_a = lib$(name).a
nuclear@8 13 lib_so = lib$(name).dylib
nuclear@5 14 shared = -dynamiclib
nuclear@0 15 else
nuclear@0 16 lib_a = lib$(name).a
nuclear@0 17 devlink = lib$(name).so
nuclear@0 18 soname = $(devlink).0
nuclear@0 19 lib_so = $(soname).0
nuclear@0 20 shared = -shared -Wl,-soname=$(soname)
nuclear@0 21 endif
nuclear@0 22
nuclear@0 23 .PHONY: all
nuclear@0 24 all: $(lib_so) $(lib_a)
nuclear@0 25
nuclear@0 26 $(lib_a): $(obj)
nuclear@0 27 $(AR) rcs $(lib_a) $(obj)
nuclear@0 28
nuclear@0 29 $(lib_so): $(obj)
nuclear@0 30 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@0 31
nuclear@0 32 -include $(dep)
nuclear@0 33
nuclear@0 34 %.d: %.c
nuclear@0 35 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 36
nuclear@0 37 .PHONY: clean
nuclear@0 38 clean:
nuclear@0 39 rm -f $(obj) $(lib_a) $(lib_so)
nuclear@0 40
nuclear@0 41 .PHONY: install
nuclear@0 42 install:
nuclear@8 43 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
nuclear@8 44 cp src/rbtree.h $(DESTDIR)$(PREFIX)/include/rbtree.h
nuclear@8 45 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@8 46 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@0 47 [ -n "$(soname)" ] \
nuclear@8 48 && cd $(DESTDIR)$(PREFIX)/lib \
nuclear@8 49 && rm -f $(soname) $(devlink) \
nuclear@8 50 && ln -s $(lib_so) $(soname) \
nuclear@8 51 && ln -s $(soname) $(devlink) \
nuclear@0 52 || true
nuclear@0 53
nuclear@0 54 .PHONY: uninstall
nuclear@8 55 uninstall:
nuclear@8 56 rm -f $(DESTDIR)$(PREFIX)/include/rbtree.h
nuclear@8 57 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@8 58 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@8 59 [ -n "$(soname)" ] \
nuclear@8 60 && rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) \
nuclear@8 61 && rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) \
nuclear@8 62 || true