libanim
view Makefile.in @ 78:769ae86eee31
makefile modified to build on mingw
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 16 Sep 2015 04:24:12 +0300 |
parents | f12663c5c907 |
children |
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 sys := $(patsubst MINGW32%,MINGW32,$(shell uname -s))
8 ifeq ($(sys), Darwin)
9 lib_so = libanim.dylib
10 shared = -dynamiclib
11 else ifeq ($(sys), MINGW32)
12 lib_so = libanim.dll
13 shared = -shared
14 else
15 somajor = 0
16 sominor = 1
17 soname = libanim.so.$(somajor)
18 lib_so = $(soname).$(sominor)
19 solink = libanim.so
20 shared = -shared -Wl,-soname,$(soname)
21 pic = -fPIC
22 endif
25 CC = gcc
26 AR = ar
27 CFLAGS = $(opt) $(dbg) -pedantic -Wall $(pic) -I$(PREFIX)/include
28 LDFLAGS = -L$(PREFIX)/lib -lvmath -lm -lpthread
30 .PHONY: all
31 all: $(lib_a) $(lib_so)
33 $(lib_a): $(obj)
34 $(AR) rcs $@ $(obj)
36 $(lib_so): $(obj)
37 $(CC) $(shared) -o $@ $(obj) $(LDFLAGS)
39 -include $(dep)
41 %.d: %.c
42 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
44 .PHONY: install
45 install: $(lib_a) $(lib_so)
46 mkdir -p $(PREFIX)/lib $(PREFIX)/include/anim
47 cp $(lib_a) $(PREFIX)/lib/$(lib_a)
48 cp $(lib_so) $(PREFIX)/lib/$(lib_so)
49 [ -n "$(solink)" ] && rm -f $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
50 && ln -s $(PREFIX)/lib/$(lib_so) $(PREFIX)/lib/$(soname) \
51 && ln -s $(PREFIX)/lib/$(soname) $(PREFIX)/lib/$(solink) \
52 || true
53 cp $(hdr) $(PREFIX)/include/anim/
55 .PHONY: uninstall
56 uninstall:
57 rm -f $(PREFIX)/lib/$(lib_a)
58 rm -f $(PREFIX)/lib/$(lib_so)
59 rm -f $(PREFIX)/include/anim/*.h
60 rmdir $(PREFIX)/include/anim
62 .PHONY: clean
63 clean:
64 rm -f $(obj) $(lib_so) $(lib_a)
66 .PHONY: distclean
67 distclean: clean
68 rm -f Makefile