From 8a700005c33fa3cdcfb696366efff8e8a2425192 Mon Sep 17 00:00:00 2001 From: "Elf M. Sternberg" Date: Thu, 17 Feb 2022 18:31:41 -0800 Subject: [PATCH] I consider Makefiles documentation, and this will help remind me that I don't want to build in the root, but in a build subdirectory. It also provides a nice and easy `make clean` method. --- Makefile | 201 +++---------------------------------------------------- 1 file changed, 9 insertions(+), 192 deletions(-) diff --git a/Makefile b/Makefile index 0241eb1..92f8917 100644 --- a/Makefile +++ b/Makefile @@ -1,197 +1,14 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.18 +all: build/xrandr +.PHONY: all -# Default target executed when no arguments are given to make. -default_target: all +build: + mkdir -p build -.PHONY : default_target +build/Makefile: build CMakeLists.txt + cd build && cmake .. -# Allow only one "make -f Makefile2" at a time, but pass parallelism. -.NOTPARALLEL: +build/xrandr: build/Makefile src/xrandr.cpp CMakeLists.txt + cd build && make - -#============================================================================= -# 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 = /usr/bin/cmake - -# The command to remove a file. -RM = /usr/bin/cmake -E rm -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/elf/projects/xrandr-c - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/elf/projects/xrandr-c - -#============================================================================= -# 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..." - /usr/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 "No interactive CMake dialog available..." - /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. -.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/elf/projects/xrandr-c/CMakeFiles /home/elf/projects/xrandr-c//CMakeFiles/progress.marks - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/elf/projects/xrandr-c/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 xrandr - -# Build rule for target. -xrandr: cmake_check_build_system - $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 xrandr -.PHONY : xrandr - -# fast build rule for target. -xrandr/fast: - $(MAKE) $(MAKESILENT) -f CMakeFiles/xrandr.dir/build.make CMakeFiles/xrandr.dir/build -.PHONY : xrandr/fast - -src/xrandr.o: src/xrandr.cpp.o - -.PHONY : src/xrandr.o - -# target to build an object file -src/xrandr.cpp.o: - $(MAKE) $(MAKESILENT) -f CMakeFiles/xrandr.dir/build.make CMakeFiles/xrandr.dir/src/xrandr.cpp.o -.PHONY : src/xrandr.cpp.o - -src/xrandr.i: src/xrandr.cpp.i - -.PHONY : src/xrandr.i - -# target to preprocess a source file -src/xrandr.cpp.i: - $(MAKE) $(MAKESILENT) -f CMakeFiles/xrandr.dir/build.make CMakeFiles/xrandr.dir/src/xrandr.cpp.i -.PHONY : src/xrandr.cpp.i - -src/xrandr.s: src/xrandr.cpp.s - -.PHONY : src/xrandr.s - -# target to generate assembly for a file -src/xrandr.cpp.s: - $(MAKE) $(MAKESILENT) -f CMakeFiles/xrandr.dir/build.make CMakeFiles/xrandr.dir/src/xrandr.cpp.s -.PHONY : src/xrandr.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 "... xrandr" - @echo "... src/xrandr.o" - @echo "... src/xrandr.i" - @echo "... src/xrandr.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 - + rm -fr build