nuclear@1: src = $(wildcard src/*.c) nuclear@1: obj = $(src:.c=.o) nuclear@1: dep = $(obj:.o=.d) nuclear@1: name = goatvr nuclear@1: so_major = 0 nuclear@1: so_minor = 1 nuclear@1: nuclear@1: ifdef use_libovr nuclear@1: mod_cflags += -DUSE_LIBOVR nuclear@1: mod_libs += -lovr nuclear@1: endif nuclear@1: ifdef use_openhmd nuclear@1: mod_cflags += -DUSE_OPENHMD nuclear@1: mod_libs += -lhmd nuclear@1: endif nuclear@1: nuclear@1: CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(mod_cflags) nuclear@1: LDFLAGS = $(mod_libs) nuclear@1: nuclear@1: lib_a = lib$(name).a nuclear@1: ifeq ($(shell uname -s), Darwin) nuclear@1: lib_so = lib$(name).dylib nuclear@1: shared = -dynamiclib nuclear@1: else nuclear@1: ldname = lib$(name).so nuclear@1: soname = lib$(name).so.$(so_major) nuclear@1: lib_so = lib$(name).so.$(so_major).$(so_minor) nuclear@1: shared = -shared -Wl,-soname=$(soname) nuclear@1: pic = -fPIC nuclear@1: endif nuclear@1: nuclear@1: .PHONY: all nuclear@1: $(all): $(lib_so) $(lib_a) nuclear@1: nuclear@1: $(lib_so): $(obj) nuclear@1: $(CC) -o $@ $(shared) $(obj) $(LDFLAGS) nuclear@1: nuclear@1: $(lib_a): $(obj) nuclear@1: $(AR) rcs $@ $(obj) nuclear@1: nuclear@1: -include $(dep) nuclear@1: nuclear@1: %.d: %.c nuclear@1: @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ nuclear@1: nuclear@1: .PHONY: clean nuclear@1: clean: nuclear@1: rm -f $(obj) $(bin) nuclear@1: nuclear@1: .PHONY: cleandep nuclear@1: cleandep: clean nuclear@1: rm -f $(dep) nuclear@1: nuclear@1: .PHONY: install nuclear@1: install: $(lib_so) $(lib_a) nuclear@1: mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib nuclear@1: cp src/vr.h $(DESTDIR)$(PREFIX)/include/goatvr.h nuclear@1: cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@1: cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@1: [ -n "$(soname)" ] && \ nuclear@1: cd $(DESTDIR)$(PREFIX)/lib && \ nuclear@1: ln -s $(lib_so) $(soname) && \ nuclear@1: ln -s $(soname) $(ldname) || \ nuclear@1: true nuclear@1: nuclear@1: .PHONY: uninstall nuclear@1: uninstall: nuclear@1: rm -f $(DESTDIR)$(PREFIX)/include/goatvr.h nuclear@1: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@1: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@1: [ -n "$(soname)" ] && \ nuclear@1: rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ nuclear@1: rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || \ nuclear@1: true