-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
48 lines (36 loc) · 1 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
# CONFIGURATION
PROJECT := inverse-k
TESTBUILD := itester
CC := g++
CCFLAGS := -Ilib -Wall -O3
ifeq ($(shell sw_vers 2>/dev/null | grep Mac | awk '{ print $$2}'),Mac)
# CFLAGS = -g -DGL_GLEXT_PROTOTYPES -I./include/ -I/usr/X11/include -DOSX
LDFLAGS = -framework GLUT -framework OpenGL \
-L"/System/Library/Frameworks/OpenGL.framework/Libraries" \
-lGL -lGLU -lm -lstdc++
else
# CFLAGS = -g -DGL_GLEXT_PROTOTYPES -Iglut-3.7.6-bin
LDFLAGS = -lglu32 -lglut32 -lopengl32
endif
SRCFOLDER := src
OBJFOLDER := obj
# processing stuff
SRC := $(wildcard $(SRCFOLDER)/*.cpp)
OBJ := $(addprefix $(OBJFOLDER)/, $(notdir $(SRC:.cpp=.o)))
ifeq ($(OS), Windows_NT)
RM = del /F
DELETEOBJS = $(OBJFOLDER)\*.o $(PROJECT).exe
else
RM = rm -f
DELETEOBJS = $(OBJFOLDER)/*.o $(PROJECT)
endif
.PHONY: all clean build
all: $(PROJECT)
clean:
$(RM) $(DELETEOBJS)
build: clean all
# compile targets
$(PROJECT): $(OBJ)
$(CC) $(CCFLAGS) -o $@ $^ $(LDFLAGS)
$(OBJFOLDER)/%.o: $(SRCFOLDER)/%.cpp
$(CC) $(CCFLAGS) -o $@ -c $<