erebus
view liberebus/Makefile @ 48:9971a08f4104
merged
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 24 Feb 2016 00:29:31 +0200 |
parents | d15ee526daa6 |
children |
line source
1 src = $(wildcard src/*.cc)
2 obj = $(src:.cc=.o)
3 dep = $(obj:.o=.d)
5 name = erebus
6 lib_a = lib$(name).a
8 api_major = 0
9 api_minor = 1
11 CXXFLAGS = -std=c++11 -pthread -pedantic $(warn) $(dbg) $(opt) $(pic)
12 LDFLAGS = -pthread -lgmath -limago -lm
14 ifeq ($(shell uname -s), Darwin)
15 shared = -dynamiclib
16 lib_so = lib$(name).dylib
17 else
18 shared = -shared -Wl,-soname=$(soname)
19 devlink = lib$(name).so
20 soname = lib$(name).so.$(api_major)
21 lib_so = lib$(name).so.$(api_major).$(api_minor)
22 pic = -fPIC
23 endif
25 .PHONY: all
26 all: $(lib_so) $(lib_a)
28 $(lib_so): $(obj)
29 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
30 [ -n "$(devlink)" ] && \
31 rm -f $(soname) $(devlink) && \
32 ln -s $@ $(soname) && ln -s $(soname) $(devlink) || true
34 $(lib_a): $(obj)
35 $(AR) rcs $@ $(obj)
37 -include $(dep)
39 %.d: %.cc
40 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
42 .PHONY: clean
43 clean:
44 rm -f $(obj) $(lib_so) $(lib_a) $(soname) $(devlink)