Makefile: fix dependency includes
This commit is contained in:
parent
ef916835e8
commit
9a63c16cd2
12
Makefile
12
Makefile
@ -1,13 +1,13 @@
|
|||||||
# Executable
|
# Executable
|
||||||
TARGET := main.out
|
TARGET := main.out
|
||||||
|
|
||||||
# Paths to source, dependency, object files
|
# Paths to source, include, dependency, and object files
|
||||||
SPATH = src
|
SPATH = src
|
||||||
IPATH = inc
|
IPATH = inc
|
||||||
DPATH = dep
|
DPATH = dep
|
||||||
OPATH = obj
|
OPATH = obj
|
||||||
|
|
||||||
VPATH = $(SPATH) $(OPATH) $(IPATH) $(DPATH)
|
VPATH = $(SPATH) $(IPATH) $(DPATH) $(OPATH)
|
||||||
|
|
||||||
# compiler and compiler flags
|
# compiler and compiler flags
|
||||||
CC = g++
|
CC = g++
|
||||||
@ -38,11 +38,11 @@ $(DPATH) $(OPATH):
|
|||||||
%.out: $(OBJECTS)
|
%.out: $(OBJECTS)
|
||||||
$(CC) $(CFLAGS) -o $@ $^
|
$(CC) $(CFLAGS) -o $@ $^
|
||||||
# Make the object and dependency files
|
# Make the object and dependency files
|
||||||
$(OPATH)/%.o $(DPATH)/%.d: $(SPATH)/%.cpp
|
$(OPATH)/%.o: $(SPATH)/%.cpp
|
||||||
$(CC) $(CFLAGS) -MF $(DPATH)/$(@F:.o=.d) -o $@ -c $<
|
$(CC) $(CFLAGS) -MF $(DPATH)/$(@F:.o=.d) -o $@ -c $<
|
||||||
|
|
||||||
# Don't delete object files:
|
# Don't autodelete object files:
|
||||||
.PRECIOUS: $(OPATH)/%.o $(DPATH)/%.d
|
.SECONDARY: $(OPATH)/%.o
|
||||||
|
|
||||||
# use dependencies when rebuilding
|
# use dependencies when rebuilding
|
||||||
-include $(addprefix $(DPATH)/,$(wildcard *.d))
|
-include $(wildcard $(DPATH)/*.d)
|
||||||
|
Loading…
Reference in New Issue
Block a user