goat3dgfx
annotate Makefile @ 9:25b911c7c35c
fixed some line endings
fixed the cubemap2.jpg file in examples/cubemap/data which was resized improperly causing seams...
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 18 Nov 2013 04:10:19 +0200 |
parents | 98f87a1dbb2f |
children |
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@8 | 28 dbg = -g |
nuclear@8 | 29 warn = -Wall |
nuclear@0 | 30 |
nuclear@9 | 31 libs_ldflags = -limago -lanim -lpsys -lvmath |
nuclear@9 | 32 |
nuclear@0 | 33 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(libs_cflags) |
nuclear@0 | 34 CXXFLAGS = $(CFLAGS) |
nuclear@0 | 35 LDFLAGS = $(libgl) $(libs_ldflags) |
nuclear@0 | 36 |
nuclear@0 | 37 .PHONY: all |
nuclear@0 | 38 all: $(lib_so) $(lib_a) |
nuclear@0 | 39 |
nuclear@0 | 40 $(lib_a): $(obj) |
nuclear@0 | 41 $(AR) rcs $@ $(obj) |
nuclear@0 | 42 |
nuclear@0 | 43 $(lib_so): $(obj) |
nuclear@0 | 44 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS) |
nuclear@0 | 45 |
nuclear@0 | 46 -include $(dep) |
nuclear@0 | 47 |
nuclear@0 | 48 %.d: %.c |
nuclear@0 | 49 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@0 | 50 |
nuclear@0 | 51 %.d: %.cc |
nuclear@0 | 52 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@0 | 53 |
nuclear@0 | 54 .PHONY: clean |
nuclear@0 | 55 clean: |
nuclear@0 | 56 rm -f $(obj) $(lib_a) $(lib_so) |
nuclear@0 | 57 |
nuclear@0 | 58 .PHONY: cleandep |
nuclear@0 | 59 cleandep: |
nuclear@0 | 60 rm -f $(dep) |
nuclear@0 | 61 |
nuclear@0 | 62 .PHONY: install |
nuclear@0 | 63 install: $(lib_so) $(lib_a) |
nuclear@0 | 64 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx |
nuclear@0 | 65 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/ |
nuclear@0 | 66 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@0 | 67 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@0 | 68 [ -n "$(devlink)" ] && \ |
nuclear@0 | 69 cd $(DESTDIR)$(PREFIX)/lib && \ |
nuclear@0 | 70 rm -f $(soname) $(devlink) && \ |
nuclear@0 | 71 ln -s $(lib_so) $(soname) && \ |
nuclear@0 | 72 ln -s $(soname) $(devlink) || \ |
nuclear@0 | 73 true |
nuclear@0 | 74 |
nuclear@0 | 75 .PHONY: uninstall |
nuclear@0 | 76 uninstall: |
nuclear@0 | 77 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/* |
nuclear@0 | 78 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx |
nuclear@0 | 79 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@0 | 80 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@0 | 81 [ -n "$(devlink)" ] && \ |
nuclear@0 | 82 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@0 | 83 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ |
nuclear@0 | 84 true |