Updated Makefile

Fixed bug where if a submodule is not updated, the directory would exist
but be empty (defined behaviour). If this directory is empty (user used
clone and hadn't updated submodules), then each git command is ran from
make as a phony target.

Other small bug fixes.
This commit is contained in:
Ethan Smith-Coss 2024-06-18 20:48:53 +01:00
parent 4b85223cae
commit 8e41c5b04d
Signed by: TheOnePath
GPG Key ID: 1D351CCC6D01F32B

View File

@ -8,15 +8,20 @@ INC_SYSTEM_PATH=/usr/include
# Set the default target to build # Set the default target to build
default-target: build default-target: build
# Build Hyprland if it's not installed on the system ### Makefile targets for hyprwm libraries ###
Hyprland:
git submodule init # Build and install tomlplusplus if it's not on the system
git submodule update --remote Hyprland tomlplusplus:
__Hyperland = $(BIN_SYSTEM_PATH)/hyprland git clone https://github.com/marzer/tomlplusplus.git
$(__Hyperland): $(__Hyperlang) $(__Hypercursor) __Tomlplusplus = $(INC_SYSTEM_PATH)/toml++
$(MAKE) -C Hyprland all $(__Tomlplusplus): tomlplusplus
@echo "Building and installing tomlplusplus..."
cd tomlplusplus && $(MESON) setup build --buildtype=release --prefix=/usr
ninja -C tomlplusplus/build
sudo $(MESON) install -C tomlplusplus/build
# Build hyprcursor if the .hpp file is not installed (required hyprlang) # Build hyprcursor if the .hpp file is not installed (required hyprlang)
# Library for hyprwm
hyprcursor: hyprcursor:
git submodule init git submodule init
git submodule update --remote hyprcursor git submodule update --remote hyprcursor
@ -30,6 +35,7 @@ $(__Hypercursor): $(__Hyperlang)
sudo $(CMAKE) --install hyprcursor/build sudo $(CMAKE) --install hyprcursor/build
# Build hyprutils if the .hpp file is not installed # Build hyprutils if the .hpp file is not installed
# Library for hyprwm
hyprutils: hyprutils:
git submodule init git submodule init
git submodule update --remote hyprutils git submodule update --remote hyprutils
@ -42,6 +48,7 @@ $(__Hyprutils): hyprutils
sudo $(CMAKE) --install hyprutils/build sudo $(CMAKE) --install hyprutils/build
# Build hyprlang if the .hpp file is not installed # Build hyprlang if the .hpp file is not installed
# Library for hyprwm
hyprlang: hyprlang:
git submodule init git submodule init
git submodule update --remote hyprlang git submodule update --remote hyprlang
@ -56,47 +63,55 @@ $(__Hyprlang): $(__Hyprutils)
@echo "Installing library hyprlang..." @echo "Installing library hyprlang..."
sudo $(CMAKE) --install ./hyprlang/build sudo $(CMAKE) --install ./hyprlang/build
### Makefile targets for hyprwm apps ###
# Build Hyprland if it's not installed on the system
.PHONY : Hyprland
Hyprland:
git submodule init
git submodule update --remote Hyprland
__Hyperland = Hyprland/build
$(__Hyperland): $(__Hyperlang) $(__Hypercursor)
@[[ -z "$(ls -A Hyprland)" ]] && $(MAKE) Hyprland
$(MAKE) -C Hyprland all
# Build hyprlock if it's not installed on the system # Build hyprlock if it's not installed on the system
.PHONY : hyprlock
hyprlock: hyprlock:
git submodule init git submodule init
git submodule update --remote hyprlock git submodule update --remote hyprlock
__Hyprlock = $(BIN_SYSTEM_PATH)/hyprlock __Hyprlock = hyprlock/build
$(__Hyprlock): $(__Hyprlang) $(__Hyprlock): $(__Hyprlang)
@[[ -z "$(ls -A hyprlock)" ]] && $(MAKE) hyprlock
$(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \ $(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \
-S ./hyprlock -B ./hyprlock/build -S ./hyprlock -B ./hyprlock/build
$(CMAKE) --build ./hyprlock/build --config Release --target hyprlock \ $(CMAKE) --build ./hyprlock/build --config Release --target hyprlock \
-j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF` -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
# Build hyprpaper if it's not installed on the system # Build hyprpaper if it's not installed on the system
.PHONY : hyprpaper
hyprpaper: hyprpaper:
git submodule init git submodule init
git submodule update --remote hyprpaper git submodule update --remote hyprpaper
__Hyprpaper = $(BIN_SYSTEM_PATH)/hyprpaper __Hyprpaper = hyprpaper/build
hyprpaper: $(__Hyprlang) hyprpaper: $(__Hyprlang)
@[[ -z "$(ls -A hyprpaper)" ]] && $(MAKE) hyprpaper
$(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \ $(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/usr -S ./hyprpaper -B ./hyprpaper/build -DCMAKE_INSTALL_PREFIX:PATH=/usr -S ./hyprpaper -B ./hyprpaper/build
$(CMAKE) --build ./hyprpaper/build --config Release --target hyprpaper \ $(CMAKE) --build ./hyprpaper/build --config Release --target hyprpaper \
-j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF` -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
# Build wl-clipboard if it's not installed on the system # Build wl-clipboard if it's not installed on the system
.PHONY : wl-clipboard
wl-clipboard: wl-clipboard:
git submodule init git submodule init
git submodule update --remote wl-clipboard git submodule update --remote wl-clipboard
__Wl_clipboard = $(BIN_SYSTEM_PATH)/wl-copy $(BIN_SYSTEM_PATH)/wl-paste __Wl_clipboard = wl-clipboard/build
$(__Wl_clipboard): $(__Wl_clipboard):
cd wl-clipboard && $(MESON) setup wl-clipboard build @[[ -z "$(ls -A wl-clipboard)" ]] && $(MAKE) wl-clipboard
cd wl-clipboard && $(MESON) setup --prefix=/usr build
ninja -C wl-clipboard/build ninja -C wl-clipboard/build
# Build and install tomlplusplus if it's not on the system
tomlplusplus:
git clone https://github.com/marzer/tomlplusplus.git
__Tomlplusplus = $(INC_SYSTEM_PATH)/toml++
$(__Tomlplusplus): tomlplusplus
@echo "Building and installing tomlplusplus..."
cd tomlplusplus && $(MESON) setup build --buildtype=release --prefix=/usr
ninja -C tomlplusplus/build
sudo $(MESON) install -C tomlplusplus/build
### PHONY targets that a user would run ### ### PHONY targets that a user would run ###
.PHONY : build .PHONY : build
build: $(__Tomlplusplus) $(__Hyprutils) $(__Hyprcursor) $(__Hyprlang) \ build: $(__Tomlplusplus) $(__Hyprutils) $(__Hyprcursor) $(__Hyprlang) \