From 2002bb961bbd2408dc4298aad2a5de2dff7240cb Mon Sep 17 00:00:00 2001 From: Jonathan Moallem Date: Tue, 1 Dec 2020 14:15:35 +1100 Subject: [PATCH] Made Makefile automatically gather compilation sources from src directory --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3fb79f9..3193ab2 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ ifeq ($(OS), Windows_NT) platform = Windows compiler = g++ options = -pthread -lopengl32 -lgdi32 -lwinmm -mwindows + sources = src/main.cpp THEN = && else # Check for MacOS/Linux @@ -27,6 +28,7 @@ else endif # Set UNIX macros + sources = $(shell find src -type f -name '*.cpp') THEN = ; endif @@ -81,7 +83,7 @@ endif # Create the build folder and compile the executable compile: build - $(CXX) -std=c++17 -I include -L lib/$(platform) src/main.cpp -o $(buildFile) -l raylib $(options) + $(CXX) -std=c++17 -I include -L lib/$(platform) $(sources) -o $(buildFile) -l raylib $(options) # Run the executable execute: