Updated Makefile and splited objects and assets objects
This commit is contained in:
parent
c66ddc94a5
commit
6bd85dfb8f
21
Makefile
21
Makefile
|
@ -20,7 +20,8 @@ CXXFLAGS = -std=c++17 -g -I.
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
# Deduce objects
|
# Deduce objects
|
||||||
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o) $(ASSETS:%=$(BUILD_DIR)/%.o)
|
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o)
|
||||||
|
ASSETS_OBJECTS = $(ASSETS:%=$(BUILD_DIR)/%.o)
|
||||||
|
|
||||||
# Verbose mode
|
# Verbose mode
|
||||||
ifeq ($(VERBOSE), 1)
|
ifeq ($(VERBOSE), 1)
|
||||||
|
@ -39,16 +40,16 @@ TOTAL_FILES := $(shell echo $$(($(words $(SOURCES))+1)))
|
||||||
CURRENT_FILE := 0
|
CURRENT_FILE := 0
|
||||||
|
|
||||||
# Default targets
|
# Default targets
|
||||||
all: $(BUILD_DIR) $(OUTPUT) end
|
all: build_dir $(OUTPUT) end
|
||||||
|
|
||||||
# Create build directory
|
# Create build directory
|
||||||
$(BUILD_DIR):
|
build_dir:
|
||||||
$(Q)mkdir -p $(dir $(OBJECTS))
|
$(Q)mkdir -p $(dir $(OBJECTS)) $(dir $(ASSETS_OBJECTS))
|
||||||
|
|
||||||
# Link target
|
# Link target
|
||||||
$(OUTPUT): $(OBJECTS)
|
$(OUTPUT): $(OBJECTS) $(ASSETS_OBJECTS)
|
||||||
@echo "[100%] $(YELLOW)Linking $(OUTPUT)$(RESET)"
|
@echo "[100%] $(YELLOW)Linking $(OUTPUT)$(RESET)"
|
||||||
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJECTS)
|
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJECTS) $(ASSETS_OBJECTS)
|
||||||
|
|
||||||
# Build .o files from .cpp
|
# Build .o files from .cpp
|
||||||
$(BUILD_DIR)/%.o: %.cpp
|
$(BUILD_DIR)/%.o: %.cpp
|
||||||
|
@ -58,9 +59,13 @@ $(BUILD_DIR)/%.o: %.cpp
|
||||||
$(Q)mkdir -p $(dir $@)
|
$(Q)mkdir -p $(dir $@)
|
||||||
$(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
|
$(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
|
||||||
|
|
||||||
|
# Arch and BFD header version
|
||||||
|
ARCH := $(shell arch)
|
||||||
|
BFD_VER := $(shell objcopy --info 2>/dev/null | grep -m1 '^elf')
|
||||||
|
|
||||||
# Convert .png.o from .png
|
# Convert .png.o from .png
|
||||||
$(BUILD_DIR)/%.png.o: %.png
|
$(BUILD_DIR)/%.o: %
|
||||||
fxconv --toolchain= --cg $< -o $@
|
fxconv --cg --toolchain= --arch=$(ARCH) --outputtarget=$(BFD_VER) $< -o $@
|
||||||
|
|
||||||
# Source files dependencies
|
# Source files dependencies
|
||||||
-include $(OBJECTS:.o=.d)
|
-include $(OBJECTS:.o=.d)
|
||||||
|
|
Loading…
Reference in New Issue