goat3dgfx

view Makefile @ 5:18879c956eb1

- skycube example - added fatal_log - changed the dataset to keep the whole path while searching for data files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 17 Nov 2013 03:22:40 +0200
parents
children 98f87a1dbb2f
line source
1 PREFIX = /usr/local
3 csrc = $(wildcard src/*.c)
4 ccsrc = $(wildcard src/*.cc)
5 obj = $(csrc:.c=.o) $(ccsrc:.cc=.o)
6 dep = $(obj:.o=.d)
7 name = goat3dgfx
8 lib_a = lib$(name).a
10 so_major = 0
11 so_minor = 1
13 ifeq ($(shell uname -r), Darwin)
14 libgl = -framework OpenGL -framework GLUT -lGLEW
16 lib_so = lib$(name).dylib
17 shared = -dynamiclib
18 else
19 libgl = -lGL -lGLU -lglut -lGLEW
21 lib_so = lib$(name).so.$(so_major).$(so_minor)
22 soname = lib$(name).so.$(so_major)
23 devlink = lib$(name).so
24 shared = -shared -Wl,-soname=$(soname)
25 pic = -fPIC
26 endif
29 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(libs_cflags)
30 CXXFLAGS = $(CFLAGS)
31 LDFLAGS = $(libgl) $(libs_ldflags)
33 .PHONY: all
34 all: $(lib_so) $(lib_a)
36 $(lib_a): $(obj)
37 $(AR) rcs $@ $(obj)
39 $(lib_so): $(obj)
40 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
42 -include $(dep)
44 %.d: %.c
45 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
47 %.d: %.cc
48 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
50 .PHONY: clean
51 clean:
52 rm -f $(obj) $(lib_a) $(lib_so)
54 .PHONY: cleandep
55 cleandep:
56 rm -f $(dep)
58 .PHONY: install
59 install: $(lib_so) $(lib_a)
60 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx
61 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/
62 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
63 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
64 [ -n "$(devlink)" ] && \
65 cd $(DESTDIR)$(PREFIX)/lib && \
66 rm -f $(soname) $(devlink) && \
67 ln -s $(lib_so) $(soname) && \
68 ln -s $(soname) $(devlink) || \
69 true
71 .PHONY: uninstall
72 uninstall:
73 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/*
74 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx
75 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
76 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
77 [ -n "$(devlink)" ] && \
78 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
79 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
80 true