libgoatvr

view Makefile.in @ 7:6896f9cf9621

- configure now emits config.status with the current confure invocation - now vr_init will heed the VR_MODULE env var for the name of the module to use - more stuff on the openhmd module
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 19 Sep 2014 15:16:51 +0300
parents e63cb28fc644
children d12592558809
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)
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) $(soname) $(ldname)
35 $(lib_so): $(obj)
36 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
38 $(soname): $(lib_so)
39 ln -sf $< $@
41 $(ldname): $(soname)
42 ln -sf $< $@
44 $(lib_a): $(obj)
45 $(AR) rcs $@ $(obj)
47 -include $(dep)
49 %.d: %.c
50 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
52 .PHONY: clean
53 clean:
54 rm -f $(obj) $(lib_so) $(lib_a) $(soname) $(ldname)
56 .PHONY: cleandep
57 cleandep: clean
58 rm -f $(dep)
60 .PHONY: install
61 install: $(lib_so) $(lib_a)
62 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
63 cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h
64 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
65 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
66 [ -n "$(soname)" ] && \
67 cd $(DESTDIR)$(PREFIX)/lib && \
68 ln -s $(lib_so) $(soname) && \
69 ln -s $(soname) $(ldname) || \
70 true
72 .PHONY: uninstall
73 uninstall:
74 rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h
75 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
76 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
77 [ -n "$(soname)" ] && \
78 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
79 rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \
80 true