Created
March 11, 2010 21:18
-
-
Save gzmask/329661 to your computer and use it in GitHub Desktop.
OpenGL cross platform makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ make | |
gcc -o hello hello.c -lGL -lGLU -lglut | |
ld: library not found for -lGL | |
collect2: ld returned 1 exit status | |
make: *** [hello] Error 1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linux (default) | |
EXE = hello | |
LDFLAGS = -lGL -lGLU -lglut | |
# Windows (cygwin) | |
ifeq ($(OS), "Windows_NT") | |
EXE = hello.exe | |
LDFLAGS = -lopengl32 -lglu32 -lglut32 | |
endif | |
# OS X | |
ifeq ($(OSTYPE), "darwin9.0") | |
LDFLAGS = -framework Carbon -framework OpenGL -framework GLUT | |
endif | |
$(EXE) : hello.c | |
gcc -o $@ $< $(CFLAGS) $(LDFLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linux (default) | |
EXE = hello | |
LDFLAGS = -lGL -lGLU -lglut | |
# Windows (cygwin) | |
ifeq ($(OS), "Windows_NT") | |
EXE = hello.exe | |
LDFLAGS = -lopengl32 -lglu32 -lglut32 | |
endif | |
# OS X | |
ifeq "$(shell uname)" "Darwin" | |
LDFLAGS = -framework Carbon -framework OpenGL -framework GLUT | |
endif | |
$(EXE) : hello.c | |
gcc -o $@ $< $(CFLAGS) $(LDFLAGS) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment