122 lines
3.1 KiB
Makefile
122 lines
3.1 KiB
Makefile
#STATIC/DYNAMIC
|
|
#LIB_MODE = STATIC
|
|
LIB_MODE = DYNAMIC
|
|
# BUILD/DYN_LIBRARY
|
|
#IMGUI_MODE = BUILD
|
|
IMGUI_MODE = DYN_LIBRARY
|
|
|
|
CC = gcc
|
|
CXX = g++
|
|
|
|
ASSET_PREFIX = assets/
|
|
|
|
|
|
SRC_DIR = src
|
|
OBJ_DIR = obj
|
|
BIN_DIR = bin
|
|
LIB_DIR = lib
|
|
|
|
STATIC_INCLUDE_DIR = include
|
|
|
|
CPPFLAGS = -Isrc/imgui -Isrc/material-colors -g -D ASSET_DIR=\"$(ASSET_PREFIX)\"
|
|
CFLAGS = -g -D ASSET_DIR=\"$(ASSET_PREFIX)\"
|
|
LDFLAGS = -g
|
|
#global LDLIBS
|
|
LDLIBS += -L lib/
|
|
#LDLIBS += -L lib_web/
|
|
|
|
LD_DYNAMIC_LIBS = -lraylib -lsdbus-c++ -lmagic -lcurl #only enable if dynamic mode
|
|
LD_STATIC_LIBS = -l:libraylib.a #only enable if static mode
|
|
|
|
EXTRA_DIRS = $(OBJ_DIR)/rlImGui
|
|
|
|
EXE = $(BIN_DIR)/main
|
|
|
|
|
|
#WEBMODE
|
|
#CC = emcc
|
|
#CXX = em++
|
|
#SET ALL TO STATIC, have web version of libraylib.a in libs
|
|
#ensure glfw is enable
|
|
#some tinkering may be requiresd to get this working, just make sure
|
|
#raylib has ES3 on (need to mod make file)
|
|
#LDFLAGS += -s TOTAL_MEMORY=268435456 -s USE_GLFW=3 -sMIN_WEBGL_VERSION=2 -s FULL_ES3 -s ASYNCIFY
|
|
#EXE = $(BIN_DIR)/main.html
|
|
|
|
|
|
|
|
|
|
C_SRC += $(wildcard $(SRC_DIR)/*.c) #GET LIST OF ALL C FILES
|
|
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/*.cpp) #GET LIST OF ALL CPP FILES
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/rlImGui/*.cpp) #GET LIST OF ALL CPP FILES
|
|
|
|
|
|
# BUILD MATERIAL_COLORS SYSETM
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/quantize/celebi.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/quantize/wsmeans.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/quantize/wu.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/quantize/lab.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/utils/utils.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/cam/cam.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/cam/hct.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/cam/hct_solver.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/cam/viewing_conditions.cpp)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/material-colors/cpp/score/score.cpp)
|
|
EXTRA_DIRS += $(OBJ_DIR)/material-colors/cpp/quantize
|
|
EXTRA_DIRS += $(OBJ_DIR)/material-colors/cpp/utils
|
|
EXTRA_DIRS += $(OBJ_DIR)/material-colors/cpp/score
|
|
EXTRA_DIRS += $(OBJ_DIR)/material-colors/cpp/cam
|
|
|
|
ifeq ($(IMGUI_MODE), BUILD)
|
|
CPP_SRC += $(wildcard $(SRC_DIR)/imgui/*.cpp) #GET LIST OF ALL CPP FILES
|
|
EXTRA_DIRS += $(OBJ_DIR)/imgui
|
|
endif
|
|
|
|
ifeq ($(IMGUI_MODE), DYN_LIBRARY)
|
|
LDLIBS += -limgui
|
|
endif
|
|
|
|
#IF DYNAMIC MODE
|
|
ifeq ($(LIB_MODE), DYNAMIC)
|
|
LDLIBS += $(LD_DYNAMIC_LIBS)
|
|
endif
|
|
|
|
#IF STATIC MODE
|
|
ifeq ($(LIB_MODE), STATIC)
|
|
LDLIBS += $(LD_STATIC_LIBS)
|
|
CPPFLAGS += -I$(STATIC_INCLUDE_DIR)
|
|
endif
|
|
|
|
|
|
|
|
C_OBJ := $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(C_SRC)) #MAKE LIST OF ALL C OBJECT FILES THAT NEED TO BE BUILT
|
|
CPP_OBJ := $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(CPP_SRC)) #MAKE LIST OF ALL CPP OBJECT FILES THAT NEED TO BE BUILT
|
|
|
|
OBJ := $(C_OBJ) $(CPP_OBJ)
|
|
|
|
|
|
all: $(EXE)
|
|
|
|
$(EXE): $(OBJ) | $(BIN_DIR)
|
|
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
|
|
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
|
|
|
$(BIN_DIR) $(OBJ_DIR): | $(EXTRA_DIRS)
|
|
mkdir -p $@
|
|
|
|
$(EXTRA_DIRS):
|
|
mkdir -p $@
|
|
|
|
clean:
|
|
@$(RM) -rv $(BIN_DIR) $(OBJ_DIR)
|
|
|
|
.PHONY: all clean
|
|
|