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
the [`Makefile`](./c/Makefile).
- **Run `make` to compile the program.**
- **Run `make dev` to compile the program in debug mode.**
- **Run `make` to compile the program in release mode.**
- **Run `make debug` to compile the program in debug mode.**
- **Run `make clean` to clean artifacts.**
## 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
the [`Makefile`](./cpp/Makefile).
- **Run `make` to compile the program.**
- **Run `make dev` to compile the program in debug mode.**
- **Run `make` to compile the program in release mode.**
- **Run `make debug` to compile the program in debug mode.**
- **Run `make clean` to clean artifacts.**
## LaTeX

View file

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

View file

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