goat3d
annotate goatview/Makefile @ 102:0ea2b355bc96
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 12 Sep 2015 17:32:12 +0300 |
parents | ae6c5941faac |
children |
rev | line source |
---|---|
nuclear@46 | 1 PREFIX = /usr/local |
nuclear@46 | 2 |
nuclear@73 | 3 src = $(wildcard src/*.cc) |
nuclear@80 | 4 csrc = $(wildcard src/*.c) |
nuclear@85 | 5 mochdr = src/goatview.h src/scenemodel.h |
nuclear@73 | 6 mocsrc = $(patsubst src/%.h,src/moc_%.cc,$(mochdr)) |
nuclear@80 | 7 obj = $(sort $(csrc:.c=.o) $(src:.cc=.o) $(mocsrc:.cc=.o)) |
nuclear@19 | 8 dep = $(obj:.o=.d) |
nuclear@19 | 9 bin = goatview |
nuclear@19 | 10 |
nuclear@19 | 11 goat_root = .. |
nuclear@19 | 12 |
nuclear@91 | 13 warn = -Wall |
nuclear@91 | 14 |
nuclear@91 | 15 CFLAGS = $(warn) -g $(pic) -I$(goat_root)/src $(qtinc) |
nuclear@80 | 16 CXXFLAGS = -std=c++11 $(CFLAGS) |
nuclear@92 | 17 LDFLAGS = $(libgoat) $(libgl) $(qtlib) -lvmath -lanim |
nuclear@73 | 18 MOC = moc |
nuclear@73 | 19 |
nuclear@73 | 20 qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL` |
nuclear@73 | 21 qtlib = `pkg-config --libs Qt5Gui Qt5Core Qt5OpenGL` |
nuclear@19 | 22 |
nuclear@98 | 23 ifeq ($(compiler), clang) |
nuclear@98 | 24 CXXFLAGS += -stdlib=libc++ |
nuclear@98 | 25 warn += '-Wno-\#warnings' |
nuclear@98 | 26 else |
nuclear@98 | 27 warn += -Wno-cpp |
nuclear@98 | 28 endif |
nuclear@98 | 29 |
nuclear@19 | 30 ifeq ($(shell uname -s), Darwin) |
nuclear@19 | 31 libgl = -framework OpenGL -framework GLUT -lGLEW |
nuclear@23 | 32 libgoat = $(goat_root)/libgoat3d.dylib |
nuclear@91 | 33 warn += -Wno-deprecated-declarations |
nuclear@92 | 34 bundle = $(bin).app |
nuclear@92 | 35 dmg = $(bin).dmg |
nuclear@19 | 36 else |
nuclear@73 | 37 pic = -fPIC |
nuclear@19 | 38 libgl = -lGL -lGLU -lglut -lGLEW |
nuclear@44 | 39 libgoat = $(goat_root)/libgoat3d.so.0.1 |
nuclear@19 | 40 endif |
nuclear@19 | 41 |
nuclear@19 | 42 $(bin): $(obj) $(libgoat) |
nuclear@73 | 43 $(CXX) -o $@ $(obj) $(LDFLAGS) |
nuclear@73 | 44 |
nuclear@73 | 45 # rule for running moc on ui header files |
nuclear@73 | 46 moc_%.cc: %.h |
nuclear@73 | 47 $(MOC) -o $@ $< |
nuclear@19 | 48 |
nuclear@19 | 49 -include $(dep) |
nuclear@19 | 50 |
nuclear@80 | 51 %.d: %.c |
nuclear@80 | 52 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@80 | 53 |
nuclear@73 | 54 %.d: %.cc |
nuclear@73 | 55 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ |
nuclear@19 | 56 |
nuclear@19 | 57 .PHONY: clean |
nuclear@19 | 58 clean: |
nuclear@19 | 59 rm -f $(obj) $(bin) |
nuclear@92 | 60 [ -n "$(bundle)" ] && rm -rf $(bundle) || true |
nuclear@92 | 61 [ -n "$(dmg)" ] && rm -rf $(dmg) || true |
nuclear@19 | 62 |
nuclear@19 | 63 .PHONY: cleandep |
nuclear@19 | 64 cleandep: |
nuclear@19 | 65 rm -f $(dep) |
nuclear@46 | 66 |
nuclear@46 | 67 .PHONY: install |
nuclear@46 | 68 install: $(bin) |
nuclear@46 | 69 cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin) |
nuclear@46 | 70 |
nuclear@46 | 71 .PHONY: uninstall |
nuclear@46 | 72 uninstall: |
nuclear@46 | 73 rm -f $(DESTDIR)$(PREFIX)/bin/$(bin) |
nuclear@92 | 74 |
nuclear@92 | 75 .PHONY: echo |
nuclear@92 | 76 echo: |
nuclear@92 | 77 @echo $(var)=\"$($(var))\" |
nuclear@92 | 78 |
nuclear@92 | 79 .PHONY: bundle |
nuclear@92 | 80 bundle: $(bundle) |
nuclear@92 | 81 |
nuclear@92 | 82 .PHONY: dmg |
nuclear@92 | 83 dmg: $(dmg) |
nuclear@92 | 84 |
nuclear@92 | 85 $(bundle): $(bin) $(libgoat) |
nuclear@92 | 86 rm -rf $(bundle) |
nuclear@92 | 87 mkdir -p $(bundle)/Contents/MacOS |
nuclear@92 | 88 mkdir -p $(bundle)/Contents/Frameworks |
nuclear@92 | 89 cp $(bin) $(bundle)/Contents/MacOS/$(bin) |
nuclear@92 | 90 macdeployqt $(bundle) |
nuclear@92 | 91 cp $(libgoat) $(bundle)/Contents/Frameworks |
nuclear@92 | 92 cp /usr/local/lib/libvmath.dylib $(bundle)/Contents/Frameworks |
nuclear@92 | 93 cp /usr/local/lib/libanim.dylib $(bundle)/Contents/Frameworks |
nuclear@92 | 94 |
nuclear@92 | 95 $(dmg): $(bundle) |
nuclear@92 | 96 rm -f $@ |
nuclear@92 | 97 hdiutil create -format UDBZ -quiet -srcfolder $< $@ |
nuclear@92 | 98 |
nuclear@92 | 99 .PHONY: run |
nuclear@92 | 100 ifeq ($(shell uname -s), Darwin) |
nuclear@92 | 101 run: $(bundle) |
nuclear@92 | 102 ./$(bundle)/Contents/MacOS/$(bin) |
nuclear@92 | 103 else |
nuclear@92 | 104 run: $(bin) |
nuclear@92 | 105 ./$(bin) |
nuclear@92 | 106 endif |
nuclear@98 | 107 |
nuclear@98 | 108 ccver = $(shell $(CC) --version) |
nuclear@98 | 109 ifneq (,$(findstring LLVM,$(ccver))) |
nuclear@98 | 110 # clang/llvm |
nuclear@98 | 111 compiler = clang |
nuclear@98 | 112 else |
nuclear@98 | 113 # other, assume gcc |
nuclear@98 | 114 compiler = gcc |
nuclear@98 | 115 endif |