libgoatvr
diff 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 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Makefile.in Fri Aug 29 05:09:45 2014 +0300 1.3 @@ -0,0 +1,74 @@ 1.4 +src = $(wildcard src/*.c) 1.5 +obj = $(src:.c=.o) 1.6 +dep = $(obj:.o=.d) 1.7 +name = goatvr 1.8 +so_major = 0 1.9 +so_minor = 1 1.10 + 1.11 +ifdef use_libovr 1.12 + mod_cflags += -DUSE_LIBOVR 1.13 + mod_libs += -lovr 1.14 +endif 1.15 +ifdef use_openhmd 1.16 + mod_cflags += -DUSE_OPENHMD 1.17 + mod_libs += -lhmd 1.18 +endif 1.19 + 1.20 +CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(mod_cflags) 1.21 +LDFLAGS = $(mod_libs) 1.22 + 1.23 +lib_a = lib$(name).a 1.24 +ifeq ($(shell uname -s), Darwin) 1.25 + lib_so = lib$(name).dylib 1.26 + shared = -dynamiclib 1.27 +else 1.28 + ldname = lib$(name).so 1.29 + soname = lib$(name).so.$(so_major) 1.30 + lib_so = lib$(name).so.$(so_major).$(so_minor) 1.31 + shared = -shared -Wl,-soname=$(soname) 1.32 + pic = -fPIC 1.33 +endif 1.34 + 1.35 +.PHONY: all 1.36 +$(all): $(lib_so) $(lib_a) 1.37 + 1.38 +$(lib_so): $(obj) 1.39 + $(CC) -o $@ $(shared) $(obj) $(LDFLAGS) 1.40 + 1.41 +$(lib_a): $(obj) 1.42 + $(AR) rcs $@ $(obj) 1.43 + 1.44 +-include $(dep) 1.45 + 1.46 +%.d: %.c 1.47 + @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ 1.48 + 1.49 +.PHONY: clean 1.50 +clean: 1.51 + rm -f $(obj) $(bin) 1.52 + 1.53 +.PHONY: cleandep 1.54 +cleandep: clean 1.55 + rm -f $(dep) 1.56 + 1.57 +.PHONY: install 1.58 +install: $(lib_so) $(lib_a) 1.59 + mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib 1.60 + cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h 1.61 + cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) 1.62 + cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) 1.63 + [ -n "$(soname)" ] && \ 1.64 + cd $(DESTDIR)$(PREFIX)/lib && \ 1.65 + ln -s $(lib_so) $(soname) && \ 1.66 + ln -s $(soname) $(ldname) || \ 1.67 + true 1.68 + 1.69 +.PHONY: uninstall 1.70 +uninstall: 1.71 + rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h 1.72 + rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) 1.73 + rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) 1.74 + [ -n "$(soname)" ] && \ 1.75 + rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ 1.76 + rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \ 1.77 + true