daily pastebin goal
7%
SHARE
TWEET

makefile-jag

a guest Dec 31st, 2014 171 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Atari Jaguar 68K toolchain makefile by Chilly Willy
  2. # adapted from Jim Ursetto' makefile for the DC
  3. # adapted from Stalin's build script version 0.3
  4. #
  5. # Interesting parameters:
  6. # erase=0|1                     Erase build directories on the fly to save space
  7. # thread_model=posix|single     Set gcc threading model
  8. # verbose=0|1                   Display
  9. #
  10. # Interesting targets (you can 'make' any of these):
  11. # all: build
  12. # build: build-m68k
  13. # build-m68k: build-m68k-binutils build-m68k-gcc
  14. # build-m68k-gcc: build-m68k-gcc-pass1 build-m68k-newlib build-m68k-gcc-pass2
  15. # build-m68k-newlib: build-m68k-newlib-only
  16.  
  17. # User configuration
  18. m68k_target=m68k-elf
  19. m68k_prefix := /opt/toolchains/jaguar/$(m68k_target)
  20. binutils_ver=2.24
  21. gcc_ver=4.8.3
  22. newlib_ver=2.1.0
  23. thread_model=single
  24. erase=0
  25. verbose=1
  26. # Set the languages to build for pass 2 of building gcc. The default
  27. # here is to build C, C++, Objective C, and Objective C++. You may want to take
  28. # out the latter two if you're not worried about them and/or you're short on
  29. # hard drive space.
  30. pass2_languages=c,c++,objc,obj-c++
  31.  
  32. # build variables
  33. install=$(prefix)/bin
  34. pwd := $(shell pwd)
  35. logdir := $(pwd)/logs
  36. PATH := $(m68k_prefix)/bin:$(PATH)
  37. binutils_dir=binutils-$(binutils_ver)
  38. gcc_dir=gcc-$(gcc_ver)
  39. newlib_dir=newlib-$(newlib_ver)
  40.  
  41. all: build
  42.  
  43. # ---- build {{{
  44.  
  45. build: build-m68k
  46. build-m68k: build-m68k-binutils build-m68k-gcc
  47. build-m68k-gcc: build-m68k-gcc-pass1 build-m68k-newlib build-m68k-gcc-pass2
  48. build-m68k-newlib: build-m68k-newlib-only
  49.  
  50. # Ensure that, no matter where we enter, prefix and target are set correctly.
  51. build_m68k_targets=build-m68k-binutils build-m68k-gcc build-m68k-gcc-pass1 build-m68k-newlib build-m68k-newlib-only build-m68k-gcc-pass2
  52. $(build_m68k_targets): prefix = $(m68k_prefix)
  53. $(build_m68k_targets): target = $(m68k_target)
  54. $(build_m68k_targets): extra_configure_args = --with-cpu=m68000 --disable-werror
  55.  
  56. build_binutils     = build-m68k-binutils
  57. build_gcc_pass1    = build-m68k-gcc-pass1
  58. build_newlib       = build-m68k-newlib-only
  59. build_gcc_pass2    = build-m68k-gcc-pass2
  60.  
  61. # Here we use the essentially same code for multiple targets,
  62. # differing only by the current state of the variables below.
  63. $(build_binutils): build = build-binutils-$(target)-$(binutils_ver)
  64. $(build_binutils): src_dir = binutils-$(binutils_ver)
  65. $(build_binutils): log = $(logdir)/$(build).log
  66. $(build_binutils): logdir
  67.         @echo "+++ Building $(src_dir) to $(build)..."
  68.         -mkdir -p $(build)
  69.         > $(log)
  70.         cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --disable-werror --enable-install-libbfd $(to_log)
  71.         make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
  72.         $(clean_up)
  73.  
  74. $(build_gcc_pass1) $(build_gcc_pass2): build = build-gcc-$(target)-$(gcc_ver)
  75. $(build_gcc_pass1) $(build_gcc_pass2): src_dir = gcc-$(gcc_ver)
  76. $(build_gcc_pass1): log = $(logdir)/$(build)-pass1.log
  77. $(build_gcc_pass1): logdir
  78.         @echo "+++ Building $(src_dir) to $(build) (pass 1)..."
  79.         -mkdir -p $(build)
  80.         > $(log)
  81.         cd $(build);  ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls $(extra_configure_args) $(to_log)
  82.         make -C $(build) all-gcc install-gcc DESTDIR=$(DESTDIR) $(to_log)
  83.  
  84. $(build_newlib): build = build-newlib-$(target)-$(newlib_ver)
  85. $(build_newlib): src_dir = newlib-$(newlib_ver)
  86. $(build_newlib): log = $(logdir)/$(build).log
  87. $(build_newlib): logdir
  88.         @echo "+++ Building $(src_dir) to $(build)..."
  89.         -mkdir -p $(build)
  90.         > $(log)
  91.         cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(extra_configure_args) $(to_log)
  92.         make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
  93.         $(clean_up)
  94.  
  95. $(build_gcc_pass2): log = $(logdir)/$(build)-pass2.log
  96. $(build_gcc_pass2): logdir
  97.         @echo "+++ Building $(src_dir) to $(build) (pass 2)..."
  98.         -mkdir -p $(build)
  99.         > $(log)
  100.         cd $(build);  ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --with-newlib --disable-libssp --disable-tls \
  101.                 --enable-threads=$(thread_model) --enable-languages=$(pass2_languages) $(extra_configure_args) $(to_log)
  102.         make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log)
  103.         $(clean_up)
  104.  
  105. # ---- }}}}
  106.  
  107.  
  108. # ---- support {{{
  109.  
  110. clean:
  111.         -rm -rf build-newlib-$(m68k_target)-$(newlib_ver)
  112.         -rm -rf build-gcc-$(m68k_target)-$(gcc_ver)
  113.         -rm -rf build-binutils-$(m68k_target)-$(binutils_ver)
  114.  
  115. logdir:
  116.         @mkdir -p $(logdir)
  117.  
  118. # If erase=1, erase build directories on the fly.
  119. ifeq (1,$(erase))
  120.         define clean_up
  121.         @echo "+++ Cleaning up $(build)..."
  122.         -rm -rf $(build)
  123.         endef
  124. endif
  125.  
  126. # If verbose=1, display output to screen as well as log files
  127. ifeq (1,$(verbose))
  128.         to_log = 2>&1 | tee -a $(log)
  129. else
  130.         to_log = >> $(log) 2>&1
  131. endif
  132.  
  133. # ---- }}}
  134.  
  135. # ---- phony targets {{{
  136.  
  137. .PHONY: all build build-m68k $(build_m68k_targets) clean
  138. .PHONY: build-binutils build-newlib build-gcc-pass1 build-gcc-pass2
  139.  
  140. # ---- }}}}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top