libgoatvr

view Makefile.in @ 3:83292083070b

added USE_LIBOVR to the visual studio project, and fixed the build
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 29 Aug 2014 05:54:26 +0300
parents
children e63cb28fc644
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 += -lhmd
15 endif
17 CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(mod_cflags)
18 LDFLAGS = $(mod_libs)
20 lib_a = lib$(name).a
21 ifeq ($(shell uname -s), Darwin)
22 lib_so = lib$(name).dylib
23 shared = -dynamiclib
24 else
25 ldname = lib$(name).so
26 soname = lib$(name).so.$(so_major)
27 lib_so = lib$(name).so.$(so_major).$(so_minor)
28 shared = -shared -Wl,-soname=$(soname)
29 pic = -fPIC
30 endif
32 .PHONY: all
33 $(all): $(lib_so) $(lib_a)
35 $(lib_so): $(obj)
36 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
38 $(lib_a): $(obj)
39 $(AR) rcs $@ $(obj)
41 -include $(dep)
43 %.d: %.c
44 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
46 .PHONY: clean
47 clean:
48 rm -f $(obj) $(bin)
50 .PHONY: cleandep
51 cleandep: clean
52 rm -f $(dep)
54 .PHONY: install
55 install: $(lib_so) $(lib_a)
56 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
57 cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h
58 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
59 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
60 [ -n "$(soname)" ] && \
61 cd $(DESTDIR)$(PREFIX)/lib && \
62 ln -s $(lib_so) $(soname) && \
63 ln -s $(soname) $(ldname) || \
64 true
66 .PHONY: uninstall
67 uninstall:
68 rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h
69 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
70 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
71 [ -n "$(soname)" ] && \
72 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
73 rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \
74 true