goat3d
view Makefile @ 94:21319e71117f
[libs] fixed a few warnings in openctm
[goatview] starting animation loading
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 18 May 2014 19:58:47 +0300 |
parents | ca549434dc95 |
children |
line source
1 # ----- options -----
2 PREFIX = /usr/local
3 dbg = -g
4 opt = -O0
5 # -------------------
7 src = $(wildcard src/*.cc)
8 obj = $(src:.cc=.o)
9 dep = $(obj:.o=.d)
11 openctm = libs/openctm/libopenctm.a
12 tinyxml2 = libs/tinyxml2/libtinyxml2.a
14 extinc = -Ilibs/openctm -Ilibs/tinyxml2
15 extlibs = $(openctm) $(tinyxml2)
17 name = goat3d
18 so_major = 0
19 so_minor = 1
21 lib_a = lib$(name).a
23 ifeq ($(shell uname -s), Darwin)
24 lib_so = lib$(name).dylib
25 shared = -dynamiclib
26 else
27 devlink = lib$(name).so
28 soname = lib$(name).so.$(so_major)
29 lib_so = lib$(name).so.$(so_major).$(so_minor)
31 shared = -shared -Wl,-soname=$(soname)
32 pic = -fPIC
33 endif
35 CC = clang
36 CXX = clang++
37 CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(extinc)
38 LDFLAGS = $(extlibs) -lvmath -lanim -lpthread
40 .PHONY: all
41 all: $(lib_so) $(lib_a)
43 $(lib_so): $(obj) $(extlibs)
44 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
46 $(lib_a): $(obj) $(extlibs)
47 $(AR) rcs $@ $(obj) $(extlibs)
49 .PHONY: $(openctm)
50 $(openctm):
51 $(MAKE) -C libs/openctm
53 .PHONY: $(tinyxml2)
54 $(tinyxml2):
55 $(MAKE) -C libs/tinyxml2
57 -include $(dep)
59 %.d: %.cc
60 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
62 .PHONY: clean
63 clean:
64 rm -f $(obj) $(lib_a) $(lib_so)
66 .PHONY: cleanlibs
67 cleanlibs:
68 $(MAKE) -C libs/openctm clean
69 $(MAKE) -C libs/tinyxml2 clean
71 .PHONY: cleandep
72 cleandep:
73 rm -f $(dep)
75 .PHONY: install
76 install: $(lib_so) $(lib_a)
77 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include
78 cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h
79 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
80 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
81 [ -n "$(devlink)" ] && \
82 cd $(DESTDIR)$(PREFIX)/lib && \
83 rm -f $(soname) $(devlink) && \
84 ln -s $(lib_so) $(soname) && \
85 ln -s $(soname) $(devlink) || \
86 true
88 .PHONY: uninstall
89 uninstall:
90 rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h
91 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
92 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
93 [ -n "$(devlink)" ] && \
94 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
95 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
96 true