2018-09-05 01:50:14 +00:00
|
|
|
# Verbosity of make output
|
|
|
|
ifeq ("$(VERBOSE)","1")
|
|
|
|
V :=
|
|
|
|
else
|
|
|
|
V := @
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Optimizations
|
2018-09-11 01:50:39 +00:00
|
|
|
ifeq ("$(OPTIMIZE)","0")
|
|
|
|
O := -O0
|
|
|
|
else ifeq ("$(OPTIMIZE)","1")
|
2018-09-05 01:50:14 +00:00
|
|
|
O := -O1
|
|
|
|
else ifeq ("$(OPTIMIZE)", "2")
|
|
|
|
O := -O2
|
|
|
|
else ifeq ("$(OPTIMIZE)", "3")
|
|
|
|
O := -O3
|
|
|
|
else
|
2018-09-11 01:50:39 +00:00
|
|
|
O := -O3
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Debugging
|
|
|
|
ifeq ("$(DEBUG)","1")
|
|
|
|
D := -g
|
|
|
|
else
|
|
|
|
D :=
|
2018-09-05 01:50:14 +00:00
|
|
|
endif
|
|
|
|
|
2018-09-11 01:50:39 +00:00
|
|
|
|
2018-09-05 01:50:14 +00:00
|
|
|
SRC_DIR=src
|
|
|
|
INCLUDE_DIR=include
|
|
|
|
BUILD_DIR=build
|
|
|
|
|
|
|
|
CC=clang++
|
|
|
|
WARNINGS_ON=-Weverything
|
|
|
|
WARNINGS_OFF=-Wno-missing-braces -Wno-gnu-anonymous-struct -Wno-old-style-cast\
|
|
|
|
-Wno-zero-as-null-pointer-constant -Wno-nested-anon-types\
|
2018-09-07 01:32:15 +00:00
|
|
|
-Wno-padded -Wno-exit-time-destructors -Wno-global-constructors\
|
|
|
|
-Wno-c++98-compat
|
2018-09-05 01:50:14 +00:00
|
|
|
|
|
|
|
CFLAGS=$(D) $(O) -std=c++11 $(WARNINGS_ON) $(WARNINGS_OFF) -I$(INCLUDE_DIR)
|
|
|
|
LIBS=-lSDL2
|
|
|
|
|
2018-09-15 01:46:30 +00:00
|
|
|
_HEADERS = camera.h color.h engine.h geometry.h light.h loader.h platform.h point.h\
|
2018-09-06 02:26:54 +00:00
|
|
|
transform.h util.h vec.h
|
2018-09-05 01:50:14 +00:00
|
|
|
HEADERS = $(patsubst %,$(INCLUDE_DIR)/%,$(_HEADERS))
|
|
|
|
|
2018-09-06 01:53:11 +00:00
|
|
|
_OBJS = engine.o geometry.o loader.o main.o platform.o transform.o
|
2018-09-05 01:50:14 +00:00
|
|
|
OBJS = $(patsubst %,$(BUILD_DIR)/%,$(_OBJS))
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(HEADERS)
|
|
|
|
@ if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi
|
|
|
|
$(V) $(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
|
|
|
|
$(BUILD_DIR)/engine: $(OBJS)
|
|
|
|
$(V) $(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(BUILD_DIR)
|