fix makefiles

This commit is contained in:
Mylloon 2024-04-03 15:38:54 +02:00
parent f2aabbf7c5
commit 1e1166404b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 25 additions and 25 deletions

View file

@ -16,8 +16,8 @@ Copy and paste [`c/`](./c/) directory, and you should be good to go!
- Remember to change executable's name and change std's target in - Remember to change executable's name and change std's target in
the [`Makefile`](./c/Makefile). the [`Makefile`](./c/Makefile).
- **Run `make` to compile the program.** - **Run `make` to compile the program in release mode.**
- **Run `make dev` to compile the program in debug mode.** - **Run `make debug` to compile the program in debug mode.**
- **Run `make clean` to clean artifacts.** - **Run `make clean` to clean artifacts.**
## C++ ## C++
@ -26,8 +26,8 @@ Copy and paste [`cpp/`](./cpp/) directory, and you should be good to go!
- Remember to change executable's name and change std's target in - Remember to change executable's name and change std's target in
the [`Makefile`](./cpp/Makefile). the [`Makefile`](./cpp/Makefile).
- **Run `make` to compile the program.** - **Run `make` to compile the program in release mode.**
- **Run `make dev` to compile the program in debug mode.** - **Run `make debug` to compile the program in debug mode.**
- **Run `make clean` to clean artifacts.** - **Run `make clean` to clean artifacts.**
## LaTeX ## LaTeX

View file

@ -2,7 +2,7 @@ CC = gcc
RM = rm RM = rm
SOURCES = $(wildcard src/*.c) SOURCES = $(wildcard src/*.c)
OBJETS = $(patsubst %.c,%.o,$(notdir $(SOURCES))) OBJECTS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
CFLAGS = -std=c11 -pedantic CFLAGS = -std=c11 -pedantic
LDFLAGS = LDFLAGS =
@ -13,19 +13,19 @@ EXE_EXT = out
%.o: src/%.c %.o: src/%.c
$(CC) -c $< -o $@ $(CFLAGS) $(CC) -c $< -o $@ $(CFLAGS)
compilation: $(OBJETS) release: CFLAGS += -O3
$(CC) -o $(EXE).$(EXE_EXT) $(OBJETS) $(LDFLAGS) release: compilation
main: CFLAGS += -O3 debug: CFLAGS += -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes
main: compilation debug: CFLAGS += -fanalyzer -fsanitize=undefined -g -Og
debug: LDFLAGS += -fsanitize=undefined
debug: compilation
dev: CFLAGS += -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes compilation: $(OBJECTS)
dev: CFLAGS += -fanalyzer -fsanitize=undefined -g -Og $(CC) -o $(EXE).$(EXE_EXT) $(OBJECTS) $(LDFLAGS)
dev: LDFLAGS += -fsanitize=undefined
dev: compilation
all: all:
main release
clean: clean:
$(RM) $(OBJETS) $(EXE).$(EXE_EXT) $(RM) $(OBJECTS) $(EXE).$(EXE_EXT)

View file

@ -2,7 +2,7 @@ CXX = g++
RM = rm RM = rm
SOURCES = $(wildcard src/*.cpp) SOURCES = $(wildcard src/*.cpp)
OBJETS = $(patsubst %.cpp,%.o,$(notdir $(SOURCES))) OBJECTS = $(patsubst %.cpp,%.o,$(notdir $(SOURCES)))
CXXFLAGS = --std=c++11 CXXFLAGS = --std=c++11
@ -12,18 +12,18 @@ EXE_EXT = out
%.o: src/%.cpp %.o: src/%.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(CXX) -c -o $@ $< $(CXXFLAGS)
compilation: $(OBJETS) release: CXXFLAGS += -O3
$(CXX) -o $(EXE).$(EXE_EXT) $(OBJETS) release: compilation
main: CXXFLAGS += -O3 debug: CXXFLAGS += -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g
main: compilation debug: CXXFLAGS += -Wold-style-cast -Wsign-conversion
debug: compilation
dev: CXXFLAGS += -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g compilation: $(OBJECTS)
dev: CXXFLAGS += -Wold-style-cast -Wsign-conversion $(CXX) -o $(EXE).$(EXE_EXT) $(OBJECTS)
dev: compilation
all: all:
main release
clean: clean:
$(RM) $(OBJETS) $(EXE).$(EXE_EXT) $(RM) $(OBJECTS) $(EXE).$(EXE_EXT)