From 0e3c14664fa2b196d8fc2bdb73137fc3b47aff1a Mon Sep 17 00:00:00 2001 From: Quinn Date: Mon, 17 Feb 2025 18:52:49 +0100 Subject: [PATCH] add profile seperation --- .vscode/launch.json | 8 ++++---- makefile | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 29bf5e5..c371bbf 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,13 +13,13 @@ "program": "", "linux": { "preLaunchTask": "(dbg) compile linux-x86_64", - "program": "bin/linux-x86_64/${workspaceFolderBasename}", - "cwd": "bin/linux-x86_64/" + "program": "${workspaceFolder}/bin/linux-x86_64/dbg/${workspaceFolderBasename}", + "cwd": "${workspaceFolder}/bin/linux-x86_64/dbg/" }, "windows": { "preLaunchTask": "(dbg) compile win-x86_64", - "program": "bin/win-x86_64/${workspaceFolderBasename}.exe", - "cwd": "bin/win-x86_64/" + "program": "${workspaceFolder}/bin/linux-x86_64/dbg/${workspaceFolderBasename}.exe", + "cwd": "${workspaceFolder}/bin/win-x86_64/dbg/" }, } ] diff --git a/makefile b/makefile index 3ef6455..e732017 100644 --- a/makefile +++ b/makefile @@ -9,22 +9,24 @@ LDFLAGS := $(shell pkg-config --libs sdl2) -lm ifeq ($(DEBUG),1) CFLAGS += -DDEBUG -fsanitize=address,undefined,integer -g -Og +PROF := dbg else REL_FLAGS += -O3 +PROF := rel endif # dirs DIR_BIN := bin DIR_OBJ := obj -DIR_BUILD := $(DIR_BIN)/$(ARCH) -DIR := $(DIR_BIN)/$(ARCH) $(DIR_OBJ)/$(ARCH) +DIR_BUILD := $(DIR_BIN)/$(ARCH)/$(PROF) +DIR := $(DIR_BIN)/$(ARCH)/$(PROF) $(DIR_OBJ)/$(ARCH)/$(PROF) # source files SRC := $(wildcard src/*.c) $(wildcard src/**/*.c) $(wildcard src/**/**/*.c) $(wildcard src/**/**/**/*.c) $(wildcard src/**/**/**/**/*.c) SRC_ASSETS := $(wildcard assets/*) # output locations -OBJ := $(patsubst src/%,$(DIR_OBJ)/$(ARCH)/%,$(SRC:.c=.o)) +OBJ := $(patsubst src/%,$(DIR_OBJ)/$(ARCH)/$(PROF)/%,$(SRC:.c=.o)) DEP := $(OBJ:.o=.d) ASSETS := $(patsubst assets/%,$(DIR_BUILD)/%,$(SRC_ASSETS)) TARGET := $(DIR_BUILD)/$(NAME)$(EXT) @@ -52,7 +54,7 @@ $(TARGET): $(OBJ) @$(CC) -o $(TARGET) $^ $(CFLAGS) $(LDFLAGS) # create .o and .d files -$(DIR_OBJ)/$(ARCH)/%.o: src/%.c +$(DIR_OBJ)/$(ARCH)/$(PROF)/%.o: src/%.c @mkdir -p $(dir $@) @$(CC) -o $@ -MD -MP -c $< $(CFLAGS) -std=$(STD) -x $(LANG) -Wno-unused-command-line-argument