goat3d

annotate Makefile @ 22:44a20d72f3a6

merged
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 27 Sep 2013 07:14:49 +0300
parents f1b4c27382ce
children 3d669155709d
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@19 14 extinc = -Ilibs/openctm -Ilibs/tinyxml2
nuclear@19 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@14 38 LDFLAGS = $(extlibs) -lvmath -lanim
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@15 47 $(AR) rcs $@ $(obj) $(openctm)
nuclear@0 48
nuclear@14 49 $(openctm):
nuclear@14 50 $(MAKE) -C libs/openctm
nuclear@14 51
nuclear@19 52 $(tinyxml2):
nuclear@19 53 $(MAKE) -C libs/tinyxml2
nuclear@19 54
nuclear@0 55 -include $(dep)
nuclear@0 56
nuclear@0 57 %.d: %.cc
nuclear@0 58 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 59
nuclear@0 60 .PHONY: clean
nuclear@0 61 clean:
nuclear@0 62 rm -f $(obj) $(lib_a) $(lib_so)
nuclear@0 63
nuclear@0 64 .PHONY: cleandep
nuclear@0 65 cleandep:
nuclear@0 66 rm -f $(dep)