goat3d
view Makefile @ 29:3d669155709d
- switched the unix build to use the internal vmath/anim as well
- fixed a memory corruption issue which was caused by including the system-wide
installed version of the anim.h header file
- started the ass2goat assimp->goat3d converter
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 29 Sep 2013 21:53:03 +0300 |
parents | b35427826b60 |
children | 0be413ac2e0a |
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
13 vmath = libs/vmath/libvmath.a
14 anim = libs/anim/libanim.a
16 extinc = -Ilibs/openctm -Ilibs/tinyxml2 -Ilibs/anim
17 extlibs = $(openctm) $(tinyxml2) $(anim) $(vmath)
19 name = goat3d
20 so_major = 0
21 so_minor = 1
23 lib_a = lib$(name).a
25 ifeq ($(shell uname -s), Darwin)
26 lib_so = lib$(name).dylib
27 shared = -dynamiclib
28 else
29 devlink = lib$(name).so
30 soname = lib$(name).so.$(so_major)
31 lib_so = lib$(name).so.$(so_major).$(so_minor)
33 shared = -shared -Wl,-soname=$(soname)
34 pic = -fPIC
35 endif
37 CC = clang
38 CXX = clang++
39 CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(extinc)
40 LDFLAGS = $(extlibs)
42 .PHONY: all
43 all: $(lib_so) $(lib_a)
45 $(lib_so): $(obj) $(extlibs)
46 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
48 $(lib_a): $(obj) $(extlibs)
49 $(AR) rcs $@ $(obj) $(extlibs)
51 $(openctm):
52 $(MAKE) -C libs/openctm
54 $(tinyxml2):
55 $(MAKE) -C libs/tinyxml2
57 $(vmath):
58 $(MAKE) -C libs/vmath
60 $(anim):
61 $(MAKE) -C libs/anim
63 -include $(dep)
65 %.d: %.cc
66 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
68 .PHONY: clean
69 clean:
70 rm -f $(obj) $(lib_a) $(lib_so)
72 .PHONY: cleandep
73 cleandep:
74 rm -f $(dep)
76 .PHONY: install
77 install: $(lib_so) $(lib_a)
78 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include
79 cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h
80 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
81 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
82 [ -n "$(devlink)" ] && \
83 cd $(DESTDIR)$(PREFIX)/lib && \
84 rm -f $(soname) $(devlink) && \
85 ln -s $(lib_so) $(soname) && \
86 ln -s $(soname) $(devlink) || \
87 true
89 .PHONY: uninstall
90 uninstall:
91 rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h
92 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
93 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
94 [ -n "$(devlink)" ] && \
95 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
96 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
97 true