goat3d

annotate Makefile @ 1:e46529a5d057

some progress
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 Aug 2013 23:51:24 +0300
parents 2918358f5e6d
children 188c697b3b49
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@0 11 name = goat3d
nuclear@0 12 so_major = 0
nuclear@0 13 so_minor = 1
nuclear@0 14
nuclear@0 15 lib_a = lib$(name).a
nuclear@0 16
nuclear@0 17 ifeq ($(shell uname -s), Darwin)
nuclear@0 18 lib_so = lib$(name).dylib
nuclear@0 19 shared = -dynamiclib
nuclear@0 20 else
nuclear@0 21 devlink = lib$(name).so
nuclear@0 22 soname = lib$(name).so.$(so_major)
nuclear@0 23 lib_so = lib$(name).so.$(so_major).$(so_minor)
nuclear@0 24
nuclear@0 25 shared = -shared -Wl,-soname=$(soname)
nuclear@0 26 pic = -fPIC
nuclear@0 27 endif
nuclear@0 28
nuclear@0 29 CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic)
nuclear@1 30 LDFLAGS = -lvmath -lanim
nuclear@0 31
nuclear@0 32 .PHONY: all
nuclear@0 33 all: $(lib_so) $(lib_a)
nuclear@0 34
nuclear@0 35 $(lib_so): $(obj)
nuclear@0 36 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@0 37
nuclear@0 38 $(lib_a): $(obj)
nuclear@0 39 $(AR) rcs $@ $(obj)
nuclear@0 40
nuclear@0 41 -include $(dep)
nuclear@0 42
nuclear@0 43 %.d: %.cc
nuclear@0 44 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 45
nuclear@0 46 .PHONY: clean
nuclear@0 47 clean:
nuclear@0 48 rm -f $(obj) $(lib_a) $(lib_so)
nuclear@0 49
nuclear@0 50 .PHONY: cleandep
nuclear@0 51 cleandep:
nuclear@0 52 rm -f $(dep)