-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·69 lines (57 loc) · 2.13 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
# THIS IS THE DEFAULT MAKEFILE FOR CS184
# Author: njoubert
#
#Code -------------------------------
### YOU CAN CHANGE THESE VARIABLES AS YOU ADD CODE:
TARGET := inertia
SOURCES := $(wildcard ./src/UCB/*.cpp) $(wildcard ./src/*.cpp)
#Libraries -------------------------------
#Check for OSX. Works on 10.5 (and 10.4 but untested)
#This line still kicks out an annoying error on Solaris.
ifeq ($(shell sw_vers 2>/dev/null | grep Mac | awk '{ print $$2}'),Mac)
#Assume Mac
INCLUDE := -I./include/ -I/usr/X11/include \
-I"lib/mac/OpenAL.framework/Headers" \
-I"include/AL" \
-I"include/FTGL"
LIBRARY := -L./lib/mac/ \
-L"/System/Library/Frameworks/OpenGL.framework/Libraries" \
-L"/usr/lib" -L"/usr/local/lib" \
-lGL -lGLU -lm -lstdc++ -lfreetype -lftgl
FRAMEWORK := -framework GLUT -framework OpenGL -framework OpenAL -framework Cocoa
MACROS := -DOSX
PLATFORM := Mac
FRAMEWORK_PATH := -F"lib/mac"
else
#Assume X11
INCLUDE := -I./include/ -I/usr/X11R6/include -I/sw/include \
-I/usr/sww/include -I/usr/sww/pkg/Mesa/include \
-I./lib/mac/OpenAL.framework/Headers/AL -I./freealut-1.1.0-bin/include/AL \
-I./freealut-1.1.0-bin/include -I./lib/mac/OpenAL.framework/Headers \
-I./ftgl-2.1.3~rc5/src -I./lib/mac/OpenAL.framework/Versions/A/Headers
LIBRARY := -L./lib/nix -L/usr/X11R6/lib -L/sw/lib -L/usr/sww/lib \
-L/usr/sww/bin -L/usr/sww/pkg/Mesa/lib -L/usr/lib -lglut -lGLU -lGL -lX11 -lGLEW -lopenal -lalut -lfreetype -lftgl
FRAMEWORK :=
MACROS :=
PLATFORM := *Nix
FRAMEWORK_PATH :=
endif
#Basic Stuff -----------------------------
CC := gcc
CXX := g++
CXXFLAGS := -g -Wall -O3 -fmessage-length=0 $(INCLUDE) $(MACROS)
LDFLAGS := $(FRAMEWORK) $(LIBRARY)
#-----------------------------------------
%.o : %.cpp
@echo "Compiling .cpp to .o for $(PLATFORM) Platform: $<"
@$(CXX) -c -Wall $(CXXFLAGS) $< -o $@
OBJECTS = $(SOURCES:.cpp=.o)
$(TARGET): $(OBJECTS)
@echo "Linking .o files into: $(TARGET)"
@$(CXX) $(LDFLAGS) $(OBJECTS) $(INCLUDE) $(LIBRARY) $(FRAMEWORK_PATH) -o $(TARGET) -lfreeimage -lGLEW
all: $(TARGET)
clean:
@echo "Removing compiled files: $<"
/bin/rm -f $(OBJECTS) $(TARGET)
.DEFAULT_GOAL := all