62 lines
1.3 KiB
Makefile
62 lines
1.3 KiB
Makefile
# Verbosity of make output
|
|
ifeq ("$(VERBOSE)","1")
|
|
V :=
|
|
else
|
|
V := @
|
|
endif
|
|
|
|
# Optimizations
|
|
ifeq ("$(OPTIMIZE)","0")
|
|
O := -O0
|
|
else ifeq ("$(OPTIMIZE)","1")
|
|
O := -O1
|
|
else ifeq ("$(OPTIMIZE)", "2")
|
|
O := -O2
|
|
else ifeq ("$(OPTIMIZE)", "3")
|
|
O := -O3
|
|
else
|
|
O := -O3
|
|
endif
|
|
|
|
# Debugging
|
|
ifeq ("$(DEBUG)","1")
|
|
D := -g
|
|
else
|
|
D :=
|
|
endif
|
|
|
|
|
|
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\
|
|
-Wno-padded -Wno-exit-time-destructors -Wno-global-constructors\
|
|
-Wno-c++98-compat
|
|
|
|
CFLAGS=$(D) $(O) -std=c++11 $(WARNINGS_ON) $(WARNINGS_OFF) -I$(INCLUDE_DIR)
|
|
LIBS=-lSDL2
|
|
|
|
_HEADERS = camera.h color.h engine.h geometry.h light.h loader.h matrix.h\
|
|
platform.h point.h render.h transform.h util.h vec.h
|
|
HEADERS = $(patsubst %,$(INCLUDE_DIR)/%,$(_HEADERS))
|
|
|
|
_OBJS = color.o engine.o light.o loader.o main.o platform.o render.o\
|
|
transform.o vec.o
|
|
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)
|