Guest User

Untitled

a guest
Aug 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. Building several configurations from same source code in a single makefile
  2. CINPUTFILES = Testfile.c
  3.  
  4. all: v12target v13target
  5.  
  6. # the same source code is built several different ways depending on a
  7. # list of preset configurations
  8. v12target: lots_of_common_variables = hello
  9. v12target: more_variables = v12_specific
  10. v12target: Rev12Output.mycommontargets
  11.  
  12. v13target: lots_of_common_variables = hello
  13. v13target: more_variables = v13_specific
  14. v13target: Rev13Output.mycommontargets
  15.  
  16. # (more vXXtarget targets omitted)
  17.  
  18. # TODO: why is @echo required?
  19. %.mycommontargets: %.hex %.elf
  20. @echo
  21.  
  22. # TODO: why are these output files deleted?
  23. %.elf: $(CINPUTFILES)
  24. cp $< $@
  25.  
  26. %.hex: %.elf
  27. cp $< $@
  28.  
  29. # TODO: correct way of adding the dummy mycommontargets to PHONY?
  30. .PHONY : all clean
  31.  
  32. make: *** No rule to make target `Rev12Output.mycommontargets', needed by `v12target'. Stop.
  33.  
  34. $ make
  35. cp Testfile.c Rev12Output.elf
  36. cp Rev12Output.elf Rev12Output.hex
  37.  
  38. cp Testfile.c Rev13Output.elf
  39. cp Rev13Output.elf Rev13Output.hex
  40.  
  41. rm Rev12Output.hex Rev12Output.elf Rev13Output.hex Rev13Output.elf
Add Comment
Please, Sign In to add comment