User Tools

Site Tools


Sidebar



make

Makefile

openFrameworks with makefile on OSX
PROG = emptyExample
SRCS = \
	main.cpp
 
LIBS = \
	-framework AppKit \
	-framework Cocoa \
	-framework IOKit \
	-framework AGL \
	-framework ApplicationServices \
	-framework AudioToolbox \
	-framework Carbon \
	-framework CoreAudio \
	-framework CoreFoundation \
	-framework OpenGL \
	-framework QuickTime \
	libs/assimp/lib/osx/assimp.a \
	libs/cairo/lib/osx/cairo-script-interpreter.a \
	libs/cairo/lib/osx/cairo.a \
	libs/cairo/lib/osx/pixman-1.a \
	libs/FreeImage/lib/osx/freeimage.a \
	libs/freetype/lib/osx/freetype.a \
	libs/glew/lib/osx/glew.a \
	libs/poco/lib/osx/PocoCrypto.a \
	libs/poco/lib/osx/PocoData.a \
	libs/poco/lib/osx/PocoDataODBC.a \
	libs/poco/lib/osx/PocoDataSQLite.a \
	libs/poco/lib/osx/PocoFoundation.a \
	libs/poco/lib/osx/PocoNet.a \
	libs/poco/lib/osx/PocoNetSSL.a \
	libs/poco/lib/osx/PocoUtil.a \
	libs/poco/lib/osx/PocoXML.a \
	libs/poco/lib/osx/PocoZip.a \
	libs/rtAudio/lib/osx/rtAudio.a \
	libs/tess2/lib/osx/tess2.a \
	libs/openFrameworksCompiled/lib/osx/openFrameworks.a \
	libs/glut/lib/osx/GLUT.framework/GLUT \
	libs/fmodex/lib/osx/libfmodex.dylib
 
DIRS = \
	-I libs/openFrameworks \
	-I libs/openFrameworks/3d \
	-I libs/openFrameworks/app \
	-I libs/openFrameworks/communication \
	-I libs/openFrameworks/events \
	-I libs/openFrameworks/gl \
	-I libs/openFrameworks/graphics \
	-I libs/openFrameworks/math \
	-I libs/openFrameworks/sound \
	-I libs/openFrameworks/types \
	-I libs/openFrameworks/utils \
	-I libs/openFrameworks/video \
	-I libs/poco/include \
	-I libs/freetype/include \
	-I libs/freetype/include/freetype2 \
	-I libs/fmodex/include \
	-I libs/glew/include \
	-I libs/FreeImage/include \
	-I libs/tess2/include \
	-I libs/cairo/include/cairo \
	-I libs/rtAudio/include \
	-I src \
 
CC = g++
CFLAGS = -Wall -O3 -g -arch i386 -gstabs
#-x c++ -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -Os -fasm-blocks -Wno-deprecated-declarations -Wno-invalid-offsetof -gdwarf-2 -msse3 -mssse3
BINDIR = bin
EXE = $(BINDIR)/$(PROG)
APP = $(BINDIR)/$(PROG).app
 
all: $(PROG) after
 
$(PROG): $(SRCS)
	$(CC) $(CFLAGS) -o $(BINDIR)/$(PROG) $(DIRS) $(SRCS) $(LIBS)
 
clean:
	rm -f $(PROG)
 
after:$(PROG)
	mkdir -p $(APP)/Contents/Frameworks
	mkdir -p $(APP)/Contents/MacOS
	cp -r libs/glut/lib/osx/* $(APP)/Contents/Frameworks/
	cp -r libs/fmodex/lib/osx/* $(APP)/Contents/MacOS/
	cp $(BINDIR)/$(PROG) $(APP)/Contents/MacOS/
	rm $(BINDIR)/$(PROG)
	install_name_tool -change ./libfmodex.dylib @executable_path/libfmodex.dylib $(APP)/Contents/MacOS/$(PROG)
SDKs
  • Als je problemen hebt met een Makefile op Mac kan het zijn dat de Makefile naar de verkeerde SDK zoekt. Bijvoorbeeld 10.5 terwijl je die misschien al niet meer op je systeem hebt staan. Op de Makefile en verander overal 10.5 in de versie op je computer.
  • Soms kan het ook geen kwaad om PPC acties uit te schakelen.
Makefile
CC = g++
SRCS = \
	src/main.cxx \
	src/Vec3.cxx \
	src/Light.cxx \
	src/Material.cxx \
	src/Tunnel.cxx \
	src/Subway.cpp \
	src/Cover.cpp \
	src/Functions.cpp \
	src/Serial.cpp \
	src/Sign.cxx \
	src/XmlLoader.cpp \
	libs/tinyxml/tinyxml.cpp \
	libs/tinyxml/tinyxmlerror.cpp \
	libs/tinyxml/tinyxmlparser.cpp
	
PROG = datamining
CFLAGS = -Wall -O3 -g

ifeq ($(shell uname),Darwin)
	LIBS = -framework OpenGL -framework GLUT
else
	LIBS = -lglut -lGLU -lpng -lcurl
endif

DIRS = -Isrc -Ilibs/tinyxml -I/usr/include/curl

all: $(PROG)

$(PROG):	$(SRCS)
	$(CC) $(CFLAGS) -o $(PROG) $(DIRS) $(SRCS) $(LIBS)

clean:
	rm -f $(PROG)

Door de -g in CFLAGS heeft de debugger meer info om te laten weten wat bijvoorbeeld de oorzaak is van een bepaalde Segmentation Fault. Met bt kun je de stacktrace opvragen.

make.txt · Last modified: 2014/11/23 16:33 (external edit)