Compare commits

..

No commits in common. "bcb33a0683501ac815c39ee9b3b43159b975c04b" and "87d31f9815ed94b969abbb523a343b7491dcefa5" have entirely different histories.

1 changed files with 14 additions and 54 deletions

View File

@ -1,65 +1,25 @@
# Build folder # Compiler flags
BUILD_DIR = build CFLAGS = -std=c++17 -O3
# Source files # Defaul target
SOURCES = \ all: build_dir json2bin_converter
src/main.cpp \
src/bin.cpp
# Output file name
OUTPUT = 2D_Engine_Casio_Tool
# Compiler and flags
CXX = g++
CXXFLAGS = -std=c++17 -g
LDFLAGS =
# Deduce objects
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o)
# Verbose mode
ifeq ($(VERBOSE), 1)
Q :=
else
Q := @
endif
# Colors
GREEN := \033[0;32m
YELLOW := \033[1;33m
RESET := \033[0m
# Total number of files to process
TOTAL_FILES := $(shell echo $$(($(words $(SOURCES))+1)))
CURRENT_FILE = 0
# Default targets
all: $(BUILD_DIR) $(OUTPUT) end
# Create build directory # Create build directory
$(BUILD_DIR): build_dir:
$(Q)mkdir -p $(dir $(OBJECTS)) mkdir -p build
# Link target # Link target
$(OUTPUT): $(OBJECTS) json2bin_converter: build/main.o build/bin.o
@echo "[100%] $(YELLOW)Linking $(OUTPUT)$(RESET)" g++ -o json2bin_converter build/main.o build/bin.o
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJECTS)
# Build .o files from .cpp # Compile objects
$(BUILD_DIR)/%.o: %.cpp build/main.o: src/main.cpp src/bin.hpp src/json/json.hpp
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE)+1)))) g++ $(CFLAGS) -c src/main.cpp -o build/main.o
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE)*100/$(TOTAL_FILES)))))
@echo "[$(PERCENTAGE)%] $(GREEN)Building $@$(RESET)"
$(Q)mkdir -p $(dir $@)
$(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
# Source files dependencies build/bin.o: src/bin.cpp src/bin.hpp src/json/json.hpp
-include $(OBJECTS:.o=.d) g++ $(CFLAGS) -c src/bin.cpp -o build/bin.o
end:
@echo "Built target $(OUTPUT)"
# Clean # Clean
.PHONY: clean .PHONY: clean
clean: clean:
$(Q)rm -rf $(BUILD_DIR) rm -rf build/* json2bin_converter