[improve] Move the makefile into the prolect scope

This commit is contained in:
Anas Elgarhy 2023-05-11 03:22:27 +03:00
parent a86f296efc
commit f3b2844966
No known key found for this signature in database
GPG key ID: 0501802A1D496528
4 changed files with 494 additions and 16 deletions

5
.gitignore vendored
View file

@ -1,6 +1,3 @@
*.o
dwm
### C template
# Prerequisites
*.d
@ -61,10 +58,10 @@ CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
build/

View file

@ -3,10 +3,12 @@
include config.mk
SRC = drw.c yo_dwm.c util.c
OBJ = ${SRC:.c=.o}
SRC = src/drw.c src/yo_dwm.c src/util.c
OBJ_DIR = build
OBJ = ${SRC:%.c=$(OBJ_DIR)/%.o}
BUILD_DIR = ${OBJ_DIR}/yo-dwm
all: options yo-dwm
all: options ${BUILD_DIR}
options:
@echo yo-dwm build options:
@ -14,23 +16,24 @@ options:
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
.c.o:
${CC} -c ${CFLAGS} $<
${OBJ_DIR}/%.o: %.c
mkdir -p $(@D)
${CC} -c ${CFLAGS} $< -o $@
${OBJ}: config.h config.mk
${OBJ}: src/config.h config.mk
config.h:
cp config.def.h $@
yo-dwm: ${OBJ}
${BUILD_DIR}: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
clean:
rm -f yo-dwm ${OBJ} yo-dwm_${VERSION}.tar.gz
rm -rf ${OBJ_DIR}
dist: clean
mkdir -p yo-dwm_${VERSION}
cp -R LICENSE Makefile README config.def.h config.mk\
cp -R LICENSE Makefile README config.def.h config.mk \
yo-dwm.1 drw.h util.h ${SRC} dwm.png transient.c yo-dwm_${VERSION}
tar -cf yo-dwm_${VERSION}.tar yo-dwm_${VERSION}
gzip yo-dwm_${VERSION}.tar
@ -38,10 +41,10 @@ dist: clean
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f yo-dwm ${DESTDIR}${PREFIX}/bin
cp -f ${BUILD_DIR} ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/yo-dwm
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < ../yo-dwm.1 > ${DESTDIR}${MANPREFIX}/man1/yo-dwm.1
sed "s/VERSION/${VERSION}/g" < yo-dwm.1 > ${DESTDIR}${MANPREFIX}/man1/yo-dwm.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/yo-dwm.1
desktop:
@ -56,7 +59,7 @@ desktop:
Comment=Anas Elgarhy's dwm fork, with a lot of beautiful patches
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/yo-dwm\
rm -f ${DESTDIR}${PREFIX}/bin/yo-dwm \
${DESTDIR}${MANPREFIX}/man1/yo-dwm.1
.PHONY: all options clean dist install uninstall

478
cmake-build-debug/Makefile Normal file
View file

