Update makefile

This commit is contained in:
ItsDrike 2023-07-23 18:16:30 +02:00
parent ab155b2678
commit 1ef67f7b26
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -7,6 +7,8 @@ INSTALL_LOCATION=${HOME}/.local/share/hyprload/plugins/bin
SOURCE_FILES=$(wildcard src/*.cpp) SOURCE_FILES=$(wildcard src/*.cpp)
# Compiler/Linker flags
COMPILE_DEFINES=-DWLR_USE_UNSTABLE COMPILE_DEFINES=-DWLR_USE_UNSTABLE
COMPILE_FLAGS=-g -fPIC --no-gnu-unique -std=c++23 COMPILE_FLAGS=-g -fPIC --no-gnu-unique -std=c++23
@ -17,23 +19,24 @@ LINK_FLAGS=-shared
# Phony targets (i.e. targets that don't actually build anything, and don't track dependencies) # Phony targets (i.e. targets that don't actually build anything, and don't track dependencies)
# These will always be run when called # These will always be run when called
.PHONY: clean clangd .PHONY: clean uninstall clangd
all: check_env $(PLUGIN_NAME).so all:
install: all
mkdir -p $(INSTALL_LOCATION)
cp $(PLUGIN_NAME).so $(INSTALL_LOCATION)
check_env:
@if ! pkg-config --exists hyprland; then \ @if ! pkg-config --exists hyprland; then \
echo 'Hyprland headers not available. Run `make pluginenv` in the root Hyprland directory.'; \ echo 'Hyprland headers not available. Run `make pluginenv` in the root Hyprland directory.'; \
exit 1; \ exit 1; \
fi fi
$(PLUGIN_NAME).so: $(SOURCE_FILES) $(INCLUDE_FILES)
g++ $(LINK_FLAGS) $(COMPILE_FLAGS) $(COMPILE_DEFINES) $(SOURCE_FILES) -o $(PLUGIN_NAME).so g++ $(LINK_FLAGS) $(COMPILE_FLAGS) $(COMPILE_DEFINES) $(SOURCE_FILES) -o $(PLUGIN_NAME).so
install: all
$(MAKE) clear
mkdir -p $(INSTALL_LOCATION)
cp $(PLUGIN_NAME).so $(INSTALL_LOCATION)
uninstall:
rm -rf $(INSTALL_LOCATION)
clean: clean:
rm ./${PLUGIN_NAME}.so rm ./${PLUGIN_NAME}.so