erebus
view liberebus/Makefile @ 5:9621beb22694
huh?
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 24 May 2014 02:20:44 +0300 |
parents | 474a0244f57d |
children | d15ee526daa6 |
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 -pedantic -Wall -g $(pic)
12 LDFLAGS = -lvmath -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)