goat3dgfx
annotate 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 |
rev | line source |
---|---|
nuclear@0 | 1 PREFIX = /usr/local |
nuclear@0 | 2 |
nuclear@0 | 3 csrc = $(wildcard src/*.c) |
nuclear@0 | 4 ccsrc = $(wildcard src/*.cc) |
nuclear@0 | 5 obj = $(csrc:.c=.o) $(ccsrc:.cc=.o) |
nuclear@0 | 6 dep = $(obj:.o=.d) |
nuclear@0 | 7 name = goat3dgfx |
nuclear@0 | 8 lib_a = lib$(name).a |
nuclear@0 | 9 |
nuclear@0 | 10 so_major = 0 |
nuclear@0 | 11 so_minor = 1 |
nuclear@0 | 12 |
nuclear@0 | 13 ifeq ($(shell uname -r), Darwin) |
nuclear@0 | 14 libgl = -framework OpenGL -framework GLUT -lGLEW |
nuclear@0 | 15 |
nuclear@0 | 16 lib_so = lib$(name).dylib |
nuclear@0 | 17 shared = -dynamiclib |
nuclear@0 | 18 else |
nuclear@0 | 19 libgl = -lGL -lGLU -lglut -lGLEW |
nuclear@0 | 20 |
nuclear@0 | 21 lib_so = lib$(name).so.$(so_major).$(so_minor) |
nuclear@0 | 22 soname = lib$(name).so.$(so_major) |
nuclear@0 | 23 devlink = lib$(name).so |
nuclear@0 | 24 shared = -shared -Wl,-soname=$(soname) |
nuclear@0 | 25 pic = -fPIC |
nuclear@0 | 26 endif |
nuclear@0 | 27 |
nuclear@0 | 28 |
nuclear@0 | 29 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(libs_cflags) |
nuclear@0 | 30 CXXFLAGS = $(CFLAGS) |
nuclear@0 | 31 LDFLAGS = $(libgl) $(libs_ldflags) |
nuclear@0 | 32 |
nuclear@0 | 33 .PHONY: all |
nuclear@0 | 34 all: $(lib_so) $(lib_a) |
nuclear@0 | 35 |
nuclear@0 | 36 $(lib_a): $(obj) |
nuclear@0 | 37 $(AR) rcs $@ $(obj) |
nuclear@0 | 38 |
nuclear@0 | 39 $(lib_so): $(obj) |
nuclear@0 | 40 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS) |
nuclear@0 | 41 |
nuclear@0 | 42 -include $(dep) |
nuclear@0 | 43 |
nuclear@0 | 44 %.d: %.c |
nuclear@0 | 45 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
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) $(lib_a) $(lib_so) |
nuclear@0 | 53 |
nuclear@0 | 54 .PHONY: cleandep |
nuclear@0 | 55 cleandep: |
nuclear@0 | 56 rm -f $(dep) |
nuclear@0 | 57 |
nuclear@0 | 58 .PHONY: install |
nuclear@0 | 59 install: $(lib_so) $(lib_a) |
nuclear@0 | 60 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx |
nuclear@0 | 61 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/ |
nuclear@0 | 62 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@0 | 63 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@0 | 64 [ -n "$(devlink)" ] && \ |
nuclear@0 | 65 cd $(DESTDIR)$(PREFIX)/lib && \ |
nuclear@0 | 66 rm -f $(soname) $(devlink) && \ |
nuclear@0 | 67 ln -s $(lib_so) $(soname) && \ |
nuclear@0 | 68 ln -s $(soname) $(devlink) || \ |
nuclear@0 | 69 true |
nuclear@0 | 70 |
nuclear@0 | 71 .PHONY: uninstall |
nuclear@0 | 72 uninstall: |
nuclear@0 | 73 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/* |
nuclear@0 | 74 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx |
nuclear@0 | 75 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@0 | 76 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@0 | 77 [ -n "$(devlink)" ] && \ |
nuclear@0 | 78 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@0 | 79 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ |
nuclear@0 | 80 true |