remove Makefile

This commit is contained in:
Ching Pei Yang 2024-10-09 17:06:13 +02:00
parent c8faec6668
commit a738958884
No known key found for this signature in database
GPG Key ID: 062FBBCE1D0C5DD9

View File

@ -1,73 +0,0 @@
# compile with HYPRLAND_HEADERS=<path_to_hl> make all
# make sure that the path above is to the root hl repo directory, NOT src/
# and that you have ran `make protocols` in the hl dir.
# This Makefile is not intended to be used directly, but rather as a template for your own plugin
# Change the PLUGIN_NAME variable to the name of your plugin
PLUGIN_NAME=example
# Enable parallel builds
MAKEFLAGS := --jobs=$(shell nproc)
MAKEFLAGS += --output-sync=target
# Source files
SOURCE_FILES=$(wildcard src/*.cpp)
# Add any new source file directories to the SOURCE_FILES variable
# SOURCE_FILES+=<new_source_dir>/*.cpp
# Header files, used to check if they have changed
INCLUDE_FILES=$(wildcard include/*.hpp)
INCLUDE_FILES+=$(wildcard include/*.h)
# Add any new header file directories to the INCLUDE_FILES variable
# INCLUDE_FILES+=<new_header_dir>/*.hpp
# Intermediate object files
OBJECT_DIR=obj
# Compiler flags
COMPILE_FLAGS=-g -fPIC --no-gnu-unique -std=c++23
COMPILE_FLAGS+=-fdiagnostics-color=always
COMPILE_FLAGS+=-I "/usr/include/pixman-1"
COMPILE_FLAGS+=-I "/usr/include/libdrm"
COMPILE_FLAGS+=-I "${HYPRLAND_HEADERS}"
COMPILE_FLAGS+=-I "${HYPRLAND_HEADERS}/subprojects/wlroots/include"
COMPILE_FLAGS+=-I "${HYPRLAND_HEADERS}/subprojects/wlroots/build/include"
COMPILE_FLAGS+=-Iinclude
# Linker flags, set to shared library (plugin)
LINK_FLAGS=-shared
# Phony targets (i.e. targets that don't actually build anything, and don't track dependencies)
# These will always be run when called
.PHONY: clean clangd
# build
all: check_env $(PLUGIN_NAME).so
# install to ~/.local/share/hyprload/plugins/bin, assuming that hyprload is installed
install: all
cp $(PLUGIN_NAME).so ${HOME}/.local/share/hyprload/plugins/bin
# ensure that HYPRLAND_HEADERS is set, otherwise error. Gives a more helpful error message than just include errors
check_env:
mkdir -p $(OBJECT_DIR)
ifndef HYPRLAND_HEADERS
$(error HYPRLAND_HEADERS is undefined! Please set it to the path to the root of the configured Hyprland repo)
endif
# build the plugin, using the headers from the configured Hyprland repo
$(OBJECT_DIR)/%.o: src/%.cpp $(INCLUDE_FILES)
g++ -c -o $@ $< $(COMPILE_FLAGS)
$(PLUGIN_NAME).so: $(addprefix $(OBJECT_DIR)/, $(notdir $(SOURCE_FILES:.cpp=.o)))
g++ $(LINK_FLAGS) -o $@ $^ $(COMPILE_FLAGS)
# clean up
clean:
rm -f $(OBJECT_DIR)/*.o
rm -f ./$(PLUGIN_NAME).so
# generate compile_flags.txt for clangd, if you use it. This is not necessary for building the plugin
# the alternative is to use the compile_commands.json file generated by eg. bear
clangd:
echo "$(COMPILE_FLAGS)" | sed 's/ -/\n-/g' | sed 's/--no-gnu-unique//g' | sed 's/-I \//-I\//g' | sed 's/std=c++23/std=c++2b/g' > compile_flags.txt