From f45bfee860577b244a9a9f01df0d1e34f2c148df Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Wed, 19 Jan 2022 22:31:38 +0100 Subject: Makefile update --- .gitignore | 2 +- Makefile | 30 ++++++++++++++++++++---------- README.md | 2 +- src/State.cpp | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index a1556de..80f7cac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ sfml-rpg -*.o +build *.out *.exe diff --git a/Makefile b/Makefile index a93df76..05f2fed 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,35 @@ +RM = rm -f +MKDIR = mkdir -p + CXX = g++ -CXXFLAGS = --std=c++14 -g -O0 -Wall +CXXFLAGS = --std=c++14 -O3 -Wall LDLIBS = -lsfml-graphics -lsfml-window -lsfml-system -SOURCE_DIR = src/ -OBJECTS_DIR= obj/ +SOURCE_DIR = src +OBJECT_DIR= build OBJS = main.o State.o Game.o Global.o Enemy1.o Enemy2.o Enemy3.o Powerup.o Entity.o Player.o -OBJECTS = $(addprefix $(OBJECTS_DIR),$(OBJS)) +OBJECTS = $(addprefix $(OBJECT_DIR)/,$(OBJS)) TARGET = sfml-rpg -all: $(TARGET) +.PHONY: all compile clean + +all: compile + +$(OBJECT_DIR)/%.o: $(SOURCE_DIR)/%.cpp + $(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@ $(TARGET): $(OBJECTS) $(CXX) $(CXXFLAGS) $(OBJECTS) -o $(TARGET) $(LDLIBS) -$(OBJECTS_DIR)%.o: $(SOURCE_DIR)%.cpp - $(MKDIR_P) $(dir $@) - $(CXX) $(CXXFLAGS) -c $< -o $@ +compile: + $(MKDIR) $(OBJECT_DIR) + $(MAKE) $(TARGET) + +run: compile + ./$(TARGET) clean: $(RM) $(OBJECTS) sfml-rpg -RM = rm -f -MKDIR_P = mkdir -p +-include $(OBJECTS:.o=.d) diff --git a/README.md b/README.md index 0173ee1..430227c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ make - Install [mingw-w64](http://mingw-w64.org/doku.php/download/mingw-builds) - Add mingw64\bin to $PATH ``` -g++ -std=c++14 -g -O2 -Wall -o sfml-rpg *.cpp -I SFML-2.5.1\include -L SFML-2.5.1\lib -lsfml-graphics -lsfml-window -lsfml-system +g++ -std=c++14 -g -O2 -Wall -o sfml-rpg src\*.cpp -I SFML-2.5.1\include -L SFML-2.5.1\lib -lsfml-graphics -lsfml-window -lsfml-system ``` Or just use Linux > If you use Visual Studio or Code::Blocks you can follow [official tutorial](https://www.sfml-dev.org/tutorials) for setting up SFML. diff --git a/src/State.cpp b/src/State.cpp index 9e20035..077a195 100644 --- a/src/State.cpp +++ b/src/State.cpp @@ -11,7 +11,7 @@ State::State() } void State::initwin() { - prozor=std::make_shared(sf::VideoMode::getFullscreenModes()[0],"RPG igra",sf::Style::Fullscreen); + prozor=std::make_shared(sf::VideoMode::getFullscreenModes()[0],"RPG igra",sf::Style::Default); prozor->setVerticalSyncEnabled(true); visina=prozor->getSize().y; sirina=prozor->getSize().x; -- cgit v1.2.3