# HG changeset patch # User John Tsiombikas # Date 1345915256 -10800 # Node ID f5fb04fe12cdc8a7a25e39d63da19bca2a8195d5 # Parent cbf86e5198a9ea362c7cb281feba55eb20d2a750 moved compiler detection to the configure script diff -r cbf86e5198a9 -r f5fb04fe12cd prototype/Makefile --- a/prototype/Makefile Sat Aug 25 14:37:51 2012 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -csrc = $(wildcard src/*.c) $(wildcard vmath/*.c) $(wildcard drawtext/*.c) -ccsrc = $(wildcard src/*.cc) $(wildcard vmath/*.cc) -obj = $(csrc:.c=.o) $(ccsrc:.cc=.o) -dep = $(obj:.o=.d) -bin = proto - -#opt = -O3 -dbg = -g -warn = -Wall -Wno-format-extra-args -Wno-char-subscripts - -inc = -Ivmath -Idrawtext `pkg-config --cflags freetype2` - -CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(inc) -CXXFLAGS = $(CFLAGS) -std=c++11 $(add_cxxflags) -LDFLAGS = $(add_ldflags) $(libgl) -lm -lassimp -limago `pkg-config --libs freetype2` - -ifeq ($(shell uname -s), Darwin) - add_cxxflags = -stdlib=libc++ - add_ldflags = -stdlib=libc++ - libgl = -framework OpenGL -framework GLUT -lglew -else - libgl = -lGL -lGLU -lglut -lGLEW -endif - -$(bin): $(obj) Makefile - $(CXX) -o $@ $(obj) $(LDFLAGS) - --include $(dep) - -%.d: %.c - @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ - -%.d: %.cc - @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ - -.PHONY: clean -clean: - rm -f $(obj) $(bin) $(dep) - -include build/macapp.mk diff -r cbf86e5198a9 -r f5fb04fe12cd prototype/Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/prototype/Makefile.in Sat Aug 25 20:20:56 2012 +0300 @@ -0,0 +1,36 @@ +csrc = $(wildcard src/*.c) $(wildcard vmath/*.c) $(wildcard drawtext/*.c) +ccsrc = $(wildcard src/*.cc) $(wildcard vmath/*.cc) +obj = $(csrc:.c=.o) $(ccsrc:.cc=.o) +dep = $(obj:.o=.d) +bin = proto + +warn = -Wall -Wno-format-extra-args -Wno-char-subscripts + +inc = -I. -Ivmath -Idrawtext `pkg-config --cflags freetype2` + +CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(inc) +CXXFLAGS = $(CFLAGS) $(cxx11_cflags) +LDFLAGS = $(cxx11_ldflags) $(libgl) -lm -lassimp -limago `pkg-config --libs freetype2` + +ifeq ($(shell uname -s), Darwin) + libgl = -framework OpenGL -framework GLUT -lglew +else + libgl = -lGL -lGLU -lglut -lGLEW +endif + +$(bin): $(obj) Makefile + $(CXX) -o $@ $(obj) $(LDFLAGS) + +-include $(dep) + +%.d: %.c + @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ + +%.d: %.cc + @$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ + +.PHONY: clean +clean: + rm -f $(obj) $(bin) $(dep) + +include build/macapp.mk diff -r cbf86e5198a9 -r f5fb04fe12cd prototype/configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/prototype/configure Sat Aug 25 20:20:56 2012 +0300 @@ -0,0 +1,57 @@ +#!/bin/sh + +opt=false +dbg=true + +while [ $# -gt 0 ]; do + case $1 in + --prefix=*) + PREFIX=`echo $1 | sed 's/--prefix=//'` + ;; + --enable-*) + `echo $1 | sed 's/--enable-//'`=true + ;; + --disable-*) + `echo $1 | sed 's/--disable-//'`=false + ;; + esac + shift +done + +echo '# Generated makefile, do not edit' >Makefile +echo "PREFIX = $PREFIX" >>Makefile +if $opt; then + echo 'opt = -O3 -ffast-math' >>Makefile +fi +if $dbg; then + echo 'dbg = -g' >>Makefile +fi + +# determine the C++11 flags we need to pass to the C++ compiler +if [ -z "$CXX" ]; then + CXX=c++ +fi + +verstr=`$CXX --version` +if echo "$verstr" | grep LLVM; then + if echo | $CXX -c -x c++ -std=c++11 - >/dev/null 2>&1; then + cxxflags11='-std=c++11 -stdlib=libc++' + ldflags11='-stdlib=libc++' + fi +else + if echo | $CXX -c -x c++ -std=c++11 - >/dev/null 2>&1; then + cxxflags11='-std=c++11' + elif echo | $CXX -c -x c++ -std=c++0x - >/dev/null 2>&1; then + cxxflags11='-std=c++0x' + fi +fi +if [ -z "$cxxflags11" ]; then + echo 'Failed to find C++11 capable compiler.' +fi + +echo "cxx11_cflags = $cxxflags11" >>Makefile +if [ -n "$ldflags11" ]; then + echo "cxx11_ldflags = $ldflags11" >>Makefile +fi + +cat Makefile.in >>Makefile