libgoatvr

annotate 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
rev   line source
nuclear@1 1 src = $(wildcard src/*.c)
nuclear@1 2 obj = $(src:.c=.o)
nuclear@1 3 dep = $(obj:.o=.d)
nuclear@1 4 name = goatvr
nuclear@1 5 so_major = 0
nuclear@1 6 so_minor = 1
nuclear@1 7
nuclear@1 8 ifdef use_libovr
nuclear@1 9 mod_cflags += -DUSE_LIBOVR
nuclear@1 10 mod_libs += -lovr
nuclear@1 11 endif
nuclear@1 12 ifdef use_openhmd
nuclear@1 13 mod_cflags += -DUSE_OPENHMD
nuclear@7 14 mod_libs += -lopenhmd
nuclear@1 15 endif
nuclear@1 16
nuclear@1 17 CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(mod_cflags)
nuclear@1 18 LDFLAGS = $(mod_libs)
nuclear@1 19
nuclear@1 20 lib_a = lib$(name).a
nuclear@1 21 ifeq ($(shell uname -s), Darwin)
nuclear@1 22 lib_so = lib$(name).dylib
nuclear@1 23 shared = -dynamiclib
nuclear@1 24 else
nuclear@1 25 ldname = lib$(name).so
nuclear@1 26 soname = lib$(name).so.$(so_major)
nuclear@1 27 lib_so = lib$(name).so.$(so_major).$(so_minor)
nuclear@1 28 shared = -shared -Wl,-soname=$(soname)
nuclear@1 29 pic = -fPIC
nuclear@1 30 endif
nuclear@1 31
nuclear@1 32 .PHONY: all
nuclear@7 33 all: $(lib_so) $(lib_a) $(soname) $(ldname)
nuclear@1 34
nuclear@1 35 $(lib_so): $(obj)
nuclear@1 36 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@1 37
nuclear@7 38 $(soname): $(lib_so)
nuclear@7 39 ln -sf $< $@
nuclear@7 40
nuclear@7 41 $(ldname): $(soname)
nuclear@7 42 ln -sf $< $@
nuclear@7 43
nuclear@1 44 $(lib_a): $(obj)
nuclear@1 45 $(AR) rcs $@ $(obj)
nuclear@1 46
nuclear@1 47 -include $(dep)
nuclear@1 48
nuclear@1 49 %.d: %.c
nuclear@1 50 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@1 51
nuclear@1 52 .PHONY: clean
nuclear@1 53 clean:
nuclear@7 54 rm -f $(obj) $(lib_so) $(lib_a) $(soname) $(ldname)
nuclear@1 55
nuclear@1 56 .PHONY: cleandep
nuclear@1 57 cleandep: clean
nuclear@1 58 rm -f $(dep)
nuclear@1 59
nuclear@1 60 .PHONY: install
nuclear@1 61 install: $(lib_so) $(lib_a)
nuclear@1 62 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
nuclear@1 63 cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h
nuclear@1 64 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@1 65 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@1 66 [ -n "$(soname)" ] && \
nuclear@1 67 cd $(DESTDIR)$(PREFIX)/lib && \
nuclear@1 68 ln -s $(lib_so) $(soname) && \
nuclear@1 69 ln -s $(soname) $(ldname) || \
nuclear@1 70 true
nuclear@1 71
nuclear@1 72 .PHONY: uninstall
nuclear@1 73 uninstall:
nuclear@1 74 rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h
nuclear@1 75 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@1 76 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@1 77 [ -n "$(soname)" ] && \
nuclear@1 78 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
nuclear@1 79 rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \
nuclear@1 80 true