use .o instead of .c.o or .cpp.o + fix issue in makefile
This commit is contained in:
parent
5165d8f898
commit
8f0b120d19
2 changed files with 10 additions and 10 deletions
10
c/Makefile
10
c/Makefile
|
@ -2,7 +2,7 @@ CC = gcc
|
|||
RM = rm
|
||||
|
||||
SOURCES = $(wildcard src/*.c)
|
||||
OBJETS = $(patsubst %.c,%.c.o,$(notdir $(SOURCES)))
|
||||
OBJETS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
|
||||
|
||||
CFLAGS = -std=c11 -pedantic
|
||||
LDFLAGS =
|
||||
|
@ -10,9 +10,12 @@ LDFLAGS =
|
|||
EXE = example
|
||||
EXE_EXT = out
|
||||
|
||||
%.c.o: src/%.c
|
||||
%.o: src/%.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
||||
compilation: $(OBJETS)
|
||||
$(CC) -o $(EXE).$(EXE_EXT) $(OBJETS) $(LDFLAGS)
|
||||
|
||||
main: CFLAGS += -O3
|
||||
main: compilation
|
||||
|
||||
|
@ -21,9 +24,6 @@ dev: CFLAGS += -fanalyzer -fsanitize=undefined -g -Og
|
|||
dev: LDFLAGS += -fsanitize=undefined
|
||||
dev: compilation
|
||||
|
||||
compilation: $(OBJETS)
|
||||
$(CC) -o $(EXE).$(EXE_EXT) $(OBJETS) $(LDFLAGS)
|
||||
|
||||
all:
|
||||
main
|
||||
|
||||
|
|
10
cpp/Makefile
10
cpp/Makefile
|
@ -2,16 +2,19 @@ CXX = g++
|
|||
RM = rm
|
||||
|
||||
SOURCES = $(wildcard src/*.cpp)
|
||||
OBJETS = $(patsubst %.cpp,%.cpp.o,$(notdir $(SOURCES)))
|
||||
OBJETS = $(patsubst %.cpp,%.o,$(notdir $(SOURCES)))
|
||||
|
||||
CXXFLAGS = --std=c++11
|
||||
|
||||
EXE = example
|
||||
EXE_EXT = out
|
||||
|
||||
%.cpp.o: src/%.cpp
|
||||
%.o: src/%.cpp
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
||||
|
||||
compilation: $(OBJETS)
|
||||
$(CXX) -o $(EXE).$(EXE_EXT) $(OBJETS)
|
||||
|
||||
main: CXXFLAGS += -O3
|
||||
main: compilation
|
||||
|
||||
|
@ -19,9 +22,6 @@ dev: CXXFLAGS += -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g
|
|||
dev: CXXFLAGS += -Wold-style-cast -Wsign-conversion
|
||||
dev: compilation
|
||||
|
||||
compilation: $(OBJETS)
|
||||
$(CXX) -o $(EXE).$(EXE_EXT) $(OBJETS)
|
||||
|
||||
all:
|
||||
main
|
||||
|
||||
|
|
Loading…
Reference in a new issue