goat3d

annotate Makefile @ 0:2918358f5e6d

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 Aug 2013 16:10:26 +0300
parents
children e46529a5d057
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@0 30
nuclear@0 31 .PHONY: all
nuclear@0 32 all: $(lib_so) $(lib_a)
nuclear@0 33
nuclear@0 34 $(lib_so): $(obj)
nuclear@0 35 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@0 36
nuclear@0 37 $(lib_a): $(obj)
nuclear@0 38 $(AR) rcs $@ $(obj)
nuclear@0 39
nuclear@0 40 -include $(dep)
nuclear@0 41
nuclear@0 42 %.d: %.cc
nuclear@0 43 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@0 44
nuclear@0 45 .PHONY: clean
nuclear@0 46 clean:
nuclear@0 47 rm -f $(obj) $(lib_a) $(lib_so)
nuclear@0 48
nuclear@0 49 .PHONY: cleandep
nuclear@0 50 cleandep:
nuclear@0 51 rm -f $(dep)