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.
136 lines
4.7 KiB
Makefile
136 lines
4.7 KiB
Makefile
# Variables for build tools
|
|
CMAKE=/usr/bin/cmake
|
|
MESON=/usr/bin/meson
|
|
# Paths for installed apps
|
|
BIN_SYSTEM_PATH=/usr/local/bin
|
|
INC_SYSTEM_PATH=/usr/include
|
|
|
|
# Set the default target to build
|
|
default-target: build
|
|
|
|
### Makefile targets for hyprwm libraries ###
|
|
|
|
# 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
|
|
|
|
# Build hyprcursor if the .hpp file is not installed (required hyprlang)
|
|
# Library for hyprwm
|
|
hyprcursor:
|
|
git submodule init
|
|
git submodule update --remote hyprcursor
|
|
__Hypercursor = $(INC_SYSTEM_PATH)/hyprcursor.hpp
|
|
$(__Hypercursor): $(__Hyperlang)
|
|
$(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \
|
|
-DCMAKE_INSTALL_PREFIX:PATH=/usr -S ./hyprcursor -B ./hyprcursor/build
|
|
$(CMAKE) --build ./hyprcursor/build --config Release --target all \
|
|
-j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
|
|
@echo "Installing library hyprcursor..."
|
|
sudo $(CMAKE) --install hyprcursor/build
|
|
|
|
# Build hyprutils if the .hpp file is not installed
|
|
# Library for hyprwm
|
|
hyprutils:
|
|
git submodule init
|
|
git submodule update --remote hyprutils
|
|
__Hyprutils = $(INC_SYSTEM_PATH)/hyprutils.hpp
|
|
$(__Hyprutils): hyprutils
|
|
$(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \
|
|
-DCMAKE_INSTALL_PREFIX:PATH=/usr -S hyprutils -B ./hyprutils/build
|
|
$(CMAKE) --build ./hyprutils/build --config Release --target all -j`nproc \
|
|
2>/dev/null || getconf _NPROCESSORS_CONF`
|
|
sudo $(CMAKE) --install hyprutils/build
|
|
|
|
# Build hyprlang if the .hpp file is not installed
|
|
# Library for hyprwm
|
|
hyprlang:
|
|
git submodule init
|
|
git submodule update --remote hyprlang
|
|
__Hyprlang = $(INC_SYSTEM_PATH)/hyprlang.hpp
|
|
$(__Hyprlang): $(__Hyprutils)
|
|
# built using cmake
|
|
$(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \
|
|
-DCMAKE_INSTALL_PREFIX:PATH=/usr -S ./hyprlang -B ./hyprlang/build
|
|
$(CMAKE) --build ./hyprlang/build --config Release --target hyprlang \
|
|
-j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
|
|
# At this point install hyprlang since it is a library other apps need
|
|
@echo "Installing library hyprlang..."
|
|
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
|
|
.PHONY : hyprlock
|
|
hyprlock:
|
|
git submodule init
|
|
git submodule update --remote hyprlock
|
|
__Hyprlock = hyprlock/build
|
|
$(__Hyprlock): $(__Hyprlang)
|
|
@[[ -z "$(ls -A hyprlock)" ]] && $(MAKE) hyprlock
|
|
$(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \
|
|
-S ./hyprlock -B ./hyprlock/build
|
|
$(CMAKE) --build ./hyprlock/build --config Release --target hyprlock \
|
|
-j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
|
|
|
|
# Build hyprpaper if it's not installed on the system
|
|
.PHONY : hyprpaper
|
|
hyprpaper:
|
|
git submodule init
|
|
git submodule update --remote hyprpaper
|
|
__Hyprpaper = hyprpaper/build
|
|
hyprpaper: $(__Hyprlang)
|
|
@[[ -z "$(ls -A hyprpaper)" ]] && $(MAKE) hyprpaper
|
|
$(CMAKE) --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release \
|
|
-DCMAKE_INSTALL_PREFIX:PATH=/usr -S ./hyprpaper -B ./hyprpaper/build
|
|
$(CMAKE) --build ./hyprpaper/build --config Release --target hyprpaper \
|
|
-j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
|
|
|
|
# Build wl-clipboard if it's not installed on the system
|
|
.PHONY : wl-clipboard
|
|
wl-clipboard:
|
|
git submodule init
|
|
git submodule update --remote wl-clipboard
|
|
__Wl_clipboard = wl-clipboard/build
|
|
$(__Wl_clipboard):
|
|
@[[ -z "$(ls -A wl-clipboard)" ]] && $(MAKE) wl-clipboard
|
|
cd wl-clipboard && $(MESON) setup --prefix=/usr build
|
|
ninja -C wl-clipboard/build
|
|
|
|
### PHONY targets that a user would run ###
|
|
.PHONY : build
|
|
build: $(__Tomlplusplus) $(__Hyprutils) $(__Hyprcursor) $(__Hyprlang) \
|
|
$(__Hyprlock) $(__Hyprpaper) $(__Wl-clipboard) $(__Hyprland)
|
|
|
|
.PHONY : install
|
|
install: build
|
|
@echo "Installing Hyprland..."
|
|
sudo $(MAKE) -f Hyprland/Makefile install
|
|
@echo "Installing hyprlock..."
|
|
sudo $(CMAKE) --install hyprlock/build
|
|
@echo "Installing hyprpaper"
|
|
$(CMAKE) --install hyprpaper/build
|
|
@echo "Installing wl-clipboard"
|
|
sudo $(MESON) install -C wl-clipboard/build
|
|
|
|
|
|
.PHONY: test
|
|
test: build
|
|
@echo "Be real, you don't want to do this, so we'll abort."
|
|
$(error No test-suite implemented)
|