58 lines
1.9 KiB
Makefile
58 lines
1.9 KiB
Makefile
|
|
# SRCS specifies which files to compile as part of the project
|
||
|
|
SRC_PATH = src
|
||
|
|
OBJ_PATH = obj
|
||
|
|
BIN_PATH = bin
|
||
|
|
|
||
|
|
APP_NAME = main
|
||
|
|
|
||
|
|
OBJS = $(OBJ_PATH)/*.o
|
||
|
|
APP_PATH = $(BIN_PATH)/$(APP_NAME)
|
||
|
|
|
||
|
|
CPP_SRC= $(wildcard $(SRC_PATH)/*.cpp)
|
||
|
|
C_SRC= $(wildcard $(SRC_PATH)/*.c)
|
||
|
|
OBJ= $(patsubst $(SRC_PATH)/%.cpp,$(OBJ_PATH)/%.o,$(CPP_SRC)) \
|
||
|
|
$(patsubst $(SRC_PATH)/%.c,$(OBJ_PATH)/%.o,$(C_SRC))
|
||
|
|
#//OBJ= $(OBJS:.o)
|
||
|
|
|
||
|
|
# CC specifies which compiler we're using
|
||
|
|
CC = g++
|
||
|
|
RM = rm
|
||
|
|
|
||
|
|
# INCLUDE_PATHS specifies the additional include paths we'll need
|
||
|
|
INCLUDE_PATHS = -I/usr/local/include -I/opt/X11/include -I/opt/homebrew/opt/glew/include -I/opt/homebrew/opt/glfw/include -I./include -I/opt/homebrew/opt/glm/include
|
||
|
|
|
||
|
|
# LIBRARY_PATHS specifies the additional library paths we'll need
|
||
|
|
LIBRARY_PATHS = -L/usr/local/lib -L/opt/X11/lib -L/opt/homebrew/opt/glfw/lib -L/opt/homebrew/opt/glew/lib -L/opt/homebrew/opt/glm/lib
|
||
|
|
|
||
|
|
# COMPILER_FLAGS specifies the additional compilation options we're using
|
||
|
|
# -w suppresses all warnings
|
||
|
|
COMPILER_FLAGS = -w
|
||
|
|
|
||
|
|
ifeq ($(DEBUG),yes)
|
||
|
|
COMPILER_FLAGS += -g
|
||
|
|
endif
|
||
|
|
|
||
|
|
# LINKER_FLAGS specifies the libraries we're linking against
|
||
|
|
# Cocoa, IOKit, and CoreVideo are needed for static GLFW3.
|
||
|
|
# The glfw3 is deprecated. Now when you run 'brew install glfw3' you actually installed the glfw with version 3.x
|
||
|
|
LINKER_FLAGS = -lglfw -lGLEW -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
|
||
|
|
|
||
|
|
|
||
|
|
# APP_NAME specifies the name of our exectuable
|
||
|
|
|
||
|
|
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.cpp
|
||
|
|
$(CC) -o $@ -c $< $(COMPILER_FLAGS) $(INCLUDE_PATHS)
|
||
|
|
|
||
|
|
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.c
|
||
|
|
$(CC) -o $@ -c $< $(COMPILER_FLAGS) $(INCLUDE_PATHS)
|
||
|
|
|
||
|
|
#This is the target that compiles our executable
|
||
|
|
$(APP_NAME) : $(OBJ)
|
||
|
|
$(CC) $(OBJ) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(APP_PATH)
|
||
|
|
|
||
|
|
# clean all sources
|
||
|
|
clean:
|
||
|
|
$(RM) -rf $(OBJS)
|
||
|
|
$(RM) -rf $(SRC_PATH)/*o
|
||
|
|
$(RM) -rf $(APP_PATH)
|