summaryrefslogtreecommitdiffstats
path: root/fpga/hp_lcd_driver/relpath.mk
diff options
context:
space:
mode:
authorroot <root@new-fish.medaka.james.internal>2025-04-30 23:31:35 +0100
committerroot <root@new-fish.medaka.james.internal>2025-04-30 23:31:35 +0100
commitcff444eb1bd7bc498bc50dca506b745317bc3494 (patch)
treebc48b69e520f66f73eddefed6d430c03dc118b21 /fpga/hp_lcd_driver/relpath.mk
parent655dfad152b35b26f97db45b6723bfe7c91961f2 (diff)
downloadhp_instrument_lcds-cff444eb1bd7bc498bc50dca506b745317bc3494.tar.gz
hp_instrument_lcds-cff444eb1bd7bc498bc50dca506b745317bc3494.tar.bz2
hp_instrument_lcds-cff444eb1bd7bc498bc50dca506b745317bc3494.zip
move fpga to fpga directory
Diffstat (limited to 'fpga/hp_lcd_driver/relpath.mk')
-rw-r--r--fpga/hp_lcd_driver/relpath.mk35
1 files changed, 35 insertions, 0 deletions
diff --git a/fpga/hp_lcd_driver/relpath.mk b/fpga/hp_lcd_driver/relpath.mk
new file mode 100644
index 0000000..ee42901
--- /dev/null
+++ b/fpga/hp_lcd_driver/relpath.mk
@@ -0,0 +1,35 @@
+override define \s :=
+$() $()
+endef
+
+ifndef $(\s)
+override $(\s) :=
+else
+$(error Defined special variable '$(\s)': reserved for internal use)
+endif
+
+override define dirname
+$(patsubst %/,%,$(dir $(patsubst %/,%,$1)))
+endef
+
+override define prefix_1
+$(if $(or $\
+$(patsubst $(abspath $3)%,,$(abspath $1)),$\
+$(patsubst $(abspath $3)%,,$(abspath $2))),$\
+$(strip $(call prefix_1,$1,$2,$(call dirname,$3))),$\
+$(strip $(abspath $3)))
+endef
+
+override define prefix
+$(call prefix_1,$1,$2,$1)
+endef
+
+override define relpath_1
+$(patsubst /%,%,$(subst $(\s),/,$(patsubst %,..,$(subst /,$(\s),$\
+$(patsubst $3%,%,$(abspath $2)))))$\
+$(patsubst $3%,%,$(abspath $1)))
+endef
+
+override define relpath
+$(call relpath_1,$1,$2,$(call prefix,$1,$2))
+endef