libvmath4

diff Makefile @ 0:4d6383605d64

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