Fixed typo and added optional files for configuration in the GCC Project template

This commit is contained in:
Ulysse Cura 2025-12-21 22:11:46 +01:00
parent 0d1e25433b
commit 0e02c38686
3 changed files with 20 additions and 9 deletions

View File

@ -0,0 +1,10 @@
{
"configurations": [
{
"name": "Default",
"includePath": [
]
}
],
"version": 1
}

View File

@ -6,9 +6,9 @@
"detail": "Build project",
"type": "shell",
"command": "make",
//"args": [
// "-j$(nproc)"
//],
"args": [
"-j$(nproc)"
],
"group": "build",
"presentation": {
"echo": true,

View File

@ -9,11 +9,13 @@ SOURCES := \
OUTPUT := GCC_Project
# Compiler and flags
CXX = ccache gcc
CXXFLAGS = -Wall -Wextra -std=c17 -g
INCLUDE_DIRS =
CC = gcc
CCFLAGS = -Wall -Wextra -std=c17
LDFLAGS =
# Include directories
INCLUDE_DIRS =
# Change output location
OUTPUT := $(BUILD_DIR)/$(OUTPUT)
@ -45,14 +47,14 @@ build_dir:
# Link target
$(OUTPUT): $(OBJECTS)
@echo "[100%] $(YELLOW)Linking $(OUTPUT)$(RESET)"
$(Q)$(CXX) $(LDFLAGS) -o $@ $(OBJECTS)
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJECTS)
# Build .o files from .c
$(BUILD_DIR)/%.o: %.c
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE)+1))))
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE)*100/$(TOTAL_FILES)))))
@echo "[$(PERCENTAGE)%] $(GREEN)Building C object $@$(RESET)"
$(Q)$(CXX) $(CXXFLAGS) $(INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@
$(Q)$(CC) $(CCFLAGS) $(INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@
# Source files dependencies
-include $(OBJECTS:.o=.d)
@ -68,7 +70,6 @@ end: $(OUTPUT)
.PHONY: clean
clean:
$(Q)rm -rf $(BUILD_DIR)
$(Q)rm -rf $(dir $(FXCONV_CONVERTERS))/__pycache__
# Run executable
.PHONY: run