goat3d

annotate Makefile @ 15:f1b4c27382ce

blah
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 26 Sep 2013 14:06:14 +0300
parents 188c697b3b49
children b35427826b60
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@14 12
nuclear@14 13 extinc = -Ilibs/openctm
nuclear@14 14 extlibs = $(openctm)
nuclear@14 15
nuclear@0 16 name = goat3d
nuclear@0 17 so_major = 0
nuclear@0 18 so_minor = 1
nuclear@0 19
nuclear@0 20 lib_a = lib$(name).a
nuclear@0 21
nuclear@0 22 ifeq ($(shell uname -s), Darwin)
nuclear@0 23 lib_so = lib$(name).dylib
nuclear@0 24 shared = -dynamiclib
nuclear@0 25 else
nuclear@0 26 devlink = lib$(name).so
nuclear@0 27 soname = lib$(name).so.$(so_major)
nuclear@0 28 lib_so = lib$(name).so.$(so_major).$(so_minor)
nuclear@0 29
nuclear@0 30 shared = -shared -Wl,-soname=$(soname)
nuclear@0 31 pic = -fPIC
nuclear@0 32 endif
nuclear@0 33
nuclear@15 34 CC = clang
nuclear@15 35 CXX = clang++
nuclear@14 36 CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(extinc)
nuclear@14 37 LDFLAGS = $(extlibs) -lvmath -lanim
nuclear@0 38
nuclear@0 39 .PHONY: all
nuclear@0 40 all: $(lib_so) $(lib_a)
nuclear@0 41
nuclear@14 42 $(lib_so): $(obj) $(extlibs)
nuclear@0 43 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@0 44
nuclear@14 45 $(lib_a): $(obj) $(extlibs)
nuclear@15 46 $(AR) rcs $@ $(obj) $(openctm)
nuclear@0 47
nuclear@14 48 $(openctm):
nuclear@14 49 $(MAKE) -C libs/openctm
nuclear@14 50
nuclear@0 51 -include $(dep)
nuclear@0 52
nuclear@0 53 %.d: %.cc
nuclear@0 54 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 55
nuclear@0 56 .PHONY: clean
nuclear@0 57 clean:
nuclear@0 58 rm -f $(obj) $(lib_a) $(lib_so)
nuclear@0 59
nuclear@0 60 .PHONY: cleandep
nuclear@0 61 cleandep:
nuclear@0 62 rm -f $(dep)