[riot-notifications] [RIOT-OS/RIOT] Makefile.base: use thin static archives. (#10195)

Juan I Carrano notifications at github.com
Wed Mar 6 15:38:04 CET 2019


jcarrano commented on this pull request.



> +# Use coreutils to calculate a relative path
+sys_relpath = $(shell realpath -m --relative-to=$(1) $(2))
+
+test-relpath:
+	@echo OK? $(call assert_eq,$(call relpath,/1/2/3/5/6/7,/1/2/3/4/5/6/7),$(call sys_relpath,/1/2/3/5/6/7,/1/2/3/4/5/6/7),)
+	@echo OK? $(call assert_eq,$(call relpath,/1/2/3/5/6/7,/),$(call sys_relpath,/1/2/3/5/6/7,/),)
+	@echo OK? $(call assert_eq,$(call relpath,/,/1/2/3/5/6/),$(call sys_relpath,/,/1/2/3/5/6/),)
+
+test-relpath-negtive:
+	# these fail but it should not matter because $1 should always be a dir
+	# and $2 a file
+	echo $(call relpath,/,/)
+	echo $(call relpath,/1/2/3,/1/2/3)
+
+# Return a path relative to the current directory
+relpath_here = $(call relpath,$(abspath .),$(abspath $(1)))

"Overloading" `relpath` to do something special when the first (or second) argument is empty exposes us to bugs: one of the arguments could come from a variable that is not defined (think a typo) and then, instead of getting an- obviously wrong- empty result one gets a path relative to the current directory.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10195#discussion_r262957679
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190306/88870b3c/attachment.html>


More information about the notifications mailing list