Advertisement
justin_hanekom

Ada Makefile

Nov 30th, 2018
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 2.74 KB | None | 0 0
  1. # Makefile
  2. # Copyright (c) 2018 Justin Hanekom <justin_hanekom@yahoo.com>
  3.  
  4. # Permission is hereby granted, free of charge, to any person obtaining a copy
  5. # of this software and associated documentation files (the "Software"), to deal
  6. # in the Software without restriction, including without limitation the rights
  7. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. # copies of the Software, and to permit persons to whom the Software is
  9. # furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in all
  12. # copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. # SOFTWARE.
  21.  
  22. rm      := rm --recursive --force
  23. mkdir   := mkdir --parents
  24.  
  25. ada_version         := gnat2012
  26.  
  27. src_dir             := src
  28. main_src_dir        := $(src_dir)/main/ada
  29. test_src_dir        := $(src_dir)/test/ada
  30. target_dir          := target
  31. main_target_dir     := $(target_dir)/main/ada
  32. test_target_dir     := $(target_dir)/test/ada
  33. docs_dir            := $(target_dir)/docs
  34.  
  35. shared_or_static    := shared
  36. optimization_level  := 2
  37.  
  38. src_file    := main.adb
  39. main_app    := fizzbuzz
  40. test_file   := test_runner.adb
  41. test_app    := test_fizzbuzz
  42.  
  43. BASE_MAKE_FLAGS := $(BASE_MAKE_FLAGS) -$(ada_version) -$(shared_or_static) \
  44.     -I$(main_src_dir) -C -E -gnata -gnatF -gnatn -gnatwae -gnatwl -gnaty-o \
  45.     -k -m -s
  46. MAKE_FLAGS  := $(MAKE_FLAGS) $(BASE_MAKE_FLAGS) -D $(main_target_dir) \
  47.     -O$(optimization_level) -fstack-check -funroll-loops \
  48.     -gnatyx3abcefhiIklL5M78nprStux
  49. TEST_MAKE_FLAGS := $(DEBUG_FLAGS) $(BASE_MAKE_FLAGS) -D $(test_target_dir) \
  50.     -I$(test_src_dir) -aI/usr/include/aunit -aI/GNAT/2018/include/aunit \
  51.     -aL/usr/lib/aunit -aL/GNAT/2018/lib/aunit -g
  52.  
  53. .DEFAULT: all
  54. .PHONY : all
  55. all: main
  56.  
  57. .PHONY : main
  58. main : init_dirs
  59.     gnatmake $(MAKE_FLAGS) -o $(target_dir)/$(main_app) $(src_file)
  60.  
  61. .PHONY : test
  62. test : main init_dirs
  63.     gnatmake $(TEST_MAKE_FLAGS) -o $(target_dir)/$(test_app) $(test_file)
  64.  
  65. .PHONY : docs
  66. docs : main init_dirs
  67.  
  68. .PHONY : clean
  69. clean :
  70.     -@$(rm) $(main_target_dir)/*
  71.     -@$(rm) $(test_target_dir)/*
  72.     -@$(rm) GNAT-TEMP-*
  73.  
  74. .PHONY : clobber
  75. clobber : clean
  76.     -@$(rm) target
  77.  
  78. .PHONY : init_dirs
  79. init_dirs :
  80.     -@$(mkdir) $(main_src_dir)
  81.     -@$(mkdir) $(test_src_dir)
  82.     -@$(mkdir) $(main_target_dir)
  83.     -@$(mkdir) $(test_target_dir)
  84.     -@$(mkdir) $(docs_dir)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement