libanim

view Makefile.in @ 71:81103a24a16c

changed macosx dylib name to libanim.dylib
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 May 2014 22:51:25 +0300
parents fad4701f484e
children 769ae86eee31
line source
1 src = $(wildcard src/*.c)
2 hdr = src/track.h src/anim.h src/config.h
3 obj = $(src:.c=.o)
4 dep = $(obj:.o=.d)
5 lib_a = libanim.a
7 ifeq ($(shell uname -s), Darwin)
8 lib_so = libanim.dylib
9 shared = -dynamiclib
10 else
11 somajor = 0
12 sominor = 1
13 soname = libanim.so.$(somajor)
14 lib_so = $(soname).$(sominor)
15 solink = libanim.so
16 shared = -shared -Wl,-soname,$(soname)
17 endif
20 CC = gcc
21 AR = ar
22 CFLAGS = $(opt) $(dbg) -pedantic -Wall -fPIC -I$(PREFIX)/include
23 LDFLAGS = -L$(PREFIX)/lib -lvmath -lm -lpthread
25 .PHONY: all
26 all: $(lib_a) $(lib_so)
28 $(lib_a): $(obj)
29 $(AR) rcs $@ $(obj)
31 $(lib_so): $(obj)
32 $(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
34 -include $(dep)
36 %.d: %.c
37 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
39 .PHONY: install
40 install: $(lib_a) $(lib_so)
41 mkdir -p $(PREFIX)/lib $(PREFIX)/include/anim
42 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
43 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
44 [ -n "$(solink)" ] && rm -f $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
45 && ln -s $(PREFIX)/lib/$(lib_so) $(PREFIX)/lib/$(soname) \
46 && ln -s $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
47 || true
48 cp $(hdr) $(PREFIX)/include/anim/
50 .PHONY: uninstall
51 uninstall:
52 rm -f $(PREFIX)/lib/$(lib_a)
53 rm -f $(PREFIX)/lib/$(lib_so)
54 rm -f $(PREFIX)/include/anim/*.h
55 rmdir $(PREFIX)/include/anim
57 .PHONY: clean
58 clean:
59 rm -f $(obj) $(lib_so) $(lib_a)
61 .PHONY: distclean
62 distclean: clean
63 rm -f Makefile