erebus

annotate liberebus/Makefile @ 10:506e114b7ca2

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 24 May 2014 17:43:46 +0300
parents 474a0244f57d
children d15ee526daa6
rev   line source
nuclear@2 1 src = $(wildcard src/*.cc)
nuclear@2 2 obj = $(src:.cc=.o)
nuclear@2 3 dep = $(obj:.o=.d)
nuclear@2 4
nuclear@2 5 name = erebus
nuclear@2 6 lib_a = lib$(name).a
nuclear@2 7
nuclear@2 8 api_major = 0
nuclear@2 9 api_minor = 1
nuclear@2 10
nuclear@2 11 CXXFLAGS = -std=c++11 -pedantic -Wall -g $(pic)
nuclear@2 12 LDFLAGS = -lvmath -limago -lm
nuclear@2 13
nuclear@2 14 ifeq ($(shell uname -s), Darwin)
nuclear@2 15 shared = -dynamiclib
nuclear@2 16 lib_so = lib$(name).dylib
nuclear@2 17 else
nuclear@2 18 shared = -shared -Wl,-soname=$(soname)
nuclear@2 19 devlink = lib$(name).so
nuclear@2 20 soname = lib$(name).so.$(api_major)
nuclear@2 21 lib_so = lib$(name).so.$(api_major).$(api_minor)
nuclear@2 22 pic = -fPIC
nuclear@2 23 endif
nuclear@2 24
nuclear@2 25 .PHONY: all
nuclear@2 26 all: $(lib_so) $(lib_a)
nuclear@2 27
nuclear@2 28 $(lib_so): $(obj)
nuclear@2 29 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@4 30 [ -n "$(devlink)" ] && \
nuclear@4 31 rm -f $(soname) $(devlink) && \
nuclear@4 32 ln -s $@ $(soname) && ln -s $(soname) $(devlink) || true
nuclear@2 33
nuclear@2 34 $(lib_a): $(obj)
nuclear@2 35 $(AR) rcs $@ $(obj)
nuclear@2 36
nuclear@2 37 -include $(dep)
nuclear@2 38
nuclear@2 39 %.d: %.cc
nuclear@2 40 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@2 41
nuclear@2 42 .PHONY: clean
nuclear@2 43 clean:
nuclear@4 44 rm -f $(obj) $(lib_so) $(lib_a) $(soname) $(devlink)