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": "",
|
"program": "",
|
||||||
"linux": {
|
"linux": {
|
||||||
"preLaunchTask": "(dbg) compile linux-x86_64",
|
"preLaunchTask": "(dbg) compile linux-x86_64",
|
||||||
"program": "bin/linux-x86_64/${workspaceFolderBasename}",
|
"program": "${workspaceFolder}/bin/linux-x86_64/dbg/${workspaceFolderBasename}",
|
||||||
"cwd": "bin/linux-x86_64/"
|
"cwd": "${workspaceFolder}/bin/linux-x86_64/dbg/"
|
||||||
},
|
},
|
||||||
"windows": {
|
"windows": {
|
||||||
"preLaunchTask": "(dbg) compile win-x86_64",
|
"preLaunchTask": "(dbg) compile win-x86_64",
|
||||||
"program": "bin/win-x86_64/${workspaceFolderBasename}.exe",
|
"program": "${workspaceFolder}/bin/linux-x86_64/dbg/${workspaceFolderBasename}.exe",
|
||||||
"cwd": "bin/win-x86_64/"
|
"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)
|
ifeq ($(DEBUG),1)
|
||||||
CFLAGS += -DDEBUG -fsanitize=address,undefined,integer -g -Og
|
CFLAGS += -DDEBUG -fsanitize=address,undefined,integer -g -Og
|
||||||
|
PROF := dbg
|
||||||
else
|
else
|
||||||
REL_FLAGS += -O3
|
REL_FLAGS += -O3
|
||||||
|
PROF := rel
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# dirs
|
# dirs
|
||||||
DIR_BIN := bin
|
DIR_BIN := bin
|
||||||
DIR_OBJ := obj
|
DIR_OBJ := obj
|
||||||
DIR_BUILD := $(DIR_BIN)/$(ARCH)
|
DIR_BUILD := $(DIR_BIN)/$(ARCH)/$(PROF)
|
||||||
DIR := $(DIR_BIN)/$(ARCH) $(DIR_OBJ)/$(ARCH)
|
DIR := $(DIR_BIN)/$(ARCH)/$(PROF) $(DIR_OBJ)/$(ARCH)/$(PROF)
|
||||||
|
|
||||||
# source files
|
# source files
|
||||||
SRC := $(wildcard src/*.c) $(wildcard src/**/*.c) $(wildcard src/**/**/*.c) $(wildcard src/**/**/**/*.c) $(wildcard src/**/**/**/**/*.c)
|
SRC := $(wildcard src/*.c) $(wildcard src/**/*.c) $(wildcard src/**/**/*.c) $(wildcard src/**/**/**/*.c) $(wildcard src/**/**/**/**/*.c)
|
||||||
SRC_ASSETS := $(wildcard assets/*)
|
SRC_ASSETS := $(wildcard assets/*)
|
||||||
|
|
||||||
# output locations
|
# 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)
|
DEP := $(OBJ:.o=.d)
|
||||||
ASSETS := $(patsubst assets/%,$(DIR_BUILD)/%,$(SRC_ASSETS))
|
ASSETS := $(patsubst assets/%,$(DIR_BUILD)/%,$(SRC_ASSETS))
|
||||||
TARGET := $(DIR_BUILD)/$(NAME)$(EXT)
|
TARGET := $(DIR_BUILD)/$(NAME)$(EXT)
|
||||||
@@ -52,7 +54,7 @@ $(TARGET): $(OBJ)
|
|||||||
@$(CC) -o $(TARGET) $^ $(CFLAGS) $(LDFLAGS)
|
@$(CC) -o $(TARGET) $^ $(CFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
# create .o and .d files
|
# create .o and .d files
|
||||||
$(DIR_OBJ)/$(ARCH)/%.o: src/%.c
|
$(DIR_OBJ)/$(ARCH)/$(PROF)/%.o: src/%.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
@$(CC) -o $@ -MD -MP -c $< $(CFLAGS) -std=$(STD) -x $(LANG) -Wno-unused-command-line-argument
|
@$(CC) -o $@ -MD -MP -c $< $(CFLAGS) -std=$(STD) -x $(LANG) -Wno-unused-command-line-argument
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user