goat3d

view goatview/Makefile @ 80:c5e997e8fd62

lalala
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 08 May 2014 23:00:30 +0300
parents 53ea5b25426e
children 70b7c41a4f17
line source
1 PREFIX = /usr/local
3 src = $(wildcard src/*.cc)
4 csrc = $(wildcard src/*.c)
5 mochdr = src/goatview.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 CFLAGS = -pedantic -Wall -g $(pic) -I$(goat_root)/src $(qtinc)
14 CXXFLAGS = -std=c++11 $(CFLAGS)
15 LDFLAGS = $(libgoat) $(libgl) $(qtlib) -lvmath
16 MOC = moc
18 qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL`
19 qtlib = `pkg-config --libs Qt5Gui Qt5Core Qt5OpenGL`
21 ifeq ($(shell uname -s), Darwin)
22 libgl = -framework OpenGL -framework GLUT -lGLEW
23 libgoat = $(goat_root)/libgoat3d.dylib
24 else
25 pic = -fPIC
26 libgl = -lGL -lGLU -lglut -lGLEW
27 libgoat = $(goat_root)/libgoat3d.so.0.1
28 endif
30 $(bin): $(obj) $(libgoat)
31 $(CXX) -o $@ $(obj) $(LDFLAGS)
33 # rule for running moc on ui header files
34 moc_%.cc: %.h
35 $(MOC) -o $@ $<
37 -include $(dep)
39 %.d: %.c
40 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
42 %.d: %.cc
43 @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
45 .PHONY: clean
46 clean:
47 rm -f $(obj) $(bin)
49 .PHONY: cleandep
50 cleandep:
51 rm -f $(dep)
53 .PHONY: install
54 install: $(bin)
55 cp $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin)
57 .PHONY: uninstall
58 uninstall:
59 rm -f $(DESTDIR)$(PREFIX)/bin/$(bin)