nuclear@1: ccsrc = $(wildcard src/*.cc) \ nuclear@1: $(wildcard gmath/*.cc) nuclear@1: csrc = $(wildcard src/*.c) \ nuclear@1: $(wildcard gmath/*.c) nuclear@1: obj = $(ccsrc:.cc=.o) $(csrc:.c=.o) nuclear@1: dep = $(obj:.o=.d) nuclear@1: nuclear@1: name = graphene3d nuclear@1: somajor = 0 nuclear@1: sominor = 1 nuclear@1: nuclear@1: sys = $(shell uname -s) nuclear@1: nuclear@1: ifeq ($(sys), Darwin) nuclear@1: libgl = -framework OpenGL -lGLEW nuclear@1: nuclear@1: shared = -dynamiclib nuclear@1: solib = lib$(name).dylib nuclear@1: else nuclear@1: libgl = -lGL -lGLU -lGLEW nuclear@1: nuclear@1: ldname = lib$(name).so nuclear@1: soname = $(ldname).$(somajor) nuclear@1: solib = $(soname).$(sominor) nuclear@1: nuclear@1: shared = -shared -Wl,-soname=$(soname) nuclear@1: pic = -fPIC nuclear@1: endif nuclear@1: nuclear@1: inc = -Ilib nuclear@1: opt = nuclear@1: dbg = -g nuclear@1: nuclear@1: CFLAGS = -pedantic -Wall $(opt) $(dbg) $(pic) $(inc) nuclear@1: CXXFLAGS = $(CFLAGS) nuclear@1: LDFLAGS = $(libgl) nuclear@1: nuclear@1: .PHONY: shared nuclear@1: shared: $(solib) nuclear@1: nuclear@1: $(solib): $(obj) nuclear@1: $(CXX) -o $@ $(shared) $(obj) $(LDFLAGS) nuclear@1: [ -n "$(soname)" ] && \ nuclear@1: rm -f $(soname) $(ldname) && \ nuclear@1: ln -s $(solib) $(soname) && \ nuclear@1: ln -s $(soname) $(ldname) || true nuclear@1: nuclear@1: -include $(dep) nuclear@1: nuclear@1: %.d: %.c nuclear@1: @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ nuclear@1: nuclear@1: %.d: %.cc nuclear@1: @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ nuclear@1: nuclear@1: .PHONY: clean nuclear@1: clean: nuclear@1: rm -f $(obj) $(solib) nuclear@1: nuclear@1: .PHONY: cleandep nuclear@1: cleandep: nuclear@1: rm -f $(dep)