libgoatvr

annotate Makefile.in @ 1:d861e4d6850f

added unix makefile and configure script
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 29 Aug 2014 05:09:45 +0300
parents
children e63cb28fc644
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@1 14 mod_libs += -lhmd
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@1 33 $(all): $(lib_so) $(lib_a)
nuclear@1 34
nuclear@1 35 $(lib_so): $(obj)
nuclear@1 36 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
nuclear@1 37
nuclear@1 38 $(lib_a): $(obj)
nuclear@1 39 $(AR) rcs $@ $(obj)
nuclear@1 40
nuclear@1 41 -include $(dep)
nuclear@1 42
nuclear@1 43 %.d: %.c
nuclear@1 44 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
nuclear@1 45
nuclear@1 46 .PHONY: clean
nuclear@1 47 clean:
nuclear@1 48 rm -f $(obj) $(bin)
nuclear@1 49
nuclear@1 50 .PHONY: cleandep
nuclear@1 51 cleandep: clean
nuclear@1 52 rm -f $(dep)
nuclear@1 53
nuclear@1 54 .PHONY: install
nuclear@1 55 install: $(lib_so) $(lib_a)
nuclear@1 56 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
nuclear@1 57 cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h
nuclear@1 58 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@1 59 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@1 60 [ -n "$(soname)" ] && \
nuclear@1 61 cd $(DESTDIR)$(PREFIX)/lib && \
nuclear@1 62 ln -s $(lib_so) $(soname) && \
nuclear@1 63 ln -s $(soname) $(ldname) || \
nuclear@1 64 true
nuclear@1 65
nuclear@1 66 .PHONY: uninstall
nuclear@1 67 uninstall:
nuclear@1 68 rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h
nuclear@1 69 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a)
nuclear@1 70 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so)
nuclear@1 71 [ -n "$(soname)" ] && \
nuclear@1 72 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
nuclear@1 73 rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \
nuclear@1 74 true