Improve makefile
This commit is contained in:
parent
d46ee05126
commit
4f34d06f73
23
Makefile
23
Makefile
@ -5,16 +5,29 @@ OBJS= \
|
||||
build/src/Player.o \
|
||||
build/src/GameRenderer.o
|
||||
|
||||
LIBS=-lSDL2 -lSDL2_image
|
||||
MAKEFLAGS += -j $(shell nproc)
|
||||
|
||||
CXX_FLAGS = -std=c++23 -Wall -Wextra -Wpedantic -Wconversion -pedantic -pedantic-errors
|
||||
|
||||
RELEASE=0
|
||||
|
||||
ifeq ($(RELEASE), 1)
|
||||
CXX_FLAGS += -Werror
|
||||
else
|
||||
CXX_FLAGS += -fsanitize=address,undefined
|
||||
LINKER_FLAGS += -fsanitize=address,undefined
|
||||
endif
|
||||
|
||||
CXX_FLAGS += $(shell pkg-config sdl2 SDL2_image --cflags)
|
||||
LINKER_FLAGS += $(shell pkg-config sdl2 SDL2_image --libs)
|
||||
|
||||
build/%.o: %.cpp $(wildcard *.hpp)
|
||||
mkdir -p `dirname $@`
|
||||
g++ $(CFLAGS) -c -o $@ $< $(LIBS)
|
||||
@mkdir -p `dirname $@`
|
||||
g++ $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
all: $(OBJS)
|
||||
g++ $(CFLAGS) $(OBJS) $(LIBS)
|
||||
g++ $(OBJS) $(LINKER_FLAGS)
|
||||
|
||||
clean:
|
||||
rm -r build
|
||||
rm a.out
|
||||
|
||||
|
||||
8
compile_flags.txt
Normal file
8
compile_flags.txt
Normal file
@ -0,0 +1,8 @@
|
||||
-xc++
|
||||
-std=c++23
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wpedantic
|
||||
-Wconversion
|
||||
-pedantic
|
||||
-pedantic-errors
|
||||
Loading…
Reference in New Issue
Block a user