diff --git a/Makefile b/Makefile index ce77822..6b2b160 100644 --- a/Makefile +++ b/Makefile @@ -1,397 +1,140 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.20 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -# Allow only one "make -f Makefile2" at a time, but pass parallelism. -.NOTPARALLEL: - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Disable VCS-based implicit rules. -% : %,v - -# Disable VCS-based implicit rules. -% : RCS/% - -# Disable VCS-based implicit rules. -% : RCS/%,v - -# Disable VCS-based implicit rules. -% : SCCS/s.% - -# Disable VCS-based implicit rules. -% : s.% - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Command-line flag to silence nested $(MAKE). -$(VERBOSE)MAKESILENT = -s - -#Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /home/miguelmj/Programs/cmake-3.20.0-linux-x86_64/bin/cmake - -# The command to remove a file. -RM = /home/miguelmj/Programs/cmake-3.20.0-linux-x86_64/bin/cmake -E rm -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/miguelmj/Programs/MINE/Candle - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/miguelmj/Programs/MINE/Candle - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /home/miguelmj/Programs/cmake-3.20.0-linux-x86_64/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache -.PHONY : rebuild_cache/fast - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." - /home/miguelmj/Programs/cmake-3.20.0-linux-x86_64/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache -.PHONY : edit_cache/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /home/miguelmj/Programs/MINE/Candle/CMakeFiles /home/miguelmj/Programs/MINE/Candle//CMakeFiles/progress.marks - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/miguelmj/Programs/MINE/Candle/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -#============================================================================= -# Target rules for targets named Candle-s - -# Build rule for target. -Candle-s: cmake_check_build_system - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 Candle-s -.PHONY : Candle-s - -# fast build rule for target. -Candle-s/fast: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/build -.PHONY : Candle-s/fast - -src/Color.o: src/Color.cpp.o -.PHONY : src/Color.o - -# target to build an object file -src/Color.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Color.cpp.o -.PHONY : src/Color.cpp.o - -src/Color.i: src/Color.cpp.i -.PHONY : src/Color.i - -# target to preprocess a source file -src/Color.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Color.cpp.i -.PHONY : src/Color.cpp.i - -src/Color.s: src/Color.cpp.s -.PHONY : src/Color.s - -# target to generate assembly for a file -src/Color.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Color.cpp.s -.PHONY : src/Color.cpp.s - -src/Constants.o: src/Constants.cpp.o -.PHONY : src/Constants.o - -# target to build an object file -src/Constants.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Constants.cpp.o -.PHONY : src/Constants.cpp.o - -src/Constants.i: src/Constants.cpp.i -.PHONY : src/Constants.i - -# target to preprocess a source file -src/Constants.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Constants.cpp.i -.PHONY : src/Constants.cpp.i - -src/Constants.s: src/Constants.cpp.s -.PHONY : src/Constants.s - -# target to generate assembly for a file -src/Constants.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Constants.cpp.s -.PHONY : src/Constants.cpp.s - -src/DirectedLight.o: src/DirectedLight.cpp.o -.PHONY : src/DirectedLight.o - -# target to build an object file -src/DirectedLight.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/DirectedLight.cpp.o -.PHONY : src/DirectedLight.cpp.o - -src/DirectedLight.i: src/DirectedLight.cpp.i -.PHONY : src/DirectedLight.i - -# target to preprocess a source file -src/DirectedLight.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/DirectedLight.cpp.i -.PHONY : src/DirectedLight.cpp.i - -src/DirectedLight.s: src/DirectedLight.cpp.s -.PHONY : src/DirectedLight.s - -# target to generate assembly for a file -src/DirectedLight.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/DirectedLight.cpp.s -.PHONY : src/DirectedLight.cpp.s - -src/LightSource.o: src/LightSource.cpp.o -.PHONY : src/LightSource.o - -# target to build an object file -src/LightSource.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/LightSource.cpp.o -.PHONY : src/LightSource.cpp.o - -src/LightSource.i: src/LightSource.cpp.i -.PHONY : src/LightSource.i - -# target to preprocess a source file -src/LightSource.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/LightSource.cpp.i -.PHONY : src/LightSource.cpp.i - -src/LightSource.s: src/LightSource.cpp.s -.PHONY : src/LightSource.s - -# target to generate assembly for a file -src/LightSource.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/LightSource.cpp.s -.PHONY : src/LightSource.cpp.s - -src/LightingArea.o: src/LightingArea.cpp.o -.PHONY : src/LightingArea.o - -# target to build an object file -src/LightingArea.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/LightingArea.cpp.o -.PHONY : src/LightingArea.cpp.o - -src/LightingArea.i: src/LightingArea.cpp.i -.PHONY : src/LightingArea.i - -# target to preprocess a source file -src/LightingArea.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/LightingArea.cpp.i -.PHONY : src/LightingArea.cpp.i - -src/LightingArea.s: src/LightingArea.cpp.s -.PHONY : src/LightingArea.s - -# target to generate assembly for a file -src/LightingArea.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/LightingArea.cpp.s -.PHONY : src/LightingArea.cpp.s - -src/Line.o: src/Line.cpp.o -.PHONY : src/Line.o - -# target to build an object file -src/Line.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Line.cpp.o -.PHONY : src/Line.cpp.o - -src/Line.i: src/Line.cpp.i -.PHONY : src/Line.i - -# target to preprocess a source file -src/Line.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Line.cpp.i -.PHONY : src/Line.cpp.i - -src/Line.s: src/Line.cpp.s -.PHONY : src/Line.s - -# target to generate assembly for a file -src/Line.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Line.cpp.s -.PHONY : src/Line.cpp.s - -src/Polygon.o: src/Polygon.cpp.o -.PHONY : src/Polygon.o - -# target to build an object file -src/Polygon.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Polygon.cpp.o -.PHONY : src/Polygon.cpp.o - -src/Polygon.i: src/Polygon.cpp.i -.PHONY : src/Polygon.i - -# target to preprocess a source file -src/Polygon.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Polygon.cpp.i -.PHONY : src/Polygon.cpp.i - -src/Polygon.s: src/Polygon.cpp.s -.PHONY : src/Polygon.s - -# target to generate assembly for a file -src/Polygon.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/Polygon.cpp.s -.PHONY : src/Polygon.cpp.s - -src/RadialLight.o: src/RadialLight.cpp.o -.PHONY : src/RadialLight.o - -# target to build an object file -src/RadialLight.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/RadialLight.cpp.o -.PHONY : src/RadialLight.cpp.o - -src/RadialLight.i: src/RadialLight.cpp.i -.PHONY : src/RadialLight.i - -# target to preprocess a source file -src/RadialLight.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/RadialLight.cpp.i -.PHONY : src/RadialLight.cpp.i - -src/RadialLight.s: src/RadialLight.cpp.s -.PHONY : src/RadialLight.s - -# target to generate assembly for a file -src/RadialLight.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/RadialLight.cpp.s -.PHONY : src/RadialLight.cpp.s - -src/VertexArray.o: src/VertexArray.cpp.o -.PHONY : src/VertexArray.o - -# target to build an object file -src/VertexArray.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/VertexArray.cpp.o -.PHONY : src/VertexArray.cpp.o - -src/VertexArray.i: src/VertexArray.cpp.i -.PHONY : src/VertexArray.i - -# target to preprocess a source file -src/VertexArray.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/VertexArray.cpp.i -.PHONY : src/VertexArray.cpp.i - -src/VertexArray.s: src/VertexArray.cpp.s -.PHONY : src/VertexArray.s - -# target to generate assembly for a file -src/VertexArray.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/Candle-s.dir/build.make CMakeFiles/Candle-s.dir/src/VertexArray.cpp.s -.PHONY : src/VertexArray.cpp.s - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... edit_cache" - @echo "... rebuild_cache" - @echo "... Candle-s" - @echo "... src/Color.o" - @echo "... src/Color.i" - @echo "... src/Color.s" - @echo "... src/Constants.o" - @echo "... src/Constants.i" - @echo "... src/Constants.s" - @echo "... src/DirectedLight.o" - @echo "... src/DirectedLight.i" - @echo "... src/DirectedLight.s" - @echo "... src/LightSource.o" - @echo "... src/LightSource.i" - @echo "... src/LightSource.s" - @echo "... src/LightingArea.o" - @echo "... src/LightingArea.i" - @echo "... src/LightingArea.s" - @echo "... src/Line.o" - @echo "... src/Line.i" - @echo "... src/Line.s" - @echo "... src/Polygon.o" - @echo "... src/Polygon.i" - @echo "... src/Polygon.s" - @echo "... src/RadialLight.o" - @echo "... src/RadialLight.i" - @echo "... src/RadialLight.s" - @echo "... src/VertexArray.o" - @echo "... src/VertexArray.i" - @echo "... src/VertexArray.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system - +# +# General +# +EXEC = demo +CXX = g++ +CXXFLAGS = -std=c++11 -Wall -Wextra -Werror -fmax-errors=3 $(INCLUDES) $(LINKDIRS) +CC = $(CXX) +CFLAGS = $(CXXFLAGS) + +INCLUDES = -Iinclude +LINKDIRS = +LDFLAGS = +LIBS = +LINKAGE = $(LIBS) $(LDFLAGS) +SRC_FILES = $(EXEC).cpp $(wildcard src/*.cpp) + +OBJ = $(SRC_FILES:%.cpp=%.o) +DEP = $(OBJ:%.o=%.d) + +# +# Debug build settings +# +DBGDIR = debug +DBGEXEC = $(DBGDIR)/$(EXEC) +DBGOBJ = $(addprefix $(DBGDIR)/, $(OBJ)) +DBGDEP = $(addprefix $(DBGDIR)/, $(DEP)) +DBGCFLAGS = -g -O0 -DDEBUG -DCANDLE_DEBUG + +# +# Release build settings +# +RELDIR = release +RELEXEC = $(RELDIR)/$(EXEC) +RELOBJ = $(addprefix $(RELDIR)/, $(OBJ)) +RELDEP = $(addprefix $(RELDIR)/, $(DEP)) +RELCFLAGS = -O3 -DNDEBUG + +# +# Libraries +# +# SFML +LIBS += -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system + +# +# Custom output functions +# +define print_info + @echo "\033[1;38;2;250;250;50m$(1)\033[0m" +endef +define print_success + @echo "\033[1;38;2;50;250;50m$(1)\033[0m" +endef + +# +# Rules +# +.PHONY: all debug release remake clean clean-release clean-debug docs + +# Default build +all: release + + +$(shell mkdir -p debug/src release/src ) +# Include dependency rules +-include $(DBGDEP) +-include $(RELDEP) + +# +# Debug rules +# +debug: $(DBGEXEC) + +$(DBGEXEC): $(DBGOBJ) + $(call print_info,Building static library) + ar -rc $(DBGDIR)/libCandle-s-d.a $(DBGDIR)/src/*.o + ranlib $(DBGDIR)/libCandle-s-d.a + $(call print_success,$(DBGDIR)/libCandle-s.a built) + $(call print_info,Building $@) + @$(CXX) $(CXXFLAGS) $(DBGCFLAGS) $^ -o $(DBGEXEC) $(LINKAGE) + $(call print_success,$< ready) + +$(DBGDIR)/%.d: %.cpp + $(call print_info,Checking debug dependencies for $<) + $(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ + @echo '\t$$(call print_info,Building $$@)' >> $@ + @echo '\t$$(CXX) -c $$(CXXFLAGS) $$(DBGCFLAGS) -o $$@ $$<' >> $@ + +# $(DBGDIR)/%.o: %.cpp +# $(call print_info,Building $@) +# $(CXX) -c $(CXXFLAGS) $(DBGCFLAGS) -o $@ $< + +# +# Release rules +# +release: $(RELEXEC) + +$(RELEXEC): $(RELOBJ) + $(call print_info,Building static library) + ar -rc $(RELDIR)/libCandle-s.a $(RELDIR)/src/*.o + ranlib $(RELDIR)/libCandle-s.a + $(call print_success,$(RELDIR)/libCandle-s.a built) + $(call print_info,Building $@) + $(CXX) $(CXXFLAGS) $(RELCFLAGS) $^ -o $(RELEXEC) $(LINKAGE) + $(call print_success,$< ready) + +$(RELDIR)/%.d: %.cpp + $(call print_info,Checking release dependencies for $<) + $(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ + @echo '\t$$(call print_info,Building $$@)' >> $@ + @echo '\t$$(CXX) -c $$(CXXFLAGS) $$(RELCFLAGS) -o $$@ $$<' >> $@ + +lib: $(RELOBJ) + +# $(RELDIR)/%.o: %.cpp +# $(call print_info,Building $@) +# $(CXX) -c $(CXXFLAGS) $(RELCFLAGS) -o $@ $< + +# +# Other rules +# + +remake: clean all + +clean: clean-release clean-debug + +clean-release: + @rm -f -r $(RELDIR) + @mkdir -p $(RELDIR)/src +clean-debug: + @rm -f -r $(DBGDIR) + @mkdir -p $(DBGDIR)/src +# +# Documentation rules +# + +DOXYFILE = doc/Doxyfile + +docs: + @doxygen $(DOXYFILE) +