goat3d

view goatview/Makefile @ 91:f92da4fa9a6d

fixed for macosx
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 17 May 2014 15:42:10 +0300
parents 91e3aa1a60c3
children ae6c5941faac
line source
1 PREFIX = /usr/local
3 src = $(wildcard src/*.cc)
4 csrc = $(wildcard src/*.c)
5 mochdr = src/goatview.h src/scenemodel.h
6 mocsrc = $(patsubst src/%.h,src/moc_%.cc,$(mochdr))
7 obj = $(sort $(csrc:.c=.o) $(src:.cc=.o) $(mocsrc:.cc=.o))
8 dep = $(obj:.o=.d)
9 bin = goatview
11 goat_root = ..
13 warn = -Wall
15 CFLAGS = $(warn) -g $(pic) -I$(goat_root)/src $(qtinc)
16 CXXFLAGS = -std=c++11 $(CFLAGS)
17 LDFLAGS = $(libgoat) $(libgl) $(qtlib) -lvmath
18 MOC = moc
20 qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL`
21 qtlib = `pkg-config --libs Qt5Gui Qt5Core Qt5OpenGL`
23 ifeq ($(shell uname -s), Darwin)
24 libgl = -framework OpenGL -framework GLUT -lGLEW
25 libgoat = $(goat_root)/libgoat3d.dylib
26 warn += -Wno-deprecated-declarations
27 else
28 pic = -fPIC
29 libgl = -lGL -lGLU -lglut -lGLEW
30 libgoat = $(goat_root)/libgoat3d.so.0.1
31 endif
33 ifeq ($(CC), gcc)
34 warn += -Wno-cpp
35 endif
36 ifneq ($(shell $(CC) --version | grep LLVM),)
37 CXXFLAGS += -stdlib=libc++
38 endif
40 $(bin): $(obj) $(libgoat)
41 $(CXX) -o $@ $(obj) $(LDFLAGS)
43 # rule for running moc on ui header files
44 moc_%.cc: %.h
45 $(MOC) -o $@ $<
47 -include $(dep)
49 %.d: %.c
50 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
52 %.d: %.cc
53 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
55 .PHONY: clean
56 clean:
57 rm -f $(obj) $(bin)
59 .PHONY: cleandep
60 cleandep:
61 rm -f $(dep)
63 .PHONY: install
64 install: $(bin)
65 cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin)
67 .PHONY: uninstall
68 uninstall:
69 rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)