libgoatvr
annotate Makefile.in @ 13:e4c5c9c0b6f6
added vr_get?_def functions which allow a default to be specified
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 25 Sep 2014 07:23:18 +0300 |
parents | d12592558809 |
children | 5136dfcea7b1 |
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@9 | 18 LDFLAGS = $(mod_libs) $(libgl) |
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@9 | 24 libgl = -framework OpenGL |
nuclear@9 | 25 |
nuclear@9 | 26 ifdef use_libovr |
nuclear@9 | 27 mod_libs += -framework Cocoa -framework IOKit |
nuclear@9 | 28 endif |
nuclear@1 | 29 else |
nuclear@1 | 30 ldname = lib$(name).so |
nuclear@1 | 31 soname = lib$(name).so.$(so_major) |
nuclear@1 | 32 lib_so = lib$(name).so.$(so_major).$(so_minor) |
nuclear@1 | 33 shared = -shared -Wl,-soname=$(soname) |
nuclear@1 | 34 pic = -fPIC |
nuclear@9 | 35 libgl = -lGL -lGLU |
nuclear@1 | 36 endif |
nuclear@1 | 37 |
nuclear@1 | 38 .PHONY: all |
nuclear@7 | 39 all: $(lib_so) $(lib_a) $(soname) $(ldname) |
nuclear@1 | 40 |
nuclear@1 | 41 $(lib_so): $(obj) |
nuclear@9 | 42 $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS) |
nuclear@1 | 43 |
nuclear@7 | 44 $(soname): $(lib_so) |
nuclear@7 | 45 ln -sf $< $@ |
nuclear@7 | 46 |
nuclear@7 | 47 $(ldname): $(soname) |
nuclear@7 | 48 ln -sf $< $@ |
nuclear@7 | 49 |
nuclear@1 | 50 $(lib_a): $(obj) |
nuclear@1 | 51 $(AR) rcs $@ $(obj) |
nuclear@1 | 52 |
nuclear@1 | 53 -include $(dep) |
nuclear@1 | 54 |
nuclear@1 | 55 %.d: %.c |
nuclear@1 | 56 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@1 | 57 |
nuclear@1 | 58 .PHONY: clean |
nuclear@1 | 59 clean: |
nuclear@7 | 60 rm -f $(obj) $(lib_so) $(lib_a) $(soname) $(ldname) |
nuclear@1 | 61 |
nuclear@1 | 62 .PHONY: cleandep |
nuclear@1 | 63 cleandep: clean |
nuclear@1 | 64 rm -f $(dep) |
nuclear@1 | 65 |
nuclear@1 | 66 .PHONY: install |
nuclear@1 | 67 install: $(lib_so) $(lib_a) |
nuclear@1 | 68 mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib |
nuclear@1 | 69 cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h |
nuclear@1 | 70 cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@1 | 71 cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@1 | 72 [ -n "$(soname)" ] && \ |
nuclear@13 | 73 cp -d $(soname) $(ldname) $(DESTDIR)$(PREFIX)/lib || \ |
nuclear@1 | 74 true |
nuclear@1 | 75 |
nuclear@1 | 76 .PHONY: uninstall |
nuclear@1 | 77 uninstall: |
nuclear@1 | 78 rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h |
nuclear@1 | 79 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@1 | 80 rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@1 | 81 [ -n "$(soname)" ] && \ |
nuclear@1 | 82 rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@1 | 83 rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \ |
nuclear@1 | 84 true |