Advertisement
bahman

Untitled

Sep 26th, 2023
1,134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.38 KB | Source Code | 0 0
  1. # See https://lists.gnu.org/archive/html/bug-make/2023-09/msg00005.html
  2. # for full discussion
  3. #
  4. # Author Bahman Movaqar <Bahman@BahmanM.com>
  5.  
  6. SHELL := /usr/bin/env -S bash -o pipefail
  7. .DEFAULT_GOAL := all
  8.  
  9. ########################################################################
  10.  
  11. ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
  12. build.dir := $(ROOT)build/
  13. src.dir := $(ROOT)
  14.  
  15. ########################################################################
  16.  
  17. A2L-files.src = $(shell find $(src.dir) -type f -name '*.a2l')
  18. A2L-files.dst = $(subst $(src.dir),$(build.dir),$(A2L-files.src))
  19.  
  20. ########################################################################
  21.  
  22. $(build.dir) :
  23.     mkdir -p $(@)
  24.  
  25. ########################################################################
  26.  
  27. $(build.dir)%.a2l : $(src.dir)%.a2l
  28.     mkdir -p $(build.dir)$(subst $(src.dir),,$(dir $(<))) \
  29.     && cp $(<) $(@)
  30.  
  31. ########################################################################
  32.  
  33. .PHONY : merge
  34.  
  35. ifneq ($(A2L-files.dst),)
  36.  
  37. merge : $(A2L-files.dst)
  38.     @echo MERGE POSSIBLE
  39.     @echo ...
  40.  
  41. else
  42.  
  43. merge :
  44.     @echo MERGE NOT POSSIBLE
  45.     @echo ...
  46.  
  47. endif
  48.  
  49. ########################################################################
  50.  
  51. .PHONY : clean
  52.  
  53. clean :
  54.     -rm -rf $(build.dir)
  55.  
  56. ########################################################################
  57.  
  58. .PHONY : all
  59.  
  60. all : | $(build.dir)
  61. all : merge
  62.  
Tags: make makefile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement