goat3dgfx
view 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 |
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
28 dbg = -g
29 warn = -Wall
31 libs_ldflags = -limago -lanim -lpsys -lvmath
33 CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(libs_cflags)
34 CXXFLAGS = $(CFLAGS)
35 LDFLAGS = $(libgl) $(libs_ldflags)
37 .PHONY: all
38 all: $(lib_so) $(lib_a)
40 $(lib_a): $(obj)
41 $(AR) rcs $@ $(obj)
43 $(lib_so): $(obj)
44 $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS)
46 -include $(dep)
48 %.d: %.c
49 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
51 %.d: %.cc
52 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
54 .PHONY: clean
55 clean:
56 rm -f $(obj) $(lib_a) $(lib_so)
58 .PHONY: cleandep
59 cleandep:
60 rm -f $(dep)
62 .PHONY: install
63 install: $(lib_so) $(lib_a)
64 mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx
65 cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/
66 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
67 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
68 [ -n "$(devlink)" ] && \
69 cd $(DESTDIR)$(PREFIX)/lib && \
70 rm -f $(soname) $(devlink) && \
71 ln -s $(lib_so) $(soname) && \
72 ln -s $(soname) $(devlink) || \
73 true
75 .PHONY: uninstall
76 uninstall:
77 rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/*
78 rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx
79 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
80 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
81 [ -n "$(devlink)" ] && \
82 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
83 rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \
84 true