goat3d
annotate Makefile @ 52:cb5414f406eb
merged
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 17 Jan 2014 18:27:47 +0200 |
parents | 3d669155709d |
children | ca549434dc95 |
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@0 | 76 .PHONY: cleandep |
nuclear@0 | 77 cleandep: |
nuclear@0 | 78 rm -f $(dep) |
nuclear@29 | 79 |
nuclear@29 | 80 .PHONY: install |
nuclear@29 | 81 install: $(lib_so) $(lib_a) |
nuclear@29 | 82 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include |
nuclear@29 | 83 cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 84 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 85 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 86 [ -n "$(devlink)" ] && \ |
nuclear@29 | 87 cd $(DESTDIR)$(PREFIX)/lib && \ |
nuclear@29 | 88 rm -f $(soname) $(devlink) && \ |
nuclear@29 | 89 ln -s $(lib_so) $(soname) && \ |
nuclear@29 | 90 ln -s $(soname) $(devlink) || \ |
nuclear@29 | 91 true |
nuclear@29 | 92 |
nuclear@29 | 93 .PHONY: uninstall |
nuclear@29 | 94 uninstall: |
nuclear@29 | 95 rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 96 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 97 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 98 [ -n "$(devlink)" ] && \ |
nuclear@29 | 99 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@29 | 100 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ |
nuclear@29 | 101 true |