@ -0,0 +1,478 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.25
# 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/anas/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/231.8770.66/bin/cmake/linux/x64/bin/cmake
# The command to remove a file.
RM = /home/anas/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/231.8770.66/bin/cmake/linux/x64/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /mnt/work/yo-dwm
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /mnt/work/yo-dwm/cmake-build-debug
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
/home/anas/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/231.8770.66/bin/cmake/linux/x64/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
# 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/anas/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/231.8770.66/bin/cmake/linux/x64/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
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /mnt/work/yo-dwm/cmake-build-debug/CMakeFiles /mnt/work/yo-dwm/cmake-build-debug//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /mnt/work/yo-dwm/cmake-build-debug/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 yo_dwm
# Build rule for target.
yo_dwm: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 yo_dwm
.PHONY : yo_dwm
# fast build rule for target.
yo_dwm/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/build
.PHONY : yo_dwm/fast
src/drw.o: src/drw.c.o
.PHONY : src/drw.o
# target to build an object file
src/drw.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/drw.c.o
.PHONY : src/drw.c.o
src/drw.i: src/drw.c.i
.PHONY : src/drw.i
# target to preprocess a source file
src/drw.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/drw.c.i
.PHONY : src/drw.c.i
src/drw.s: src/drw.c.s
.PHONY : src/drw.s
# target to generate assembly for a file
src/drw.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/drw.c.s
.PHONY : src/drw.c.s
src/keys/keys.o: src/keys/keys.c.o
.PHONY : src/keys/keys.o
# target to build an object file
src/keys/keys.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/keys/keys.c.o
.PHONY : src/keys/keys.c.o
src/keys/keys.i: src/keys/keys.c.i
.PHONY : src/keys/keys.i
# target to preprocess a source file
src/keys/keys.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/keys/keys.c.i
.PHONY : src/keys/keys.c.i
src/keys/keys.s: src/keys/keys.c.s
.PHONY : src/keys/keys.s
# target to generate assembly for a file
src/keys/keys.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/keys/keys.c.s
.PHONY : src/keys/keys.c.s
src/keys/mouse.o: src/keys/mouse.c.o
.PHONY : src/keys/mouse.o
# target to build an object file
src/keys/mouse.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/keys/mouse.c.o
.PHONY : src/keys/mouse.c.o
src/keys/mouse.i: src/keys/mouse.c.i
.PHONY : src/keys/mouse.i
# target to preprocess a source file
src/keys/mouse.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/keys/mouse.c.i
.PHONY : src/keys/mouse.c.i
src/keys/mouse.s: src/keys/mouse.c.s
.PHONY : src/keys/mouse.s
# target to generate assembly for a file
src/keys/mouse.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/keys/mouse.c.s
.PHONY : src/keys/mouse.c.s
src/layouts/centeredmaster.o: src/layouts/centeredmaster.c.o
.PHONY : src/layouts/centeredmaster.o
# target to build an object file
src/layouts/centeredmaster.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/centeredmaster.c.o
.PHONY : src/layouts/centeredmaster.c.o
src/layouts/centeredmaster.i: src/layouts/centeredmaster.c.i
.PHONY : src/layouts/centeredmaster.i
# target to preprocess a source file
src/layouts/centeredmaster.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/centeredmaster.c.i
.PHONY : src/layouts/centeredmaster.c.i
src/layouts/centeredmaster.s: src/layouts/centeredmaster.c.s
.PHONY : src/layouts/centeredmaster.s
# target to generate assembly for a file
src/layouts/centeredmaster.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/centeredmaster.c.s
.PHONY : src/layouts/centeredmaster.c.s
src/layouts/fibonacci.o: src/layouts/fibonacci.c.o
.PHONY : src/layouts/fibonacci.o
# target to build an object file
src/layouts/fibonacci.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/fibonacci.c.o
.PHONY : src/layouts/fibonacci.c.o
src/layouts/fibonacci.i: src/layouts/fibonacci.c.i
.PHONY : src/layouts/fibonacci.i
# target to preprocess a source file
src/layouts/fibonacci.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/fibonacci.c.i
.PHONY : src/layouts/fibonacci.c.i
src/layouts/fibonacci.s: src/layouts/fibonacci.c.s
.PHONY : src/layouts/fibonacci.s
# target to generate assembly for a file
src/layouts/fibonacci.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/fibonacci.c.s
.PHONY : src/layouts/fibonacci.c.s
src/layouts/grid.o: src/layouts/grid.c.o
.PHONY : src/layouts/grid.o
# target to build an object file
src/layouts/grid.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/grid.c.o
.PHONY : src/layouts/grid.c.o
src/layouts/grid.i: src/layouts/grid.c.i
.PHONY : src/layouts/grid.i
# target to preprocess a source file
src/layouts/grid.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/grid.c.i
.PHONY : src/layouts/grid.c.i
src/layouts/grid.s: src/layouts/grid.c.s
.PHONY : src/layouts/grid.s
# target to generate assembly for a file
src/layouts/grid.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/grid.c.s
.PHONY : src/layouts/grid.c.s
src/layouts/monocle.o: src/layouts/monocle.c.o
.PHONY : src/layouts/monocle.o
# target to build an object file
src/layouts/monocle.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/monocle.c.o
.PHONY : src/layouts/monocle.c.o
src/layouts/monocle.i: src/layouts/monocle.c.i
.PHONY : src/layouts/monocle.i
# target to preprocess a source file
src/layouts/monocle.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/monocle.c.i
.PHONY : src/layouts/monocle.c.i
src/layouts/monocle.s: src/layouts/monocle.c.s
.PHONY : src/layouts/monocle.s
# target to generate assembly for a file
src/layouts/monocle.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/monocle.c.s
.PHONY : src/layouts/monocle.c.s
src/layouts/tile.o: src/layouts/tile.c.o
.PHONY : src/layouts/tile.o
# target to build an object file
src/layouts/tile.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/tile.c.o
.PHONY : src/layouts/tile.c.o
src/layouts/tile.i: src/layouts/tile.c.i
.PHONY : src/layouts/tile.i
# target to preprocess a source file
src/layouts/tile.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/tile.c.i
.PHONY : src/layouts/tile.c.i
src/layouts/tile.s: src/layouts/tile.c.s
.PHONY : src/layouts/tile.s
# target to generate assembly for a file
src/layouts/tile.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/layouts/tile.c.s
.PHONY : src/layouts/tile.c.s
src/movestack.o: src/movestack.c.o
.PHONY : src/movestack.o
# target to build an object file
src/movestack.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/movestack.c.o
.PHONY : src/movestack.c.o
src/movestack.i: src/movestack.c.i
.PHONY : src/movestack.i
# target to preprocess a source file
src/movestack.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/movestack.c.i
.PHONY : src/movestack.c.i
src/movestack.s: src/movestack.c.s
.PHONY : src/movestack.s
# target to generate assembly for a file
src/movestack.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/movestack.c.s
.PHONY : src/movestack.c.s
src/transient.o: src/transient.c.o
.PHONY : src/transient.o
# target to build an object file
src/transient.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/transient.c.o
.PHONY : src/transient.c.o
src/transient.i: src/transient.c.i
.PHONY : src/transient.i
# target to preprocess a source file
src/transient.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/transient.c.i
.PHONY : src/transient.c.i
src/transient.s: src/transient.c.s
.PHONY : src/transient.s
# target to generate assembly for a file
src/transient.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/transient.c.s
.PHONY : src/transient.c.s
src/util.o: src/util.c.o
.PHONY : src/util.o
# target to build an object file
src/util.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/util.c.o
.PHONY : src/util.c.o
src/util.i: src/util.c.i
.PHONY : src/util.i
# target to preprocess a source file
src/util.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/util.c.i
.PHONY : src/util.c.i
src/util.s: src/util.c.s
.PHONY : src/util.s
# target to generate assembly for a file
src/util.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/util.c.s
.PHONY : src/util.c.s
src/yo_dwm.o: src/yo_dwm.c.o
.PHONY : src/yo_dwm.o
# target to build an object file
src/yo_dwm.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/yo_dwm.c.o
.PHONY : src/yo_dwm.c.o
src/yo_dwm.i: src/yo_dwm.c.i
.PHONY : src/yo_dwm.i
# target to preprocess a source file
src/yo_dwm.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/yo_dwm.c.i
.PHONY : src/yo_dwm.c.i
src/yo_dwm.s: src/yo_dwm.c.s
.PHONY : src/yo_dwm.s
# target to generate assembly for a file
src/yo_dwm.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/yo_dwm.dir/build.make CMakeFiles/yo_dwm.dir/src/yo_dwm.c.s
.PHONY : src/yo_dwm.c.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 "... yo_dwm"
@echo "... src/drw.o"
@echo "... src/drw.i"
@echo "... src/drw.s"
@echo "... src/keys/keys.o"
@echo "... src/keys/keys.i"
@echo "... src/keys/keys.s"
@echo "... src/keys/mouse.o"
@echo "... src/keys/mouse.i"
@echo "... src/keys/mouse.s"
@echo "... src/layouts/centeredmaster.o"
@echo "... src/layouts/centeredmaster.i"
@echo "... src/layouts/centeredmaster.s"
@echo "... src/layouts/fibonacci.o"
@echo "... src/layouts/fibonacci.i"
@echo "... src/layouts/fibonacci.s"
@echo "... src/layouts/grid.o"
@echo "... src/layouts/grid.i"
@echo "... src/layouts/grid.s"
@echo "... src/layouts/monocle.o"
@echo "... src/layouts/monocle.i"
@echo "... src/layouts/monocle.s"
@echo "... src/layouts/tile.o"
@echo "... src/layouts/tile.i"
@echo "... src/layouts/tile.s"
@echo "... src/movestack.o"
@echo "... src/movestack.i"
@echo "... src/movestack.s"
@echo "... src/transient.o"
@echo "... src/transient.i"
@echo "... src/transient.s"
@echo "... src/util.o"
@echo "... src/util.i"
@echo "... src/util.s"
@echo "... src/yo_dwm.o"
@echo "... src/yo_dwm.i"
@echo "... src/yo_dwm.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