Fixed conditional compilation to regard headers using dependency files
This commit is contained in:
parent
193da09dd6
commit
1bd9c7e4ef
8
Makefile
8
Makefile
@ -8,6 +8,7 @@ executable := app
|
||||
target := $(buildDir)/$(executable)
|
||||
sources := $(call rwildcard,src/,*.cpp)
|
||||
objects := $(patsubst src/%, $(buildDir)/%, $(patsubst %.cpp, %.o, $(sources)))
|
||||
depends := $(patsubst %.o, %.d, $(objects))
|
||||
compileFlags := -std=c++17 -I include
|
||||
linkFlags = -L lib/$(platform) -l raylib
|
||||
|
||||
@ -78,10 +79,13 @@ lib: submodules
|
||||
$(target): $(objects)
|
||||
$(CXX) $(objects) -o $(target) $(linkFlags)
|
||||
|
||||
# Add all rules from dependency files
|
||||
-include $(depends)
|
||||
|
||||
# Compile objects to the build directory
|
||||
$(buildDir)/%.o: src/%.cpp
|
||||
$(buildDir)/%.o: src/%.cpp Makefile
|
||||
$(MKDIR) $(call platformpth, $(@D))
|
||||
$(CXX) -c $(compileFlags) $< -o $@
|
||||
$(CXX) -MMD -MP -c $(compileFlags) $< -o $@
|
||||
|
||||
# Run the executable
|
||||
execute:
|
||||
|
Loading…
Reference in New Issue
Block a user