fix makefiles
This commit is contained in:
parent
f2aabbf7c5
commit
1e1166404b
3 changed files with 25 additions and 25 deletions
|
@ -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
|
||||||
|
|
22
c/Makefile
22
c/Makefile
|
@ -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)
|
||||||
|
|
20
cpp/Makefile
20
cpp/Makefile
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue