I'm trying to compile a OpenGL program on my MacBook and can't figure out how to convert this makefile.
CFLAGS= -I/usr/X11R6/include -I/usr/local/include
LDFLAGS= -L/usr/X11R6/lib -L/usr/local/lib -lGL -lGLU -lm -lglut
BINARIES=q2
all: $(BINARIES)
clean:
-rm开发者_Go百科 *.o $(BINARIES)
q2 : q2.o
g++ $(LDFLAGS) $^ -o q2
q2.o: q2.cpp
g++ -c $(CFLAGS) q2.cpp
depend:
makedepend *.cpp
Change the source code
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
Don't include GL.h or GLU.h. glut.h should pull them for you regardless of the platform.
And change your Makefile
CFLAGS=
LDFLAGS= -framework GLUT -framework OpenGL -framework Cocoa
Note that I was also able to build something using your original Makefile but I think that's because I have Apple X11 installed.
精彩评论