goat3d

diff goatview/Makefile @ 92:ae6c5941faac

[goatview] makefile rules to create app bundle and dmg archive [goatview] creating multisampling context
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 18 May 2014 01:19:10 +0300
parents f92da4fa9a6d
children b43d33f3ba69
line diff
     1.1 --- a/goatview/Makefile	Sat May 17 15:42:10 2014 +0300
     1.2 +++ b/goatview/Makefile	Sun May 18 01:19:10 2014 +0300
     1.3 @@ -14,7 +14,7 @@
     1.4  
     1.5  CFLAGS = $(warn) -g $(pic) -I$(goat_root)/src $(qtinc)
     1.6  CXXFLAGS = -std=c++11 $(CFLAGS)
     1.7 -LDFLAGS = $(libgoat) $(libgl) $(qtlib) -lvmath
     1.8 +LDFLAGS = $(libgoat) $(libgl) $(qtlib) -lvmath -lanim
     1.9  MOC = moc
    1.10  
    1.11  qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL`
    1.12 @@ -24,6 +24,8 @@
    1.13  	libgl = -framework OpenGL -framework GLUT -lGLEW
    1.14  	libgoat = $(goat_root)/libgoat3d.dylib
    1.15  	warn += -Wno-deprecated-declarations
    1.16 +	bundle = $(bin).app
    1.17 +	dmg = $(bin).dmg
    1.18  else
    1.19  	pic = -fPIC
    1.20  	libgl = -lGL -lGLU -lglut -lGLEW
    1.21 @@ -35,6 +37,7 @@
    1.22  endif
    1.23  ifneq ($(shell $(CC) --version | grep LLVM),)
    1.24  	CXXFLAGS += -stdlib=libc++
    1.25 +	warn += '-Wno-\#warnings'
    1.26  endif
    1.27  
    1.28  $(bin): $(obj) $(libgoat)
    1.29 @@ -55,6 +58,8 @@
    1.30  .PHONY: clean
    1.31  clean:
    1.32  	rm -f $(obj) $(bin)
    1.33 +	[ -n "$(bundle)" ] && rm -rf $(bundle) || true
    1.34 +	[ -n "$(dmg)" ] && rm -rf $(dmg) || true
    1.35  
    1.36  .PHONY: cleandep
    1.37  cleandep:
    1.38 @@ -67,3 +72,36 @@
    1.39  .PHONY: uninstall
    1.40  uninstall:
    1.41  	rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)
    1.42 +
    1.43 +.PHONY: echo
    1.44 +echo:
    1.45 +	@echo $(var)=\"$($(var))\"
    1.46 +
    1.47 +.PHONY: bundle
    1.48 +bundle: $(bundle)
    1.49 +
    1.50 +.PHONY: dmg
    1.51 +dmg: $(dmg)
    1.52 +
    1.53 +$(bundle): $(bin) $(libgoat)
    1.54 +	rm -rf $(bundle)
    1.55 +	mkdir -p $(bundle)/Contents/MacOS
    1.56 +	mkdir -p $(bundle)/Contents/Frameworks
    1.57 +	cp $(bin) $(bundle)/Contents/MacOS/$(bin)
    1.58 +	macdeployqt $(bundle)
    1.59 +	cp $(libgoat) $(bundle)/Contents/Frameworks
    1.60 +	cp /usr/local/lib/libvmath.dylib $(bundle)/Contents/Frameworks
    1.61 +	cp /usr/local/lib/libanim.dylib $(bundle)/Contents/Frameworks
    1.62 +
    1.63 +$(dmg): $(bundle)
    1.64 +	rm -f $@
    1.65 +	hdiutil create -format UDBZ -quiet -srcfolder $< $@
    1.66 +
    1.67 +.PHONY: run
    1.68 +ifeq ($(shell uname -s), Darwin)
    1.69 +run: $(bundle)
    1.70 +	./$(bundle)/Contents/MacOS/$(bin)
    1.71 +else
    1.72 +run: $(bin)
    1.73 +	./$(bin)
    1.74 +endif