graphene

view Makefile @ 1:f85a59195206

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