rbtree
view Makefile.in @ 7:2c0baa1fd419
del_tree would call 0 if the del func is null
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 21 Oct 2011 11:32:38 +0300 |
parents | 6621337b6378 |
children | b266386d19ce |
line source
1 src = $(wildcard src/*.c)
2 obj = $(src:.c=.o)
3 dep = $(obj:.o=.d)
5 name = rbtree
7 AR = ar
8 CC = gcc
9 CFLAGS = -pedantic -Wall $(dbg) $(opt) -fPIC
11 ifeq ($(shell uname -s), Darwin)
12 lib_a = $(name).a
13 lib_so = $(name).dylib
14 shared = -dynamiclib
15 else
16 lib_a = lib$(name).a
17 devlink = lib$(name).so
18 soname = $(devlink).0
19 lib_so = $(soname).0
20 shared = -shared -Wl,-soname=$(soname)
21 endif
23 .PHONY: all
24 all: $(lib_so) $(lib_a)
26 $(lib_a): $(obj)
27 $(AR) rcs $(lib_a) $(obj)
29 $(lib_so): $(obj)
30 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
32 -include $(dep)
34 %.d: %.c
35 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
37 .PHONY: clean
38 clean:
39 rm -f $(obj) $(lib_a) $(lib_so)
41 .PHONY: install
42 install:
43 mkdir -p $(PREFIX)/include $(PREFIX)/lib
44 cp src/rbtree.h $(PREFIX)/include/rbtree.h
45 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
46 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
47 [ -n "$(soname)" ] \
48 && rm -f $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(devlink) \
49 && ln -s $(PREFIX)/lib/$(lib_so) $(PREFIX)/lib/$(soname) \
50 && ln -s $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(devlink) \
51 || true
53 .PHONY: uninstall
54 rm -f $(PREFIX)/include/rbtree.h
55 rm -f $(PREFIX)/lib/$(lib_a)
56 rm -f $(PREFIX)/lib/$(lib_so)
57 rm -f $(PREFIX)/lib/$(soname)
58 rm -f $(PREFIX)/lib/$(devlink)