libanim
view Makefile.in @ 0:fad4701f484e
libanim mercurial repo
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Sun, 08 Jan 2012 05:13:13 +0200 |
parents | |
children | f12663c5c907 |
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 = anim.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