-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·57 lines (44 loc) · 1.54 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
#Code -------------------------------
### YOU CAN CHANGE THESE VARIABLES AS YOU ADD CODE:
TARGET := subdivision
SOURCES := $(wildcard ./*.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
LIBRARY := -L./lib/mac/ \
-L"/System/Library/Frameworks/OpenGL.framework/Libraries" \
-lGL -lGLU -lm -lstdc++ -lfreeimage
FRAMEWORK := -framework GLUT -framework OpenGL
MACROS := -DOSX
PLATFORM := Mac
else
#Assume X11
INCLUDE := -I./include/ -I/usr/X11R6/include -I/sw/include \
-I/usr/sww/include -I/usr/sww/pkg/Mesa/include
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 -lglut -lGLU -lGL -lX11 -lfreeimage
FRAMEWORK :=
MACROS :=
PLATFORM := *Nix
endif
#Basic Stuff -----------------------------
CC := gcc
CXX := g++
CXXFLAGS := -g -Wall -O3 -fmessage-length=0 -DGL_GLEXT_PROTOTYPES $(INCLUDE) $(MACROS)
LDFLAGS := $(FRAMEWORK) $(LIBRARY)
#-----------------------------------------
%.o : %.cpp %.h
@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) -o $(TARGET)
default: $(TARGET)
all: default
clean:
@echo "Removing compiled files: $<"
/bin/rm -f $(OBJECTS) $(TARGET)