nuclear@0: PREFIX = /usr/local nuclear@0: nuclear@0: csrc = $(wildcard src/*.c) nuclear@0: ccsrc = $(wildcard src/*.cc) nuclear@0: obj = $(csrc:.c=.o) $(ccsrc:.cc=.o) nuclear@0: dep = $(obj:.o=.d) nuclear@0: name = goat3dgfx nuclear@0: lib_a = lib$(name).a nuclear@0: nuclear@0: so_major = 0 nuclear@0: so_minor = 1 nuclear@0: nuclear@0: ifeq ($(shell uname -r), Darwin) nuclear@0: libgl = -framework OpenGL -framework GLUT -lGLEW nuclear@0: nuclear@0: lib_so = lib$(name).dylib nuclear@0: shared = -dynamiclib nuclear@0: else nuclear@0: libgl = -lGL -lGLU -lglut -lGLEW nuclear@0: nuclear@0: lib_so = lib$(name).so.$(so_major).$(so_minor) nuclear@0: soname = lib$(name).so.$(so_major) nuclear@0: devlink = lib$(name).so nuclear@0: shared = -shared -Wl,-soname=$(soname) nuclear@0: pic = -fPIC nuclear@0: endif nuclear@0: nuclear@8: dbg = -g nuclear@8: warn = -Wall nuclear@0: nuclear@9: libs_ldflags = -limago -lanim -lpsys -lvmath nuclear@9: nuclear@0: CFLAGS = -pedantic $(warn) $(dbg) $(pic) $(opt) $(inc) $(libs_cflags) nuclear@0: CXXFLAGS = $(CFLAGS) nuclear@0: LDFLAGS = $(libgl) $(libs_ldflags) nuclear@0: nuclear@0: .PHONY: all nuclear@0: all: $(lib_so) $(lib_a) nuclear@0: nuclear@0: $(lib_a): $(obj) nuclear@0: $(AR) rcs $@ $(obj) nuclear@0: nuclear@0: $(lib_so): $(obj) nuclear@0: $(CXX) $(shared) -o $@ $(obj) $(LDFLAGS) nuclear@0: nuclear@0: -include $(dep) nuclear@0: nuclear@0: %.d: %.c nuclear@0: @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ 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@0: nuclear@0: .PHONY: install nuclear@0: install: $(lib_so) $(lib_a) nuclear@0: mkdir -p $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include/goat3dgfx nuclear@0: cp src/*.h src/*.inl $(DESTDIR)$(PREFIX)/include/goat3dgfx/ nuclear@0: cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@0: cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@0: [ -n "$(devlink)" ] && \ nuclear@0: cd $(DESTDIR)$(PREFIX)/lib && \ nuclear@0: rm -f $(soname) $(devlink) && \ nuclear@0: ln -s $(lib_so) $(soname) && \ nuclear@0: ln -s $(soname) $(devlink) || \ nuclear@0: true nuclear@0: nuclear@0: .PHONY: uninstall nuclear@0: uninstall: nuclear@0: rm -f $(DESTDIR)$(PREFIX)/include/goat3dgfx/* nuclear@0: rmdir $(DESTDIR)$(PREFIX)/include/goat3dgfx nuclear@0: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@0: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@0: [ -n "$(devlink)" ] && \ nuclear@0: rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \ nuclear@0: rm -f $(DESTDIR)$(PREFIX)/lib/$(devlink) || \ nuclear@0: true