fix: compile commands are ignored and makefile seperates cflags and libs

This commit is contained in:
2026-07-05 20:19:29 +02:00
parent 3995dce1ef
commit a9702a92b7
2 changed files with 13 additions and 4 deletions
+1
View File
@@ -1 +1,2 @@
bin/ bin/
compile_commands.json
+12 -4
View File
@@ -21,7 +21,10 @@ C_FLAGS = \
$(C_FLAG_NO_UNKNOWN_PRAGMAS) $(C_FLAG_NO_UNKNOWN_PRAGMAS)
# INCLUDE FLGAS # INCLUDE FLGAS
INCLUDE_FLAGS = -Iinclude INCLUDE_FLAGS = \
-Iinclude \
$(EXTERNAL_FLAGS) \
$(RAYLIB_CFLAGS)
# EXTERNAL FLAGS # EXTERNAL FLAGS
EXTERNAL_RAYGUI = -Iexternal/raygui EXTERNAL_RAYGUI = -Iexternal/raygui
@@ -34,11 +37,13 @@ EXTERNAL_FLAGS = \
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
SRC = $(wildcard src\*.c) SRC = $(wildcard src\*.c)
TARGET = bin\win\game.exe TARGET = bin\win\game.exe
RAYLIB_FLAGS = -I%RAYLIB% -L%RAYLIB% -lraylib -lopengl32 -lgdi32 -lwinmm RAYLIB_CFLAGS = -I%RAYLIB%
RAYLIB_LIBS = -L%RAYLIB% -lraylib -lopengl32 -lgdi32 -lwinmm
else else
SRC = $(wildcard src/*.c) SRC = $(wildcard src/*.c)
TARGET = bin/unix/game TARGET = bin/unix/game
RAYLIB_FLAGS = $(shell pkg-config --libs --cflags raylib) -lm RAYLIB_CFLAGS = $(shell pkg-config --cflags raylib)
RAYLIB_LIBS = $(shell pkg-config --libs raylib) -lm
endif endif
# CREATE BIN DIR # CREATE BIN DIR
@@ -46,7 +51,10 @@ $(shell mkdir -p bin/unix bin/win)
# COMMANDS # COMMANDS
build: $(SRC) build: $(SRC)
$(COMPILER) $(SRC) -o $(TARGET) $(C_FLAGS) $(INCLUDE_FLAGS) $(EXTERNAL_FLAGS) $(RAYLIB_FLAGS) $(COMPILER) $(SRC) -o $(TARGET) \
$(C_FLAGS) \
$(INCLUDE_FLAGS) \
$(RAYLIB_LIBS)
clean: clean:
rm -f $(TARGET) rm -f $(TARGET)