Guest User

Untitled

a guest
May 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. empty:=
  2. space:= $(empty) $(empty)
  3. path_escape = $(subst $(space),$(space),$(1))
  4.  
  5. TOP=$(call path_escape,$(abspath .))
  6. TARGET=$(TOP)/foo
  7.  
  8. $(info TOP='$(TOP)')
  9. $(info TARGET='$(TARGET)')
  10.  
  11. all: $(TARGET)
  12.  
  13. $(TARGET):
  14. touch '$(notdir $@)'
  15.  
  16. .PHONY: $(TARGET)
  17.  
  18. $ make
  19. TOP='/tmp/space-test'
  20. TARGET='/tmp/space-test/foo'
  21. touch 'foo'
  22.  
  23. TOP='/tmp/space test'
  24. TARGET='/tmp/space test/foo'
  25. touch 'space foo'
  26.  
  27. s? = $(subst $(empty) ,?,$1)
  28. ?s = $(subst ?, ,$1)
  29. notdirx = $(call ?s,$(notdir $(call s?,$1)))
  30.  
  31. $(TARGET):
  32. touch '$(call notdirx,$@)'
Add Comment
Please, Sign In to add comment