goat3d
annotate Makefile @ 56:ca549434dc95
fixed a crashing bug in anm_destroy_node introduced when I added the multiple animations per node
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 23 Jan 2014 02:50:54 +0200 |
parents | 0be413ac2e0a |
children | b0bf3786bd5b |
rev | line source |
---|---|
nuclear@0 | 1 # ----- options ----- |
nuclear@0 | 2 PREFIX = /usr/local |
nuclear@0 | 3 dbg = -g |
nuclear@0 | 4 opt = -O0 |
nuclear@0 | 5 # ------------------- |
nuclear@0 | 6 |
nuclear@0 | 7 src = $(wildcard src/*.cc) |
nuclear@0 | 8 obj = $(src:.cc=.o) |
nuclear@0 | 9 dep = $(obj:.o=.d) |
nuclear@0 | 10 |
nuclear@14 | 11 openctm = libs/openctm/libopenctm.a |
nuclear@19 | 12 tinyxml2 = libs/tinyxml2/libtinyxml2.a |
nuclear@29 | 13 vmath = libs/vmath/libvmath.a |
nuclear@29 | 14 anim = libs/anim/libanim.a |
nuclear@14 | 15 |
nuclear@29 | 16 extinc = -Ilibs/openctm -Ilibs/tinyxml2 -Ilibs/anim |
nuclear@29 | 17 extlibs = $(openctm) $(tinyxml2) $(anim) $(vmath) |
nuclear@14 | 18 |
nuclear@0 | 19 name = goat3d |
nuclear@0 | 20 so_major = 0 |
nuclear@0 | 21 so_minor = 1 |
nuclear@0 | 22 |
nuclear@0 | 23 lib_a = lib$(name).a |
nuclear@0 | 24 |
nuclear@0 | 25 ifeq ($(shell uname -s), Darwin) |
nuclear@0 | 26 lib_so = lib$(name).dylib |
nuclear@0 | 27 shared = -dynamiclib |
nuclear@0 | 28 else |
nuclear@0 | 29 devlink = lib$(name).so |
nuclear@0 | 30 soname = lib$(name).so.$(so_major) |
nuclear@0 | 31 lib_so = lib$(name).so.$(so_major).$(so_minor) |
nuclear@0 | 32 |
nuclear@0 | 33 shared = -shared -Wl,-soname=$(soname) |
nuclear@0 | 34 pic = -fPIC |
nuclear@0 | 35 endif |
nuclear@0 | 36 |
nuclear@15 | 37 CC = clang |
nuclear@15 | 38 CXX = clang++ |
nuclear@14 | 39 CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(extinc) |
nuclear@50 | 40 LDFLAGS = $(extlibs) -lpthread |
nuclear@0 | 41 |
nuclear@0 | 42 .PHONY: all |
nuclear@0 | 43 all: $(lib_so) $(lib_a) |
nuclear@0 | 44 |
nuclear@14 | 45 $(lib_so): $(obj) $(extlibs) |
nuclear@0 | 46 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS) |
nuclear@0 | 47 |
nuclear@14 | 48 $(lib_a): $(obj) $(extlibs) |
nuclear@29 | 49 $(AR) rcs $@ $(obj) $(extlibs) |
nuclear@0 | 50 |
nuclear@50 | 51 .PHONY: $(openctm) |
nuclear@14 | 52 $(openctm): |
nuclear@14 | 53 $(MAKE) -C libs/openctm |
nuclear@14 | 54 |
nuclear@50 | 55 .PHONY: $(tinyxml2) |
nuclear@19 | 56 $(tinyxml2): |
nuclear@19 | 57 $(MAKE) -C libs/tinyxml2 |
nuclear@19 | 58 |
nuclear@50 | 59 .PHONY: $(vmath) |
nuclear@29 | 60 $(vmath): |
nuclear@29 | 61 $(MAKE) -C libs/vmath |
nuclear@29 | 62 |
nuclear@50 | 63 .PHONY: $(anim) |
nuclear@29 | 64 $(anim): |
nuclear@29 | 65 $(MAKE) -C libs/anim |
nuclear@29 | 66 |
nuclear@0 | 67 -include $(dep) |
nuclear@0 | 68 |
nuclear@0 | 69 %.d: %.cc |
nuclear@0 | 70 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@0 | 71 |
nuclear@0 | 72 .PHONY: clean |
nuclear@0 | 73 clean: |
nuclear@0 | 74 rm -f $(obj) $(lib_a) $(lib_so) |
nuclear@0 | 75 |
nuclear@56 | 76 .PHONY: cleanlibs |
nuclear@56 | 77 cleanlibs: |
nuclear@56 | 78 $(MAKE) -C libs/openctm clean |
nuclear@56 | 79 $(MAKE) -C libs/tinyxml2 clean |
nuclear@56 | 80 $(MAKE) -C libs/vmath clean |
nuclear@56 | 81 $(MAKE) -C libs/anim clean |
nuclear@56 | 82 |
nuclear@0 | 83 .PHONY: cleandep |
nuclear@0 | 84 cleandep: |
nuclear@0 | 85 rm -f $(dep) |
nuclear@29 | 86 |
nuclear@29 | 87 .PHONY: install |
nuclear@29 | 88 install: $(lib_so) $(lib_a) |
nuclear@29 | 89 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include |
nuclear@29 | 90 cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 91 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 92 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 93 [ -n "$(devlink)" ] && \ |
nuclear@29 | 94 cd $(DESTDIR)$(PREFIX)/lib && \ |
nuclear@29 | 95 rm -f $(soname) $(devlink) && \ |
nuclear@29 | 96 ln -s $(lib_so) $(soname) && \ |
nuclear@29 | 97 ln -s $(soname) $(devlink) || \ |
nuclear@29 | 98 true |
nuclear@29 | 99 |
nuclear@29 | 100 .PHONY: uninstall |
nuclear@29 | 101 uninstall: |
nuclear@29 | 102 rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 103 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 104 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 105 [ -n "$(devlink)" ] && \ |
nuclear@29 | 106 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@29 | 107 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ |
nuclear@29 | 108 true |