goat3d
annotate Makefile @ 35:4f8383183d62
renamed goatblender to blendgoat
added goatanimfmt animation file format description
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 05 Oct 2013 21:19:10 +0300 |
parents | b35427826b60 |
children | 0be413ac2e0a |
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@29 | 40 LDFLAGS = $(extlibs) |
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@14 | 51 $(openctm): |
nuclear@14 | 52 $(MAKE) -C libs/openctm |
nuclear@14 | 53 |
nuclear@19 | 54 $(tinyxml2): |
nuclear@19 | 55 $(MAKE) -C libs/tinyxml2 |
nuclear@19 | 56 |
nuclear@29 | 57 $(vmath): |
nuclear@29 | 58 $(MAKE) -C libs/vmath |
nuclear@29 | 59 |
nuclear@29 | 60 $(anim): |
nuclear@29 | 61 $(MAKE) -C libs/anim |
nuclear@29 | 62 |
nuclear@0 | 63 -include $(dep) |
nuclear@0 | 64 |
nuclear@0 | 65 %.d: %.cc |
nuclear@0 | 66 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@0 | 67 |
nuclear@0 | 68 .PHONY: clean |
nuclear@0 | 69 clean: |
nuclear@0 | 70 rm -f $(obj) $(lib_a) $(lib_so) |
nuclear@0 | 71 |
nuclear@0 | 72 .PHONY: cleandep |
nuclear@0 | 73 cleandep: |
nuclear@0 | 74 rm -f $(dep) |
nuclear@29 | 75 |
nuclear@29 | 76 .PHONY: install |
nuclear@29 | 77 install: $(lib_so) $(lib_a) |
nuclear@29 | 78 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include |
nuclear@29 | 79 cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 80 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 81 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 82 [ -n "$(devlink)" ] && \ |
nuclear@29 | 83 cd $(DESTDIR)$(PREFIX)/lib && \ |
nuclear@29 | 84 rm -f $(soname) $(devlink) && \ |
nuclear@29 | 85 ln -s $(lib_so) $(soname) && \ |
nuclear@29 | 86 ln -s $(soname) $(devlink) || \ |
nuclear@29 | 87 true |
nuclear@29 | 88 |
nuclear@29 | 89 .PHONY: uninstall |
nuclear@29 | 90 uninstall: |
nuclear@29 | 91 rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 92 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 93 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 94 [ -n "$(devlink)" ] && \ |
nuclear@29 | 95 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@29 | 96 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ |
nuclear@29 | 97 true |