goat3d

diff goatview/Makefile @ 73:9862541fdcf5

- build qt goatview on linux - fixed line endings in a bunch of files
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 06 May 2014 03:57:11 +0300
parents 9d911100935b
children 53ea5b25426e
line diff
     1.1 --- a/goatview/Makefile	Tue May 06 03:31:35 2014 +0300
     1.2 +++ b/goatview/Makefile	Tue May 06 03:57:11 2014 +0300
     1.3 @@ -1,32 +1,41 @@
     1.4  PREFIX = /usr/local
     1.5  
     1.6 -src = $(wildcard src/*.c)
     1.7 -obj = $(src:.c=.o)
     1.8 +src = $(wildcard src/*.cc)
     1.9 +mochdr = src/goatview.h
    1.10 +mocsrc = $(patsubst src/%.h,src/moc_%.cc,$(mochdr))
    1.11 +obj = $(sort $(src:.cc=.o) $(mocsrc:.cc=.o))
    1.12  dep = $(obj:.o=.d)
    1.13  bin = goatview
    1.14  
    1.15  goat_root = ..
    1.16  
    1.17 -CC = clang
    1.18 -CPP = clang -E
    1.19 -CFLAGS = -pedantic -Wall -g -I$(goat_root)/src
    1.20 -LDFLAGS = $(libgoat) $(libgl)
    1.21 +CXXFLAGS = -std=c++11 -pedantic -Wall -g $(pic) -I$(goat_root)/src $(qtinc)
    1.22 +LDFLAGS = $(libgoat) $(libgl) $(qtlib)
    1.23 +MOC = moc
    1.24 +
    1.25 +qtinc = `pkg-config --cflags Qt5Gui Qt5Core Qt5OpenGL`
    1.26 +qtlib = `pkg-config --libs Qt5Gui Qt5Core Qt5OpenGL`
    1.27  
    1.28  ifeq ($(shell uname -s), Darwin)
    1.29  	libgl = -framework OpenGL -framework GLUT -lGLEW
    1.30  	libgoat = $(goat_root)/libgoat3d.dylib
    1.31  else
    1.32 +	pic = -fPIC
    1.33  	libgl = -lGL -lGLU -lglut -lGLEW
    1.34  	libgoat = $(goat_root)/libgoat3d.so.0.1
    1.35  endif
    1.36  
    1.37  $(bin): $(obj) $(libgoat)
    1.38 -	$(CC) -o $@ $(obj) $(LDFLAGS)
    1.39 +	$(CXX) -o $@ $(obj) $(LDFLAGS)
    1.40 +
    1.41 +# rule for running moc on ui header files
    1.42 +moc_%.cc: %.h
    1.43 +	$(MOC) -o $@ $<
    1.44  
    1.45  -include $(dep)
    1.46  
    1.47 -%.d: %.c
    1.48 -	@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.49 +%.d: %.cc
    1.50 +	@$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
    1.51  
    1.52  .PHONY: clean
    1.53  clean: