graphene
annotate Makefile @ 5:2ce58d5309f0
swizzling
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 25 Jul 2015 17:19:27 +0300 |
parents | f85a59195206 |
children |
rev | line source |
---|---|
nuclear@1 | 1 ccsrc = $(wildcard src/*.cc) \ |
nuclear@2 | 2 $(wildcard src/gmath/*.cc) |
nuclear@1 | 3 csrc = $(wildcard src/*.c) \ |
nuclear@2 | 4 $(wildcard src/gmath/*.c) |
nuclear@1 | 5 obj = $(ccsrc:.cc=.o) $(csrc:.c=.o) |
nuclear@1 | 6 dep = $(obj:.o=.d) |
nuclear@1 | 7 |
nuclear@1 | 8 name = graphene3d |
nuclear@1 | 9 somajor = 0 |
nuclear@1 | 10 sominor = 1 |
nuclear@1 | 11 |
nuclear@1 | 12 sys = $(shell uname -s) |
nuclear@1 | 13 |
nuclear@1 | 14 ifeq ($(sys), Darwin) |
nuclear@1 | 15 libgl = -framework OpenGL -lGLEW |
nuclear@1 | 16 |
nuclear@1 | 17 shared = -dynamiclib |
nuclear@1 | 18 solib = lib$(name).dylib |
nuclear@1 | 19 else |
nuclear@1 | 20 libgl = -lGL -lGLU -lGLEW |
nuclear@1 | 21 |
nuclear@1 | 22 ldname = lib$(name).so |
nuclear@1 | 23 soname = $(ldname).$(somajor) |
nuclear@1 | 24 solib = $(soname).$(sominor) |
nuclear@1 | 25 |
nuclear@1 | 26 shared = -shared -Wl,-soname=$(soname) |
nuclear@1 | 27 pic = -fPIC |
nuclear@1 | 28 endif |
nuclear@1 | 29 |
nuclear@1 | 30 inc = -Ilib |
nuclear@1 | 31 opt = |
nuclear@1 | 32 dbg = -g |
nuclear@1 | 33 |
nuclear@1 | 34 CFLAGS = -pedantic -Wall $(opt) $(dbg) $(pic) $(inc) |
nuclear@1 | 35 CXXFLAGS = $(CFLAGS) |
nuclear@1 | 36 LDFLAGS = $(libgl) |
nuclear@1 | 37 |
nuclear@1 | 38 .PHONY: shared |
nuclear@1 | 39 shared: $(solib) |
nuclear@1 | 40 |
nuclear@1 | 41 $(solib): $(obj) |
nuclear@1 | 42 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS) |
nuclear@1 | 43 [ -n "$(soname)" ] && \ |
nuclear@1 | 44 rm -f $(soname) $(ldname) && \ |
nuclear@1 | 45 ln -s $(solib) $(soname) && \ |
nuclear@1 | 46 ln -s $(soname) $(ldname) || true |
nuclear@1 | 47 |
nuclear@1 | 48 -include $(dep) |
nuclear@1 | 49 |
nuclear@1 | 50 %.d: %.c |
nuclear@1 | 51 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@1 | 52 |
nuclear@1 | 53 %.d: %.cc |
nuclear@1 | 54 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@1 | 55 |
nuclear@1 | 56 .PHONY: clean |
nuclear@1 | 57 clean: |
nuclear@1 | 58 rm -f $(obj) $(solib) |
nuclear@1 | 59 |
nuclear@1 | 60 .PHONY: cleandep |
nuclear@1 | 61 cleandep: |
nuclear@1 | 62 rm -f $(dep) |