libvmath4
view Makefile @ 0:4d6383605d64
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 05 Oct 2014 04:00:05 +0300 |
parents | |
children |
line source
1 PREFIX = /usr/local
3 src = $(wildcard src/*.cc)
4 obj = $(src:.cc=.o)
5 dep = $(obj:.o=.d)
6 lib_a = libvmath4.a
8 so_major = 4
9 so_minor = 0
11 warn = -Wall
12 dbg = -g
14 CXXFLAGS = -pedantic $(warn) $(dbg) $(pic)
15 LDFLAGS = -lm
17 ifeq ($(shell uname -s), Darwin)
18 lib_so = libvmath4.dylib
19 shared = -dynamiclib
20 else
21 ldname = libvmath4.so
22 soname = libvmath4.so.$(so_major)
23 lib_so = libvmath4.so.$(so_major).$(so_minor)
24 shared = -shared -Wl,-soname=$(soname)
25 pic = -fPIC
26 endif
28 .PHONY: all
29 all: $(lib_so) $(lib_a)
31 $(lib_a): $(obj)
32 $(AR) rcs $@ $(obj)
34 $(lib_so): $(obj)
35 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
37 $(soname): $(lib_so)
38 rm -f $(soname)
39 ln -s $(lib_so) $(soname)
41 $(ldname): $(soname)
42 rm -f $(ldname)
43 ln -s $(soname) $(ldname)
45 -include $(dep)
47 %.d: %.cc
48 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
50 .PHONY: clean
51 clean:
52 rm -f $(obj) $(bin) $(dep)