nuclear@46: PREFIX = /usr/local nuclear@46: nuclear@73: src = $(wildcard src/*.cc) nuclear@80: csrc = $(wildcard src/*.c) nuclear@85: mochdr = src/goatview.h src/scenemodel.h nuclear@73: mocsrc = $(patsubst src/%.h,src/moc_%.cc,$(mochdr)) nuclear@80: obj = $(sort $(csrc:.c=.o) $(src:.cc=.o) $(mocsrc:.cc=.o)) nuclear@19: dep = $(obj:.o=.d) nuclear@19: bin = goatview nuclear@19: nuclear@19: goat_root = .. nuclear@19: nuclear@91: warn = -Wall nuclear@91: nuclear@91: CFLAGS = $(warn) -g $(pic) -I$(goat_root)/src $(qtinc) nuclear@80: CXXFLAGS = -std=c++11 $(CFLAGS) nuclear@92: LDFLAGS = $(libgoat) $(libgl) $(qtlib) -lvmath -lanim nuclear@73: MOC = moc nuclear@73: nuclear@73: qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL` nuclear@73: qtlib = `pkg-config --libs Qt5Gui Qt5Core Qt5OpenGL` nuclear@19: nuclear@98: ifeq ($(compiler), clang) nuclear@98: CXXFLAGS += -stdlib=libc++ nuclear@98: warn += '-Wno-\#warnings' nuclear@98: else nuclear@98: warn += -Wno-cpp nuclear@98: endif nuclear@98: nuclear@19: ifeq ($(shell uname -s), Darwin) nuclear@19: libgl = -framework OpenGL -framework GLUT -lGLEW nuclear@23: libgoat = $(goat_root)/libgoat3d.dylib nuclear@91: warn += -Wno-deprecated-declarations nuclear@92: bundle = $(bin).app nuclear@92: dmg = $(bin).dmg nuclear@19: else nuclear@73: pic = -fPIC nuclear@19: libgl = -lGL -lGLU -lglut -lGLEW nuclear@44: libgoat = $(goat_root)/libgoat3d.so.0.1 nuclear@19: endif nuclear@19: nuclear@19: $(bin): $(obj) $(libgoat) nuclear@73: $(CXX) -o $@ $(obj) $(LDFLAGS) nuclear@73: nuclear@73: # rule for running moc on ui header files nuclear@73: moc_%.cc: %.h nuclear@73: $(MOC) -o $@ $< nuclear@19: nuclear@19: -include $(dep) nuclear@19: nuclear@80: %.d: %.c nuclear@80: @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ nuclear@80: nuclear@73: %.d: %.cc nuclear@73: @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ nuclear@19: nuclear@19: .PHONY: clean nuclear@19: clean: nuclear@19: rm -f $(obj) $(bin) nuclear@92: [ -n "$(bundle)" ] && rm -rf $(bundle) || true nuclear@92: [ -n "$(dmg)" ] && rm -rf $(dmg) || true nuclear@19: nuclear@19: .PHONY: cleandep nuclear@19: cleandep: nuclear@19: rm -f $(dep) nuclear@46: nuclear@46: .PHONY: install nuclear@46: install: $(bin) nuclear@46: cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin) nuclear@46: nuclear@46: .PHONY: uninstall nuclear@46: uninstall: nuclear@46: rm -f $(DESTDIR)$(PREFIX)/bin/$(bin) nuclear@92: nuclear@92: .PHONY: echo nuclear@92: echo: nuclear@92: @echo $(var)=\"$($(var))\" nuclear@92: nuclear@92: .PHONY: bundle nuclear@92: bundle: $(bundle) nuclear@92: nuclear@92: .PHONY: dmg nuclear@92: dmg: $(dmg) nuclear@92: nuclear@92: $(bundle): $(bin) $(libgoat) nuclear@92: rm -rf $(bundle) nuclear@92: mkdir -p $(bundle)/Contents/MacOS nuclear@92: mkdir -p $(bundle)/Contents/Frameworks nuclear@92: cp $(bin) $(bundle)/Contents/MacOS/$(bin) nuclear@92: macdeployqt $(bundle) nuclear@92: cp $(libgoat) $(bundle)/Contents/Frameworks nuclear@92: cp /usr/local/lib/libvmath.dylib $(bundle)/Contents/Frameworks nuclear@92: cp /usr/local/lib/libanim.dylib $(bundle)/Contents/Frameworks nuclear@92: nuclear@92: $(dmg): $(bundle) nuclear@92: rm -f $@ nuclear@92: hdiutil create -format UDBZ -quiet -srcfolder $< $@ nuclear@92: nuclear@92: .PHONY: run nuclear@92: ifeq ($(shell uname -s), Darwin) nuclear@92: run: $(bundle) nuclear@92: ./$(bundle)/Contents/MacOS/$(bin) nuclear@92: else nuclear@92: run: $(bin) nuclear@92: ./$(bin) nuclear@92: endif nuclear@98: nuclear@98: ccver = $(shell $(CC) --version) nuclear@98: ifneq (,$(findstring LLVM,$(ccver))) nuclear@98: # clang/llvm nuclear@98: compiler = clang nuclear@98: else nuclear@98: # other, assume gcc nuclear@98: compiler = gcc nuclear@98: endif