mirror of
https://github.com/thepigeongenerator/sdl_template.git
synced 2025-12-17 05:55:47 +01:00
add profile seperation
This commit is contained in:
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@@ -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/"
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
10
makefile
10
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user