goat3d
view Makefile @ 58:d317eb4f83da
- made everything compile properly on windows again
- removed libanim/libvmath, we'll use them as external dependencies
- added new maxgoat_stub 3dsmax plugin project. Gets loaded as a max plugin and
loads the actual maxgoat (and later maxgoat_anim) exporters on demand, to
allow reloading the actual exporters without having to restart 3dsmax (which
takes AGES).
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 25 Mar 2014 03:19:55 +0200 |
parents | 0be413ac2e0a |
children | b0bf3786bd5b |
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) -lpthread
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 .PHONY: $(openctm)
52 $(openctm):
53 $(MAKE) -C libs/openctm
55 .PHONY: $(tinyxml2)
56 $(tinyxml2):
57 $(MAKE) -C libs/tinyxml2
59 .PHONY: $(vmath)
60 $(vmath):
61 $(MAKE) -C libs/vmath
63 .PHONY: $(anim)
64 $(anim):
65 $(MAKE) -C libs/anim
67 -include $(dep)
69 %.d: %.cc
70 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
72 .PHONY: clean
73 clean:
74 rm -f $(obj) $(lib_a) $(lib_so)
76 .PHONY: cleanlibs
77 cleanlibs:
78 $(MAKE) -C libs/openctm clean
79 $(MAKE) -C libs/tinyxml2 clean
80 $(MAKE) -C libs/vmath clean
81 $(MAKE) -C libs/anim clean
83 .PHONY: cleandep
84 cleandep:
85 rm -f $(dep)
87 .PHONY: install
88 install: $(lib_so) $(lib_a)
89 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include
90 cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h
91 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
92 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
93 [ -n "$(devlink)" ] && \
94 cd $(DESTDIR)$(PREFIX)/lib && \
95 rm -f $(soname) $(devlink) && \
96 ln -s $(lib_so) $(soname) && \
97 ln -s $(soname) $(devlink) || \
98 true
100 .PHONY: uninstall
101 uninstall:
102 rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h
103 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
104 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
105 [ -n "$(devlink)" ] && \
106 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
107 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
108 true