rbtree
view Makefile.in @ 12:ea44ca011995
fixed the vis makefile
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 18 Jan 2014 15:26:11 +0200 |
parents | 56a08d00bb41 |
children |
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 = lib$(name).a
13 lib_so = lib$(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 $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
44 cp src/rbtree.h $(DESTDIR)$(PREFIX)/include/rbtree.h
45 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
46 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
47 [ -n "$(soname)" ] \
48 && cd $(DESTDIR)$(PREFIX)/lib \
49 && rm -f $(soname) $(devlink) \
50 && ln -s $(lib_so) $(soname) \
51 && ln -s $(soname) $(devlink) \
52 || true
54 .PHONY: uninstall
55 uninstall:
56 rm -f $(DESTDIR)$(PREFIX)/include/rbtree.h
57 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
58 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
59 [ -n "$(soname)" ] \
60 && rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) \
61 && rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) \
62 || true