| 1 | PREFIX = /usr/local |
| 2 | |
| 3 | stub: |
| 4 | @echo "Do not run $(MAKE) directly without any arguments. Please refer to the wiki on how to compile Hyprland." |
| 5 | |
| 6 | release: |
| 7 | cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build |
| 8 | cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` |
| 9 | |
| 10 | debug: |
| 11 | cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DTESTS=true -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build |
| 12 | cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` |
| 13 | |
| 14 | nopch: |
| 15 | cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -S . -B ./build |
| 16 | cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` |
| 17 | |
| 18 | clear: |
| 19 | rm -rf build |
| 20 | rm -f ./protocols/*.h ./protocols/*.c ./protocols/*.cpp ./protocols/*.hpp |
| 21 | rm -f ./hyprctl/hw-protocols/*.cpp ./hyprctl/hw-protocols/*.hpp |
| 22 | |
| 23 | all: |
| 24 | $(MAKE) clear |
| 25 | $(MAKE) release |
| 26 | |
| 27 | install: |
| 28 | cmake --install ./build |
| 29 | |
| 30 | uninstall: |
| 31 | xargs rm < ./build/install_manifest.txt |
| 32 | |
| 33 | pluginenv: |
| 34 | @echo -en "$(MAKE) pluginenv has been deprecated.\nPlease run $(MAKE) all && sudo $(MAKE) installheaders\n" |
| 35 | @exit 1 |
| 36 | |
| 37 | installheaders: |
| 38 | @if [ ! -f ./src/version.h ]; then echo -en "You need to run $(MAKE) all first.\n" && exit 1; fi |
| 39 | |
| 40 | # remove previous headers from hyprpm's dir |
| 41 | rm -fr ${PREFIX}/include/hyprland |
| 42 | mkdir -p ${PREFIX}/include/hyprland |
| 43 | mkdir -p ${PREFIX}/include/hyprland/protocols |
| 44 | mkdir -p ${PREFIX}/share/pkgconfig |
| 45 | |
| 46 | cmake --build ./build --config Release --target generate-protocol-headers |
| 47 | |
| 48 | find src -type f \( -name '*.hpp' -o -name '*.h' -o -name '*.inc' \) -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland |
| 49 | cp ./protocols/*.h* ${PREFIX}/include/hyprland/protocols |
| 50 | cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig |
| 51 | if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi |
| 52 | |
| 53 | chmod -R 755 ${PREFIX}/include/hyprland |
| 54 | chmod 755 ${PREFIX}/share/pkgconfig |
| 55 | |
| 56 | man: |
| 57 | pandoc ./docs/Hyprland.1.rst \ |
| 58 | --standalone \ |
| 59 | --variable=header:"Hyprland User Manual" \ |
| 60 | --variable=date:"${DATE}" \ |
| 61 | --variable=section:1 \ |
| 62 | --from rst \ |
| 63 | --to man > ./docs/Hyprland.1 |
| 64 | |
| 65 | pandoc ./docs/hyprctl.1.rst \ |
| 66 | --standalone \ |
| 67 | --variable=header:"hyprctl User Manual" \ |
| 68 | --variable=date:"${DATE}" \ |
| 69 | --variable=section:1 \ |
| 70 | --from rst \ |
| 71 | --to man > ./docs/hyprctl.1 |
| 72 | |
| 73 | asan: |
| 74 | @echo -en "!!WARNING!!\nOnly run this in the TTY.\n" |
| 75 | @pidof Hyprland > /dev/null && echo -ne "Refusing to run with Hyprland running.\n" || echo "" |
| 76 | @pidof Hyprland > /dev/null && exit 1 || echo "" |
| 77 | |
| 78 | rm -rf ./wayland |
| 79 | #git reset --hard |
| 80 | |
| 81 | @echo -en "If you want to apply a patch, input its path (leave empty for none):\n" |
| 82 | @read patchvar; \ |
| 83 | if [ -n "$$patchvar" ]; then patch -p1 < "$$patchvar" || echo ""; else echo "No patch specified"; fi |
| 84 | |
| 85 | git clone --recursive https://gitlab.freedesktop.org/wayland/wayland |
| 86 | cd wayland && patch -p1 < ../scripts/waylandStatic.diff && meson setup build --buildtype=debug -Db_sanitize=address -Ddocumentation=false && ninja -C build && cd .. |
| 87 | cp ./wayland/build/src/libwayland-server.a . |
| 88 | @echo "Wayland done" |
| 89 | |
| 90 | patch -p1 < ./scripts/hyprlandStaticAsan.diff |
| 91 | cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_ASAN:STRING=True -DUSE_TRACY:STRING=False -DUSE_TRACY_GPU:STRING=False -S . -B ./build |
| 92 | cmake --build ./build --config Debug --target all |
| 93 | @echo "Hyprland done" |
| 94 | |
| 95 | ASAN_OPTIONS="detect_odr_violation=0,log_path=asan.log" HYPRLAND_NO_CRASHREPORTER=1 ./build/Hyprland -c ~/.config/hypr/hyprland.lua |
| 96 | |
| 97 | format-check: |
| 98 | @find src hyprctl hyprpm start tests hyprtester -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \) \ |
| 99 | ! -path "src/render/shaders/Shaders.hpp" \ |
| 100 | ! -path "hyprctl/hw-protocols/*" | \ |
| 101 | xargs clang-format --dry-run --Werror |
| 102 | |
| 103 | format-fix: |
| 104 | @find src hyprctl hyprpm start tests hyprtester -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \) \ |
| 105 | ! -path "src/render/shaders/Shaders.hpp" \ |
| 106 | ! -path "hyprctl/hw-protocols/*" | \ |
| 107 | xargs clang-format -i |
| 108 | |
| 109 | test: |
| 110 | $(MAKE) debug |
| 111 | ./build/hyprtester/hyprtester -c hyprtester/test.lua -b ./build/Hyprland -p hyprtester/plugin/hyprtestplugin.so |