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