libgoatvr

view Makefile.in @ 10:61feb3661397

windows build fix + new project file for the example
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 20 Sep 2014 20:12:00 +0300
parents 6896f9cf9621
children e4c5c9c0b6f6
line source
1 src = $(wildcard src/*.c)
2 obj = $(src:.c=.o)
3 dep = $(obj:.o=.d)
4 name = goatvr
5 so_major = 0
6 so_minor = 1
8 ifdef use_libovr
9 mod_cflags += -DUSE_LIBOVR
10 mod_libs += -lovr
11 endif
12 ifdef use_openhmd
13 mod_cflags += -DUSE_OPENHMD
14 mod_libs += -lopenhmd
15 endif
17 CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(mod_cflags)
18 LDFLAGS = $(mod_libs) $(libgl)
20 lib_a = lib$(name).a
21 ifeq ($(shell uname -s), Darwin)
22 lib_so = lib$(name).dylib
23 shared = -dynamiclib
24 libgl = -framework OpenGL
26 ifdef use_libovr
27 mod_libs += -framework Cocoa -framework IOKit
28 endif
29 else
30 ldname = lib$(name).so
31 soname = lib$(name).so.$(so_major)
32 lib_so = lib$(name).so.$(so_major).$(so_minor)
33 shared = -shared -Wl,-soname=$(soname)
34 pic = -fPIC
35 libgl = -lGL -lGLU
36 endif
38 .PHONY: all
39 all: $(lib_so) $(lib_a) $(soname) $(ldname)
41 $(lib_so): $(obj)
42 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS)
44 $(soname): $(lib_so)
45 ln -sf $< $@
47 $(ldname): $(soname)
48 ln -sf $< $@
50 $(lib_a): $(obj)
51 $(AR) rcs $@ $(obj)
53 -include $(dep)
55 %.d: %.c
56 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
58 .PHONY: clean
59 clean:
60 rm -f $(obj) $(lib_so) $(lib_a) $(soname) $(ldname)
62 .PHONY: cleandep
63 cleandep: clean
64 rm -f $(dep)
66 .PHONY: install
67 install: $(lib_so) $(lib_a)
68 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
69 cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h
70 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
71 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
72 [ -n "$(soname)" ] && \
73 cd $(DESTDIR)$(PREFIX)/lib && \
74 ln -s $(lib_so) $(soname) && \
75 ln -s $(soname) $(ldname) || \
76 true
78 .PHONY: uninstall
79 uninstall:
80 rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h
81 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
82 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
83 [ -n "$(soname)" ] && \
84 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
85 rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \
86 true