goat3d
annotate Makefile @ 82:70b7c41a4f17
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 11 May 2014 22:04:54 +0300 |
parents | ca549434dc95 |
children |
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@14 | 13 |
nuclear@59 | 14 extinc = -Ilibs/openctm -Ilibs/tinyxml2 |
nuclear@59 | 15 extlibs = $(openctm) $(tinyxml2) |
nuclear@14 | 16 |
nuclear@0 | 17 name = goat3d |
nuclear@0 | 18 so_major = 0 |
nuclear@0 | 19 so_minor = 1 |
nuclear@0 | 20 |
nuclear@0 | 21 lib_a = lib$(name).a |
nuclear@0 | 22 |
nuclear@0 | 23 ifeq ($(shell uname -s), Darwin) |
nuclear@0 | 24 lib_so = lib$(name).dylib |
nuclear@0 | 25 shared = -dynamiclib |
nuclear@0 | 26 else |
nuclear@0 | 27 devlink = lib$(name).so |
nuclear@0 | 28 soname = lib$(name).so.$(so_major) |
nuclear@0 | 29 lib_so = lib$(name).so.$(so_major).$(so_minor) |
nuclear@0 | 30 |
nuclear@0 | 31 shared = -shared -Wl,-soname=$(soname) |
nuclear@0 | 32 pic = -fPIC |
nuclear@0 | 33 endif |
nuclear@0 | 34 |
nuclear@15 | 35 CC = clang |
nuclear@15 | 36 CXX = clang++ |
nuclear@14 | 37 CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(extinc) |
nuclear@59 | 38 LDFLAGS = $(extlibs) -lvmath -lanim -lpthread |
nuclear@0 | 39 |
nuclear@0 | 40 .PHONY: all |
nuclear@0 | 41 all: $(lib_so) $(lib_a) |
nuclear@0 | 42 |
nuclear@14 | 43 $(lib_so): $(obj) $(extlibs) |
nuclear@0 | 44 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS) |
nuclear@0 | 45 |
nuclear@14 | 46 $(lib_a): $(obj) $(extlibs) |
nuclear@29 | 47 $(AR) rcs $@ $(obj) $(extlibs) |
nuclear@0 | 48 |
nuclear@50 | 49 .PHONY: $(openctm) |
nuclear@14 | 50 $(openctm): |
nuclear@14 | 51 $(MAKE) -C libs/openctm |
nuclear@14 | 52 |
nuclear@50 | 53 .PHONY: $(tinyxml2) |
nuclear@19 | 54 $(tinyxml2): |
nuclear@19 | 55 $(MAKE) -C libs/tinyxml2 |
nuclear@19 | 56 |
nuclear@0 | 57 -include $(dep) |
nuclear@0 | 58 |
nuclear@0 | 59 %.d: %.cc |
nuclear@0 | 60 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@0 | 61 |
nuclear@0 | 62 .PHONY: clean |
nuclear@0 | 63 clean: |
nuclear@0 | 64 rm -f $(obj) $(lib_a) $(lib_so) |
nuclear@0 | 65 |
nuclear@56 | 66 .PHONY: cleanlibs |
nuclear@56 | 67 cleanlibs: |
nuclear@56 | 68 $(MAKE) -C libs/openctm clean |
nuclear@56 | 69 $(MAKE) -C libs/tinyxml2 clean |
nuclear@56 | 70 |
nuclear@0 | 71 .PHONY: cleandep |
nuclear@0 | 72 cleandep: |
nuclear@0 | 73 rm -f $(dep) |
nuclear@29 | 74 |
nuclear@29 | 75 .PHONY: install |
nuclear@29 | 76 install: $(lib_so) $(lib_a) |
nuclear@29 | 77 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include |
nuclear@29 | 78 cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 79 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 80 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 81 [ -n "$(devlink)" ] && \ |
nuclear@29 | 82 cd $(DESTDIR)$(PREFIX)/lib && \ |
nuclear@29 | 83 rm -f $(soname) $(devlink) && \ |
nuclear@29 | 84 ln -s $(lib_so) $(soname) && \ |
nuclear@29 | 85 ln -s $(soname) $(devlink) || \ |
nuclear@29 | 86 true |
nuclear@29 | 87 |
nuclear@29 | 88 .PHONY: uninstall |
nuclear@29 | 89 uninstall: |
nuclear@29 | 90 rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h |
nuclear@29 | 91 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@29 | 92 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@29 | 93 [ -n "$(devlink)" ] && \ |
nuclear@29 | 94 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@29 | 95 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ |
nuclear@29 | 96 true |