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