goat3d

diff Makefile @ 0:2918358f5e6d

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 Aug 2013 16:10:26 +0300
parents
children e46529a5d057
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Sat Aug 17 16:10:26 2013 +0300
     1.3 @@ -0,0 +1,51 @@
     1.4 +# ----- options -----
     1.5 +PREFIX = /usr/local
     1.6 +dbg = -g
     1.7 +opt = -O0
     1.8 +# -------------------
     1.9 +
    1.10 +src = $(wildcard src/*.cc)
    1.11 +obj = $(src:.cc=.o)
    1.12 +dep = $(obj:.o=.d)
    1.13 +
    1.14 +name = goat3d
    1.15 +so_major = 0
    1.16 +so_minor = 1
    1.17 +
    1.18 +lib_a = lib$(name).a
    1.19 +
    1.20 +ifeq ($(shell uname -s), Darwin)
    1.21 +	lib_so = lib$(name).dylib
    1.22 +	shared = -dynamiclib
    1.23 +else
    1.24 +	devlink = lib$(name).so
    1.25 +	soname = lib$(name).so.$(so_major)
    1.26 +	lib_so = lib$(name).so.$(so_major).$(so_minor)
    1.27 +
    1.28 +	shared = -shared -Wl,-soname=$(soname)
    1.29 +	pic = -fPIC
    1.30 +endif
    1.31 +
    1.32 +CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic)
    1.33 +
    1.34 +.PHONY: all
    1.35 +all: $(lib_so) $(lib_a)
    1.36 +
    1.37 +$(lib_so): $(obj)
    1.38 +	$(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
    1.39 +
    1.40 +$(lib_a): $(obj)
    1.41 +	$(AR) rcs $@ $(obj)
    1.42 +
    1.43 +-include $(dep)
    1.44 +
    1.45 +%.d: %.cc
    1.46 +	@$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.47 +
    1.48 +.PHONY: clean
    1.49 +clean:
    1.50 +	rm -f $(obj) $(lib_a) $(lib_so)
    1.51 +
    1.52 +.PHONY: cleandep
    1.53 +cleandep:
    1.54 +	rm -f $(dep)