Hi, I saw that there already are Makefile threads, but I couldn't find the solution after hours of trying.
This is my project structure:
sorting-visualizer/
├─ lib/
│ ├─ SFML-2.5.1/
│ │ ├─ include/
│ │ ├─ lib/
├─ src/
│ ├─ [cpp and h fiiles...]
├─ Makefile
Im trying to build the project using Makefile, here is the output when I try to run make:
https://pastebin.com/xa2QgC3EAnd here is my Makefile:
# SFML
SFML_DIR=./lib/SFML-2.5.1
SFML_LIBS=-lsfml-graphics -lsfml-window -lsfml-system
# Steps
steps: compile clean
# Compile source files
main.o: ./src/main.cpp
g++ -c ./src/main.cpp -I$(SFML_DIR)/include
Sortable.o: ./src/Sortable.cpp
g++ -c ./src/Sortable.cpp -I$(SFML_DIR)/include
SortAlgorithms.o: ./src/SortAlgorithms.cpp
g++ -c ./src/SortAlgorithms.cpp -I$(SFML_DIR)/include
SortController.o: ./src/SortController.cpp
g++ -c ./src/SortController.cpp -I$(SFML_DIR)/include
Utils.o: ./src/Utils.cpp
g++ -c ./src/Utils.cpp -I$(SFML_DIR)/include
# Compile binary
compile: main.o Sortable.o SortAlgorithms.o SortController.o Utils.o
g++ *.o -o sorting-visualizer -L$(SFML_DIR)/lib $(LIBS)
@echo
@echo Done! Run ./sorting-visualizer to open
# Clean object files after building
clean:
@rm *.o
Im using Arch Linux, should I use CMake instead? It would be great if the project could be built easily for Windows and macOS too, that's why I'm including the libraries instead of using the package manager.
Thanks!