nuclear@0: # ----- options ----- nuclear@0: PREFIX = /usr/local nuclear@0: dbg = -g nuclear@0: opt = -O0 nuclear@0: # ------------------- nuclear@0: nuclear@0: src = $(wildcard src/*.cc) nuclear@0: obj = $(src:.cc=.o) nuclear@0: dep = $(obj:.o=.d) nuclear@0: nuclear@14: openctm = libs/openctm/libopenctm.a nuclear@19: tinyxml2 = libs/tinyxml2/libtinyxml2.a nuclear@29: vmath = libs/vmath/libvmath.a nuclear@29: anim = libs/anim/libanim.a nuclear@14: nuclear@29: extinc = -Ilibs/openctm -Ilibs/tinyxml2 -Ilibs/anim nuclear@29: extlibs = $(openctm) $(tinyxml2) $(anim) $(vmath) nuclear@14: nuclear@0: name = goat3d nuclear@0: so_major = 0 nuclear@0: so_minor = 1 nuclear@0: nuclear@0: lib_a = lib$(name).a nuclear@0: nuclear@0: ifeq ($(shell uname -s), Darwin) nuclear@0: lib_so = lib$(name).dylib nuclear@0: shared = -dynamiclib nuclear@0: else nuclear@0: devlink = lib$(name).so nuclear@0: soname = lib$(name).so.$(so_major) nuclear@0: lib_so = lib$(name).so.$(so_major).$(so_minor) nuclear@0: nuclear@0: shared = -shared -Wl,-soname=$(soname) nuclear@0: pic = -fPIC nuclear@0: endif nuclear@0: nuclear@15: CC = clang nuclear@15: CXX = clang++ nuclear@14: CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) $(extinc) nuclear@50: LDFLAGS = $(extlibs) -lpthread nuclear@0: nuclear@0: .PHONY: all nuclear@0: all: $(lib_so) $(lib_a) nuclear@0: nuclear@14: $(lib_so): $(obj) $(extlibs) nuclear@0: $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS) nuclear@0: nuclear@14: $(lib_a): $(obj) $(extlibs) nuclear@29: $(AR) rcs $@ $(obj) $(extlibs) nuclear@0: nuclear@50: .PHONY: $(openctm) nuclear@14: $(openctm): nuclear@14: $(MAKE) -C libs/openctm nuclear@14: nuclear@50: .PHONY: $(tinyxml2) nuclear@19: $(tinyxml2): nuclear@19: $(MAKE) -C libs/tinyxml2 nuclear@19: nuclear@50: .PHONY: $(vmath) nuclear@29: $(vmath): nuclear@29: $(MAKE) -C libs/vmath nuclear@29: nuclear@50: .PHONY: $(anim) nuclear@29: $(anim): nuclear@29: $(MAKE) -C libs/anim nuclear@29: nuclear@0: -include $(dep) nuclear@0: nuclear@0: %.d: %.cc nuclear@0: @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ nuclear@0: nuclear@0: .PHONY: clean nuclear@0: clean: nuclear@0: rm -f $(obj) $(lib_a) $(lib_so) nuclear@0: nuclear@0: .PHONY: cleandep nuclear@0: cleandep: nuclear@0: rm -f $(dep) nuclear@29: nuclear@29: .PHONY: install nuclear@29: install: $(lib_so) $(lib_a) nuclear@29: mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include nuclear@29: cp src/goat3d.h $(DESTDIR)$(PREFIX)/include/goat3d.h nuclear@29: cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@29: cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@29: [ -n "$(devlink)" ] && \ nuclear@29: cd $(DESTDIR)$(PREFIX)/lib && \ nuclear@29: rm -f $(soname) $(devlink) && \ nuclear@29: ln -s $(lib_so) $(soname) && \ nuclear@29: ln -s $(soname) $(devlink) || \ nuclear@29: true nuclear@29: nuclear@29: .PHONY: uninstall nuclear@29: uninstall: nuclear@29: rm -f $(DESTDIR)$(PREFIX)/include/goat3d.h nuclear@29: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@29: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@29: [ -n "$(devlink)" ] && \ nuclear@29: rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ nuclear@29: rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ nuclear@29: true