Add ext "out" to output binaries for c and cpp projects

This commit is contained in:
Mylloon 2023-10-10 13:15:09 +02:00
parent f8b209af75
commit c8880c3dbb
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 8 additions and 6 deletions

2
c/.gitignore vendored
View file

@ -1,2 +1,2 @@
*.o *.o
example *.out

View file

@ -7,6 +7,7 @@ SOURCES = $(wildcard src/*.c)
OBJETS = $(patsubst %.c,%.c.o,$(notdir $(SOURCES))) OBJETS = $(patsubst %.c,%.c.o,$(notdir $(SOURCES)))
EXE = example EXE = example
EXE_EXT = out
%.c.o: src/%.c %.c.o: src/%.c
$(CC) -c $< -o $@ $(CFLAGS) $(DEVFLAGS) $(CC) -c $< -o $@ $(CFLAGS) $(DEVFLAGS)
@ -20,10 +21,10 @@ dev: LDFLAGS += -fsanitize=undefined
dev: compilation dev: compilation
compilation: $(OBJETS) compilation: $(OBJETS)
$(CC) -o $(EXE) $(OBJETS) $(LDFLAGS) $(CC) -o $(EXE).$(EXE_EXT) $(OBJETS) $(LDFLAGS)
all: all:
main main
clean: clean:
$(RM) $(OBJETS) $(EXE) $(RM) $(OBJETS) $(EXE).$(EXE_EXT)

2
cpp/.gitignore vendored
View file

@ -1,2 +1,2 @@
*.o *.o
example *.out

View file

@ -6,6 +6,7 @@ SOURCES = $(wildcard src/*.cpp)
OBJETS = $(patsubst %.cpp,%.cpp.o,$(notdir $(SOURCES))) OBJETS = $(patsubst %.cpp,%.cpp.o,$(notdir $(SOURCES)))
EXE = example EXE = example
EXE_EXT = out
%.cpp.o: src/%.cpp %.cpp.o: src/%.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(DEVFLAGS) $(CXX) -c -o $@ $< $(CXXFLAGS) $(DEVFLAGS)
@ -17,10 +18,10 @@ dev: CXXFLAGS += -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g -Wold-st
dev: compilation dev: compilation
compilation: $(OBJETS) compilation: $(OBJETS)
$(CXX) -o $(EXE) $(OBJETS) $(CXX) -o $(EXE).$(EXE_EXT) $(OBJETS)
all: all:
main main
clean: clean:
$(RM) $(OBJETS) $(EXE) $(RM) $(OBJETS) $(EXE).$(EXE_EXT)